-
Notifications
You must be signed in to change notification settings - Fork 0
Fix frequent motor on off issue #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,8 +84,9 @@ def main(): | |||||||
| try: | ||||||||
| lastCheckTime = time.time() | ||||||||
| preNightFillActive = False | ||||||||
| preNightFillStart = None | ||||||||
| preNightFillStartTime = None | ||||||||
| while True: | ||||||||
| print("Main loop iteration...") | ||||||||
| currentTime = time.time() | ||||||||
| now = datetime.now() | ||||||||
|
|
||||||||
|
|
@@ -154,7 +155,6 @@ def main(): | |||||||
| distance = readDistance(gpio, ULTRASONIC_TRIG, ULTRASONIC_ECHO) | ||||||||
| print(f"Distance: {distance} cm") | ||||||||
| waterLevel = TANK_HEIGHT - distance | ||||||||
|
||||||||
| waterLevel = TANK_HEIGHT - distance | |
| waterLevel = TANK_HEIGHT - distance | |
| rtDb = readRtDb() |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| import json | ||||||
| import os | ||||||
| from Common import RT_DB_FILE | ||||||
| from Common import * | ||||||
|
||||||
| from Common import * | |
| from Common import RT_DB_FILE, TWO_THIRD_LEVEL, MAX_WATER_LEVEL, TANK_HEIGHT, BOTTOM_FULL_DISTANCE |
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The margin value of 5 is duplicated across all three functions. Consider defining this as a constant (e.g., HYSTERESIS_MARGIN = 5) in Common.py to improve maintainability and consistency.
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The margin value of 5 is duplicated across all three functions. Consider defining this as a constant (e.g., HYSTERESIS_MARGIN = 5) in Common.py to improve maintainability and consistency.
Copilot
AI
Sep 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The margin value of 5 is duplicated across all three functions. Consider defining this as a constant (e.g., HYSTERESIS_MARGIN = 5) in Common.py to improve maintainability and consistency.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| appVersion: 1.2.1.1004 | ||
| appVersion: 1.2.2.1005 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to operator precedence, this calculates
(MAX_WATER_LEVEL // 3) * 2instead of the intended two-thirds. This should beTWO_THIRD_LEVEL = MAX_WATER_LEVEL * 2 // 3to get the correct two-thirds calculation.