Difference between revisions of "Developer mode"
(Add Identify Device section (Morse code LED blink)) |
(Update dev mode to match actual bcmeter-dev config.py: restructured sections (calibration vs optical), added all actual parameters with correct defaults, added CLI debug mode docs, added AFC slope_gain, hardware swap_channels/spi_vref/display params) |
||
| Line 21: | Line 21: | ||
! Parameter !! Description !! Default | ! Parameter !! Description !! Default | ||
|- | |- | ||
| ''' | | '''Sample spot diameter''' || Diameter of the filter area exposed to sample air (cm). Critical for absorption calculation. || 0.4 cm | ||
|- | |- | ||
| ''' | | '''Filter scattering factor''' || Correction factor for filter material light scattering || 1.39 | ||
|- | |- | ||
| ''' | | '''Device correction factor''' || Device-specific correction factor for BC calculation || 1.0 | ||
|} | |} | ||
| Line 37: | Line 33: | ||
! Parameter !! Description !! Default | ! Parameter !! Description !! Default | ||
|- | |- | ||
| ''' | | '''880nm IR LED brightness''' || Duty cycle for the 880nm IR LED (0–255) || 100 (auto-set during calibration) | ||
|- | |||
| '''520nm Green LED brightness''' || Duty cycle for the 520nm green LED (0–255) || 255 (auto-set) | |||
|- | |||
| '''370nm UV LED brightness''' || Duty cycle for the 370nm UV LED (0–255) || 255 (auto-set) | |||
|- | |||
| '''Calibration factor 880nm''' || K factor (Ref/Sen ratio) from last calibration || 1.0 (auto-set) | |||
|- | |||
| '''Calibration factor 520nm''' || K factor for 520nm channel || 1.0 (auto-set) | |||
|- | |- | ||
| ''' | | '''Calibration factor 370nm''' || K factor for 370nm channel || 1.0 (auto-set) | ||
|- | |- | ||
| ''' | | '''Min ADC voltage before error''' || Minimum acceptable ADC voltage (V) before triggering ERR_ADC_LOW || 0.5 | ||
|} | |} | ||
| Line 49: | Line 53: | ||
! Parameter !! Description !! Default | ! Parameter !! Description !! Default | ||
|- | |- | ||
| '''Pump | | '''Pump power''' || Base pump PWM duty cycle (0–255) || 20 | ||
|- | |- | ||
| ''' | | '''Minimum pump duty cycle''' || Minimum duty to maintain airflow || 35 | ||
|- | |- | ||
| ''' | | '''Maximum pump duty cycle''' || Maximum pump speed limit || 255 | ||
|- | |- | ||
| ''' | | '''Minimum airflow (ml/min)''' || Stall detection threshold || 70 | ||
|- | |- | ||
| '''PWM frequency''' || Pump control frequency (Hz) || 40 | | '''PWM frequency''' || Pump control frequency (Hz) || 40 | ||
|- | |- | ||
| ''' | | '''12V pump duty cycle''' || Duty cycle for 12V pump || 20 | ||
|- | |||
| '''Reverse pump duty cycle''' || Reverse the duty cycle logic || false | |||
|- | |- | ||
| '''Enable 12V output''' || Activate 12V auxiliary power rail || false | | '''Enable 12V power output''' || Activate 12V auxiliary power rail || false | ||
|- | |||
| '''Log pump duty cycle per sample''' || Include pump duty in CSV output || false | |||
|} | |} | ||
| Line 69: | Line 77: | ||
! Parameter !! Description !! Default | ! Parameter !! Description !! Default | ||
|- | |- | ||
| '''AFC flow | | '''AFC: BC below this = max flow''' || BC threshold (ng/m³) below which maximum airflow is used || 300 | ||
|- | |||
| '''AFC: BC above this = min flow''' || BC threshold (ng/m³) above which minimum airflow is used || 2000 | |||
|- | |||
| '''AFC: min airflow''' || Minimum airflow when AFC is active (LPM) || 0.05 | |||
|- | |- | ||
| '''AFC | | '''AFC: max airflow''' || Maximum airflow when AFC is active (LPM) || 0.7 | ||
|- | |- | ||
| '''AFC | | '''AFC: flow boost per 100ng/min descent''' || Slope gain for rapid BC decrease || 0.05 | ||
|} | |} | ||
| Line 81: | Line 93: | ||
! Parameter !! Description !! Default | ! Parameter !! Description !! Default | ||
|- | |- | ||
| ''' | | '''Enable WiFi''' || WiFi connectivity available || true | ||
|- | |- | ||
| ''' | | '''4G/IOT connectivity''' || 4G/LTE modem available || false | ||
|- | |- | ||
| ''' | | '''Swap data channels''' || Swap sensor/reference ADC channels || false | ||
|- | |||
| '''Reference voltage for SPI ADC''' || ADC reference voltage (V) || 4.096 | |||
|- | |- | ||
| ''' | | '''Device has display''' || Enable SSD1306 display support || false | ||
|} | |} | ||
==== System (dev:system) ==== | ==== System (dev:system) ==== | ||
Internal | {| class="wikitable" | ||
! Parameter !! Description !! Default | |||
|- | |||
| '''Number of channels''' || Active wavelength channels (1–3) || 1 (880nm only) | |||
|- | |||
| '''Direct emission measurement mode''' || Enable µg units instead of ng (for emission monitoring) || false | |||
|- | |||
| '''Device name''' || Internal device name || "bcMeter" | |||
|- | |||
| '''Enable heating''' || Activate internal heater || false | |||
|} | |||
Internal system parameters like onboarding state, email service credentials, and team upload settings are also stored here but are managed automatically. | |||
=== CLI Debug Mode === | |||
< | Running <code>python main.py --debug</code> on the device sets debug mode: | ||
* '''API server is skipped entirely''' — uvicorn is not started; the process blocks on a stop event. | |||
* '''Measurement auto-starts immediately''' — bypasses the "never calibrated" guard. | |||
* '''Verbose ADC output streams to stdout.''' | |||
* Use <code>Ctrl-C</code> to stop. | |||
This is primarily intended for hardware-level ADC testing on-device without the web interface overhead. | |||
=== Development Build Detection === | |||
When the device is running a development build, the API returns <code>"env":"dev"</code> in the status response and a red banner appears at the top of the interface: | |||
<blockquote style="background:#dc3545;color:#fff;padding:8px 16px;border-radius:4px;">DEVELOPMENT BUILD — connected to dev backend</blockquote> | |||
=== Identify Device === | === Identify Device === | ||
| Line 121: | Line 145: | ||
* '''Pattern:''' Morse code at ~10 WPM (dot = 120 ms, dash = 360 ms) | * '''Pattern:''' Morse code at ~10 WPM (dot = 120 ms, dash = 360 ms) | ||
* '''LED reverts''' to its previous mode (idle, sampling, or error) after the pattern completes. | * '''LED reverts''' to its previous mode (idle, sampling, or error) after the pattern completes. | ||
=== Onboarding Skip Mechanism === | |||
The welcome/onboarding screen can be bypassed: | |||
* '''Skip for now:''' Hides for 2 days (stored in localStorage + cookie). | |||
* '''Don't show again:''' Permanently disables onboarding by writing <code>onboarding_done: true</code> to device config. | |||
Latest revision as of 20:25, 31 March 2026
Developer Mode
The bcMeter interface includes a hidden developer mode for advanced hardware tuning and diagnostics. Changes in developer mode affect hardware directly — only modify settings if you understand their impact.
Activating Developer Mode
- Open Settings (gear icon).
- Click on the device name text (next to "Configuration") 7 times within 3 seconds.
- The name will change to show
[DEV]in yellow. - A new Developer tab appears in the settings panel.
Developer mode persists until the page is reloaded.
Developer Settings
The Developer tab exposes low-level configuration organized into sections:
Calibration (dev:calibration)
| Parameter | Description | Default |
|---|---|---|
| Sample spot diameter | Diameter of the filter area exposed to sample air (cm). Critical for absorption calculation. | 0.4 cm |
| Filter scattering factor | Correction factor for filter material light scattering | 1.39 |
| Device correction factor | Device-specific correction factor for BC calculation | 1.0 |
Optical (dev:optical)
| Parameter | Description | Default |
|---|---|---|
| 880nm IR LED brightness | Duty cycle for the 880nm IR LED (0–255) | 100 (auto-set during calibration) |
| 520nm Green LED brightness | Duty cycle for the 520nm green LED (0–255) | 255 (auto-set) |
| 370nm UV LED brightness | Duty cycle for the 370nm UV LED (0–255) | 255 (auto-set) |
| Calibration factor 880nm | K factor (Ref/Sen ratio) from last calibration | 1.0 (auto-set) |
| Calibration factor 520nm | K factor for 520nm channel | 1.0 (auto-set) |
| Calibration factor 370nm | K factor for 370nm channel | 1.0 (auto-set) |
| Min ADC voltage before error | Minimum acceptable ADC voltage (V) before triggering ERR_ADC_LOW | 0.5 |
Pump (dev:pump)
| Parameter | Description | Default |
|---|---|---|
| Pump power | Base pump PWM duty cycle (0–255) | 20 |
| Minimum pump duty cycle | Minimum duty to maintain airflow | 35 |
| Maximum pump duty cycle | Maximum pump speed limit | 255 |
| Minimum airflow (ml/min) | Stall detection threshold | 70 |
| PWM frequency | Pump control frequency (Hz) | 40 |
| 12V pump duty cycle | Duty cycle for 12V pump | 20 |
| Reverse pump duty cycle | Reverse the duty cycle logic | false |
| Enable 12V power output | Activate 12V auxiliary power rail | false |
| Log pump duty cycle per sample | Include pump duty in CSV output | false |
Auto Flow Control (dev:afc)
| Parameter | Description | Default |
|---|---|---|
| AFC: BC below this = max flow | BC threshold (ng/m³) below which maximum airflow is used | 300 |
| AFC: BC above this = min flow | BC threshold (ng/m³) above which minimum airflow is used | 2000 |
| AFC: min airflow | Minimum airflow when AFC is active (LPM) | 0.05 |
| AFC: max airflow | Maximum airflow when AFC is active (LPM) | 0.7 |
| AFC: flow boost per 100ng/min descent | Slope gain for rapid BC decrease | 0.05 |
Hardware (dev:hardware)
| Parameter | Description | Default |
|---|---|---|
| Enable WiFi | WiFi connectivity available | true |
| 4G/IOT connectivity | 4G/LTE modem available | false |
| Swap data channels | Swap sensor/reference ADC channels | false |
| Reference voltage for SPI ADC | ADC reference voltage (V) | 4.096 |
| Device has display | Enable SSD1306 display support | false |
System (dev:system)
| Parameter | Description | Default |
|---|---|---|
| Number of channels | Active wavelength channels (1–3) | 1 (880nm only) |
| Direct emission measurement mode | Enable µg units instead of ng (for emission monitoring) | false |
| Device name | Internal device name | "bcMeter" |
| Enable heating | Activate internal heater | false |
Internal system parameters like onboarding state, email service credentials, and team upload settings are also stored here but are managed automatically.
CLI Debug Mode
Running python main.py --debug on the device sets debug mode:
- API server is skipped entirely — uvicorn is not started; the process blocks on a stop event.
- Measurement auto-starts immediately — bypasses the "never calibrated" guard.
- Verbose ADC output streams to stdout.
- Use
Ctrl-Cto stop.
This is primarily intended for hardware-level ADC testing on-device without the web interface overhead.
Development Build Detection
When the device is running a development build, the API returns "env":"dev" in the status response and a red banner appears at the top of the interface:
DEVELOPMENT BUILD — connected to dev backend
Identify Device
The Developer tab includes an Identify Device button that blinks the status LED in a distinctive Morse code pattern (spelling "bcmeter") for 30 seconds. This helps visually locate a specific device when multiple units are deployed in the same area.
- API call:
/api/control?action=identify - Duration: 30 seconds
- Pattern: Morse code at ~10 WPM (dot = 120 ms, dash = 360 ms)
- LED reverts to its previous mode (idle, sampling, or error) after the pattern completes.
Onboarding Skip Mechanism
The welcome/onboarding screen can be bypassed:
- Skip for now: Hides for 2 days (stored in localStorage + cookie).
- Don't show again: Permanently disables onboarding by writing
onboarding_done: trueto device config.