Добавлен умный поиск в каналах

This commit is contained in:
AidarKC
2026-10-11 23:57:09 +03:00
parent 07ddaf5e4c
commit bb725ee451
28 changed files with 731 additions and 208 deletions
@@ -4,6 +4,7 @@ Diagnostic sketches:
- `main-device/test_sketches/usb_contact_sensor_test/usb_contact_sensor_test.ino`
- `main-device/test_sketches/usb_contact_sensor_debug_test/usb_contact_sensor_debug_test.ino`
- `main-device/test_sketches/breath_dual_mode_monitor/breath_dual_mode_monitor.ino`
- `main-device/test_sketches/usb_contact_resistance_test/usb_contact_resistance_test.ino`
- `main-device/test_sketches/usb_contact_screen_start_stub/usb_contact_screen_start_stub.ino`
@@ -114,3 +115,45 @@ After tapping `START`:
- reset/power cycle restores ordinary native USB boot
This version is intended to monitor breathing cadence from a dry-contact USB D-/D+ sensor.
## Dual-mode GFX breath monitor version
The `breath_dual_mode_monitor` sketch reuses the production-style `Arduino_GFX` visual approach, audio path, settings sliders, and average-cycle alert behavior from the USB contact breath monitor. It supports two start modes on one firmware: USB contact sensor mode and external button mode.
Initial screen:
- title: `BREATH MONITOR`
- state: `READY`
- action button: `START USB SENSOR`
- action button: `START BUTTONS`
After `START USB SENSOR`:
- GPIO19 / USB `D-` is configured as `OUTPUT LOW`
- GPIO20 / USB `D+` is configured as `INPUT_PULLUP`
- closed contact is treated as `EXHALE`
- open contact is treated as `INHALE`
- USB sensor cycles shorter than 3 seconds are ignored without resetting the current cycle timer
- a short `KEY3 / GPIO18` press opens or closes settings in USB sensor mode
- the bottom line shows the durations of the last 5 accepted USB sensor cycles
After `START BUTTONS`:
- `KEY3 / GPIO18` is the external `INHALE` button, active LOW
- `BOOT / GPIO0` is the external `EXHALE` button, active LOW
- do not hold `BOOT` while booting or resetting the board
- the working screen does not show touch `INHALE`/`EXHALE` buttons
- long-holding `KEY3 / INHALE` for about 850 ms opens settings; the long press still counts as an inhale press
- while settings are open, the next `KEY3 / INHALE` press closes settings and also counts as an inhale press
In both modes:
- one breathing cycle is measured from one `EXHALE` tap to the next `EXHALE` tap
- inhale before any exhale does not create a cycle
- button-mode cycles shorter than 1.5 seconds are ignored
- USB sensor cycles shorter than 3 seconds are ignored
- the UI shows current cycle time, arithmetic average over the last 5 completed cycles, elapsed session time, selected limit, long-pause count, short-average count, and current short-average streak
- the lower numeric fields use a larger font than before
- if the average of the last up to 5 completed cycles is shorter than the selected limit, warning beeps are played like in the USB contact breath monitor
- if the current cycle reaches 60 seconds, 5 loud warning beeps are played, then after 5 seconds another 5 loud warning beeps are played, repeating until the user changes phase / exits the long cycle
- settings keep the same sliders: limit `5/7/10/15/20` seconds, quiet cycle tick volume `0..10`, and alert volume `0..10`