Add single mode#18
Conversation
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
update the gpio lib to work in any platform Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
ffefcf7 to
02fb777
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds single switch mode functionality to the spring-loaded switch testing system. It introduces the ability to switch between different switch types (single vs double microswitch) and adds motor control functionality through a web interface.
- Refactors main.py to support both single and double switch modes
- Adds motor control toggle functionality
- Implements switch type selection with dynamic model switching
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| config.yaml | Updates application version from 1.8.1.1016 to 1.9.1.1017 |
| Web/style.css | Adds CSS styles for switch type dropdown and motor control buttons |
| Web/script.js | Implements JavaScript functions for switch type updates and motor toggling |
| Web/postRequest.php | Adds server-side handlers for switch type and motor control requests |
| Web/index.php | Updates UI to include switch type selection and motor status controls |
| Web/backend.php | Adds backend functions for switch model and motor status management |
| Script/utility.py | Adds utility functions for switch model and motor control state management |
| Script/singleSwitch.py | New file implementing single switch testing logic |
| Script/rpigpio.py | Adds error handling for missing RPi.GPIO module |
| Script/main.py | Refactors to support both single and double switch modes |
| Script/lcd20x4.py | Adds error handling for missing RPLCD module |
| Script/doubleSwitch.py | New file containing extracted double switch logic from original main.py |
| Script/common.py | Adds constants for switch model types and loop return values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| function getSwitchType() | ||
| { | ||
| $rtConfig = getRtConfig(); | ||
| return isset($rtConfig['switchModel']) ? $rtConfig['switchModel'] : $SWT_MODEL_DOUBLE_TYPE_B; // Default to Type-B |
There was a problem hiding this comment.
The variable $SWT_MODEL_DOUBLE_TYPE_B is used but not defined in this scope. The constants are defined at the top of the file but PHP variables need the $ prefix or should be defined as constants.
| blankData = { | ||
| "cycleCount": 0 | ||
| "cycleCount": 0, | ||
| "switchModel": SWT_MODEL_DOUBLE_TYPE_B, |
There was a problem hiding this comment.
The constant SWT_MODEL_DOUBLE_TYPE_B is used but not imported. This will cause a NameError since the constant is defined in common.py but not imported in this file.
|
|
||
|
|
||
| def getSwitchModel(): | ||
| switchModel = SWT_MODEL_DOUBLE_TYPE_B |
There was a problem hiding this comment.
The constant SWT_MODEL_DOUBLE_TYPE_B is used but not imported. This will cause a NameError since the constant is defined in common.py but not imported in this file.
| if rtData: | ||
| switchModel = rtData.get("switchModel") | ||
| if switchModel == None: | ||
| switchModel = SWT_MODEL_DOUBLE_TYPE_B |
There was a problem hiding this comment.
The constant SWT_MODEL_DOUBLE_TYPE_B is used but not imported. This will cause a NameError since the constant is defined in common.py but not imported in this file.
No description provided.