Skip to content

Commit 77c629a

Browse files
add Submenu readme and test
1 parent 085f6d1 commit 77c629a

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ Update the `TankController` code from C++ to Python and run on a Raspberry Pico.
1414

1515
To set up and run this project, the system must meet the following requirements:
1616

17-
- **uv**: The python project package manager must be installed. Learn more at [https://docs.astral.sh/uv/](https://docs.astral.sh/uv/).
18-
- **tkinter**: The Python GUI to test locally. Often installed separately.
17+
- **uv**: The python project package manager must be installed. Learn more at [https://docs.astral.sh/uv/](https://docs.astral.sh/uv/).
18+
Format contributions with `uv run black .`
19+
- **tkinter**: The Python GUI to test locally. Often installed separately as `python3-tk`.
20+
Verify with `python -m tkinter`. A small GUI window should appear if Tkinter is installed correctly.
1921

2022
### Mac Requirements
2123

@@ -33,6 +35,26 @@ To run in a local environment with mocked devices (with the UI State Machine int
3335
./run_gui.sh
3436
```
3537

38+
## Features
39+
40+
| View Commands | Set Commands |
41+
| ----------------------- | ------------------- |
42+
| View IP and MAC | pH calibration |
43+
| View free memory | Clear pH calibra |
44+
| View Google mins | Clear Temp calib |
45+
| View log file | Set chill/heat |
46+
| View pH slope | Set Google mins |
47+
| View PID | Set KD |
48+
| View tank ID | Set KI |
49+
| View temp cal | Set KP |
50+
| View time | Set pH target |
51+
| View version | Set pH w sine |
52+
| | Set Temp w sine |
53+
| | PID on/off |
54+
| | Set Tank ID |
55+
| | Temp calibration |
56+
| | Set temperature |
57+
| | Set date/time |
3658

3759
## Testing
3860

test/ui_state/main_menu_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,27 @@ def test_loop(print_mock):
157157
mock.call("<4 ^2 8v 6>", line=2),
158158
]
159159
)
160+
161+
162+
@mock.patch.object(LiquidCrystal, "print")
163+
def test_sub_menu_access(print_mock):
164+
"""
165+
The function to test access to MainMenu sub menu features
166+
"""
167+
main_menu = MainMenu(Titrator())
168+
169+
# Verify all view menu entries
170+
main_menu.level1 = 1
171+
for index, label in enumerate(main_menu.view_menus):
172+
print_mock.reset_mock()
173+
main_menu.level2 = index
174+
main_menu.loop()
175+
print_mock.assert_any_call(label, line=1)
176+
177+
# Verify all set menu entries
178+
main_menu.level1 = 2
179+
for index, label in enumerate(main_menu.set_menus):
180+
print_mock.reset_mock()
181+
main_menu.level2 = index
182+
main_menu.loop()
183+
print_mock.assert_any_call(label, line=1)

0 commit comments

Comments
 (0)