Commit Graph

126 Commits

Author SHA1 Message Date
32256d0c91 move all mqtt publishing functions to mqtt module 2026-05-24 18:32:10 +02:00
d4a4c1b573 refctor: TankInfo structure (consistent layout)
- fix: use tagged enum serialization for TankError
- fix: rename TankInfo fields for consistent naming (volume_ml, pct, water_temp_c)
- renamed some fields for better clarity on contained value
2026-05-24 17:51:17 +02:00
6bf7a04024 refactor: PlantInfo structure (consistent layout)
- fix: use tagged enum serialization for MoistureSensorError and PumpError
- fix: flatten PlantInfo sensors to SensorTelemetry with top-level moisture_pct
2026-05-24 17:50:38 +02:00
df3159aa16 refactor: BatteryInfo structure (consistent layout)
- use tagged enum serialization for BatteryError
- flatten BatteryInfo telemetry with consistent field names and typed error
2026-05-24 14:49:35 +02:00
7866604a40 fix: serialize firmware/state as JSON instead of Debug format 2026-05-24 14:06:39 +02:00
d2a659638d refactor: create util module with shared mk_static
- use crate::util::mk_static in network module
- use crate::util::mk_static in mqtt module
- use crate::util::mk_static in hal module
- remove dead mk_static macro from esp module
2026-05-17 12:39:41 +02:00
40f99870cf refactor: move try_connect_wifi_sntp_mqtt to network module 2026-05-17 12:30:43 +02:00
ac200af7a9 refactor: move wifi to network module 2026-05-17 12:29:57 +02:00
9d57805502 refactor: move wifi_ap to network module 2026-05-17 12:27:54 +02:00
bafc86681c refactor: move sntp to network module 2026-05-17 12:24:39 +02:00
5f9db41d65 refactor: move run_dhcp to network module 2026-05-17 12:22:07 +02:00
ba654a904b refactor: move net_task to network module 2026-05-17 12:21:32 +02:00
cd4d0cc683 refactor: create network module
- move NetworkMode and SntpMode enums
2026-05-17 12:19:22 +02:00
2cfb2607a9 refactor: move Solar struct to mqtt module 2026-05-10 02:38:50 +02:00
271c1a1383 refactor: move PumpInfo struct to mqtt module 2026-05-10 02:38:43 +02:00
a02b84d732 refactor: create mqtt module with core MQTT statics and tasks 2026-05-10 02:34:16 +02:00
b0f8bcc9da Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	Software/MainBoard/rust/src/hal/water.rs
2026-05-06 09:29:25 +02:00
103859120c Add initial TODO file with pending tasks for One Wire, Flow Sensor, and PlantProfiles implementation 2026-05-06 09:27:19 +02:00
403517fdb4 Suppress EMI noise on water flow sensor by filtering short pulses 2026-05-06 09:26:14 +02:00
11eb8713bf more startup debugging 2026-05-05 18:04:00 +02:00
d903c2bf52 Refactor flow meter logic: replace global mutex with per-instance flow_unit and use critical-section for thread safety. 2026-05-05 16:27:21 +02:00
f8f76674ce Refactor flow meter handling: switch get_flow_meter_value to get_full_flow_count, update related structs and logic to use u32 for flow values. 2026-05-05 01:14:54 +02:00
3cc5a0d2bd dependency lock upgrade 2026-05-05 00:50:18 +02:00
3be585ecbf Refactor flow meter handling with interrupt-based logic and global state
- Added `flow_interrupt_handler` for efficient interrupt processing.
- Replaced per-instance `flow_counter` with global atomic and mutex-based state (`FLOW_OVERFLOW_COUNTER`, `FLOW_UNIT`).
- Updated flow meter functions to leverage the new architecture for better modularity and thread safety.
- Switched debugging output from `println!` to `log` for improved logging consistency.
2026-05-05 00:50:18 +02:00
5b1a945ac3 Replace blocking http_server call with async task using spawner 2026-05-05 00:50:18 +02:00
f4e050d413 Add ChecksumError handling to FatError conversion 2026-05-05 00:50:18 +02:00
Kai Börnert
ef0ec47d92 Improve CAN bus robustness: adjust NART, add transmission delays for error recovery. 2026-05-04 17:44:54 +02:00
0ed9d6bb57 Adjust timeouts and constants for improved moisture sensor and backup management accuracy
- Increased CAN measurement timeout to 5000ms for reliability.
- Updated `SAVEGAME_SLOT_SIZE` usage in backup handling for consistency.
- Refined moisture sensor frequency thresholds for better sensor calibration (400Hz-70kHz).
2026-05-03 21:03:13 +02:00
eef165b6de Track overcurrent issues during pump operation
- Added `overcurrent_ma` field to pump results for capturing overcurrent data.
- Enhanced pumping logic to record and propagate overcurrent issues per plant.
- Updated `PumpState` and `PlantState` to handle overcurrent errors.
2026-05-02 01:38:30 +02:00
1ace878488 Refactor extra1 to fertilizer_pump in HAL and main logic
- Renamed `extra1` method and related calls to `fertilizer_pump` for clarity and better domain alignment.
- Updated HAL implementation to control `extra2` GPIO for fertilizer pump operations.
- Added build script trigger to refresh `VERGEN_BUILD_TIMESTAMP` on each build.
2026-05-01 13:11:47 +02:00
a30d59605d Improve CAN bus error handling and logging
- Enhanced error detection with detailed status logging for bus-off, error warning, and passive errors.
- Added line breaks to CAN and RX error logs for better readability.
- Refined CAN transmission logic and error feedback, including buffer overflow handling.
- Simplified firmware timestamp frame creation and ensured successful sending.
2026-05-01 13:11:37 +02:00
2ee3615dcd switch fertilizer to extra 1 2026-05-01 10:45:54 +02:00
db0f7daa4c feat: add fertilizer cooldown functionality with web UI, HAL integration, and configuration support 2026-04-30 22:09:04 +02:00
6809a37d9d feat: add fertilizer pump functionality with configuration, web UI, and HAL integration 2026-04-30 20:44:07 +02:00
0ca09ed498 feat: add fertilizer pump test functionality with web integration and HAL support 2026-04-30 20:37:07 +02:00
542ff578bc feat: add bus-off error handling in CAN error status register with error blinking loop 2026-04-30 20:27:38 +02:00
2e16163b0e feat: implement interleaved sensor measurement timing with slot-based coordination to prevent overlap 2026-04-30 20:19:13 +02:00
9280bbb244 refactor: rename deep_sleep to deep_sleep_ms for consistency across the codebase 2026-04-30 20:09:48 +02:00
Kai Börnert
e0b8acd55c Add firmware build timestamp support for sensors; update detection workflows and UI accordingly. 2026-04-27 16:46:24 +02:00
Kai Börnert
c04109a76c Rename /version endpoint to /firmware_info; add heap memory statistics to firmware data and UI. 2026-04-27 15:46:29 +02:00
Kai Börnert
f0c9ed4e7f Add live log buffering support and endpoint; enhance log display functionality. 2026-04-27 15:04:05 +02:00
Kai Börnert
3fa8077b81 Update button labels to clarify sensor identification actions in plant.html 2026-04-27 13:56:32 +02:00
Kai Börnert
7f0714914f Add averaging over multiple windows for frequency measurement; optimize task yielding for USB stability. 2026-04-27 13:42:30 +02:00
61806a5fa2 Add mcutie MQTT client implementation and improve library structure
- Integrated `mcutie` library as a core MQTT client for device communication.
- Added support for Home Assistant entities (binary sensor, button) via MQTT.
- Implemented buffer management, async operations, and packet encoding/decoding.
- Introduced structured error handling and device registration features.
- Updated `Cargo.toml` with new dependencies and enabled feature flags for `serde` and `log`.
- Enhanced logging macros with configurable options (`defmt` or `log`).
- Organized codebase into modules (buffer, components, IO, publish, etc.) for better maintainability.
2026-04-27 09:39:29 +02:00
016047ab23 Update Water HAL: enhance GPIO config with drive mode and input settings
- Added `DriveMode` configuration and input enablement for `one_wire_pin`.
- Improved GPIO initialization with `InputConfig` and default pull settings.
2026-04-26 21:24:51 +02:00
eb276cfa68 Refactor HAL modules: update async support in Water module and reorganize detect_sensors logic
- Replaced `Blocking` with `Async` for ADC operations in `Water` module.
- Improved `detect_sensors` implementation with better structure for sensor messages and autodetection.
- Updated tank ADC sampling to yield between readings, improving efficiency.
2026-04-26 21:01:27 +02:00
f1c85d1d74 Migrate serialization from Bincode to Postcard
- Replaced Bincode with Postcard for serialization/deserialization across configs and save operations.
- Simplified struct derives by removing `bincode`-specific traits.
- Updated `Cargo.toml` and `Cargo.lock` to include `postcard` and dependencies.
- Added padding stripping for deserialization and improved error handling.
- Adjusted serialization logic in `savegame_manager.rs` and related modules.
2026-04-26 20:46:52 +02:00
097aff5360 Switch savegame serialization format from Bincode to custom parsing
- Replaced Bincode-based serialization/deserialization with a custom save format for better control.
- Introduced save header with magic bytes, timestamp handling, and UTF-8 validation.
- Enhanced error handling for save parsing and increased format flexibility.
- Removed
2026-04-26 20:31:56 +02:00
fc0e18da56 Integrate mcutie library for MQTT functionality
- Added `mcutie` as a dependency in `Cargo.toml` and updated `Cargo.lock`.
- Replaced commented-out MQTT logic with fully implemented functionality in `esp.rs`.
- Enhanced MQTT publish and subscription handling with configurable topics and error handling.
- Updated MQTT connection logic to improve reliability and logging.
2026-04-26 19:56:16 +02:00
cc92c82ac9 Fix incorrect spawn function call and update dependencies
- Corrected usage of `spawner.spawn` by fixing misplaced error propagation.
- Updated `Cargo.lock` with new and upgraded dependencies, including `base64`, `darling`, and `smoltcp` upgrades.
2026-04-26 19:46:46 +02:00