Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ reviews:
base_branches:
- ".*"
instructions: |
Python CLI installer for SpoolSense (scanner firmware + middleware).
Single-file script (install.py) that runs on Raspberry Pi and laptops.
Python CLI installer for SpoolSense (scanner firmware + middleware).
Single-file script (install.py) that runs on Raspberry Pi and laptops.

## Project-specific rules
## Project-specific rules

- All functions must have type hints and docstrings
- User input must be validated before use (validate_* functions)
- Passwords must use getpass, never plain input()
- All external commands (esptool, git, pip) must handle FileNotFoundError
- sys.exit() calls must have user-friendly error messages, not raw tracebacks
- Support Linux (Pi), macOS, and Windows where possible
- All functions must have type hints and docstrings
- User input must be validated before use (validate_* functions)
- Passwords must use getpass, never plain input()
- All external commands (esptool, git, pip) must handle FileNotFoundError
- sys.exit() calls must have user-friendly error messages, not raw tracebacks
- Support Linux (Pi), macOS, and Windows where possible
11 changes: 11 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def collect_scanner_config() -> Dict[str, Union[str, int]]:
print(f"\n{C.CYAN}── Optional Hardware ──────────────────{C.RESET}\n")
lcd_on = ask_yesno("16x2 I2C LCD display attached?", default=False)
led_on = ask_yesno("Status LED attached?", default=True)
keypad_on = ask_yesno("3x4 matrix keypad attached?", default=False)

print(f"\n{C.CYAN}── Printer Integration ────────────────{C.RESET}\n")
moonraker_url = ""
if ask_yesno("Klipper / Moonraker printer?", default=False):
moonraker_url = ask("Moonraker URL", default="http://localhost:7125",
validate=validate_url)

return {
"board": board,
Expand All @@ -261,6 +268,8 @@ def collect_scanner_config() -> Dict[str, Union[str, int]]:
"auto_mode": int(auto_mode),
"lcd_on": 1 if lcd_on else 0,
"led_on": 1 if led_on else 0,
"keypad_on": 1 if keypad_on else 0,
"moonraker_url": moonraker_url,
}


Expand Down Expand Up @@ -347,6 +356,8 @@ def generate_nvs_csv(config: Dict[str, Union[str, int]]) -> str:
f"auto_mode,data,u8,{config['auto_mode']}",
f"lcd_on,data,u8,{config['lcd_on']}",
f"led_on,data,u8,{config['led_on']}",
f"keypad_on,data,u8,{config['keypad_on']}",
f"moonraker_url,data,string,{config['moonraker_url']}",
]
return "\n".join(lines) + "\n"

Expand Down
2 changes: 2 additions & 0 deletions nvs_keys.csv
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ spoolman_url,data,string,Spoolman base URL
auto_mode,data,u8,Automation mode: 0=Self Directed 1=Controlled by HA
lcd_on,data,u8,LCD display enabled (1) or disabled (0)
led_on,data,u8,Status LED enabled (1) or disabled (0)
keypad_on,data,u8,3x4 matrix keypad enabled (1) or disabled (0)
moonraker_url,data,string,Moonraker URL for Klipper integration (e.g. http://192.168.1.72:7125)