Skip to content

Commit

Permalink
Merge pull request #218 from builder555/dev
Browse files Browse the repository at this point in the history
fix: possible fix for uncontrolled temperature changes
  • Loading branch information
builder555 committed Sep 21, 2024
2 parents 050bea0 + 25bf589 commit 5a88ef0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ python_version = "3"
[scripts]
"server" = "python main.py"
"test" = "pytest"
"format" = "black ."
4 changes: 2 additions & 2 deletions backend/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import argparse


def get_resource_path(relative_path, max_levels=3):
def get_resource_path(relative_path: str, max_levels: int = 3):
"""Get the absolute path to the resource, works for development and for PyInstaller"""
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = getattr(sys, "_MEIPASS", os.path.abspath("."))
Expand All @@ -19,7 +19,7 @@ def get_resource_path(relative_path, max_levels=3):
return os.path.join(base_path, relative_path)


def parse_cmd_args(default_host, default_port) -> argparse.Namespace:
def parse_cmd_args(default_host: str, default_port: int) -> argparse.Namespace:
parser = argparse.ArgumentParser(description="PineSAM - Pinecil v2 Control")
parser.add_argument(
"host",
Expand Down
6 changes: 3 additions & 3 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import asyncio
import os
import sys
from pinecil_monitor import PinecilMonitor, PinecilFinder
from ws_server import CommandProcessor, WebSocketHandler
from version_checker import VersionChecker
import logging
import webbrowser
from io_utils import parse_cmd_args, get_resource_path
from rich.logging import RichHandler
import argparse

LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO").upper()
timestamp_format = "%H:%M:%S"
Expand All @@ -22,7 +22,7 @@
DEFAULT_PORT = 8080


async def handle_ui_opening(args):
async def handle_ui_opening(args: argparse.Namespace):
host = args.host if args.host != "0.0.0.0" else "localhost"
if not args.no_open:
await asyncio.sleep(5)
Expand All @@ -32,7 +32,7 @@ async def handle_ui_opening(args):
logging.info(f"Open browser at http://{host}:{args.port}")


async def main(stop_event=asyncio.Event()):
async def main(stop_event: asyncio.Event = asyncio.Event()):
args = parse_cmd_args(DEFAULT_HOST, DEFAULT_PORT)
if not args.host or not args.port:
return
Expand Down
4 changes: 2 additions & 2 deletions backend/pinecil_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def __init__(self, finder: PinecilFinder, broadcast_func: Callable):
self.should_announce_not_found = True

@property
def pinecil(self):
def pinecil(self) -> Pinecil | None:
return self.pinecil_finder.selected

async def monitor(self, stop_event):
async def monitor(self, stop_event: asyncio.Event):
logging.info("Starting pinecil monitor")
while not stop_event.is_set():
if not self.pinecil_finder.pinecils:
Expand Down
4 changes: 4 additions & 0 deletions ui/src/components/TheWorkView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const setExactTemperature = (temp) => {
@mousedown.left="onChangeTempBtnDown(-1)"
@touchend="onChangeTempBtnUp"
@mouseup="onChangeTempBtnUp"
@mouseleave="onChangeTempBtnUp"
@touchleave="onChangeTempBtnUp"
>
<i class="fas fa-minus"></i>
</button>
Expand All @@ -90,6 +92,8 @@ const setExactTemperature = (temp) => {
@mousedown.left="onChangeTempBtnDown(1)"
@touchend="onChangeTempBtnUp"
@mouseup="onChangeTempBtnUp"
@touchleave="onChangeTempBtnUp"
@mouseleave="onChangeTempBtnUp"
>
<i class="fas fa-plus"></i>
</button>
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.6
2.2.9

0 comments on commit 5a88ef0

Please sign in to comment.