Commit Graph

114 Commits

Author SHA1 Message Date
Eduard Iten b54c73edb1 fix: handle connection loss and re-establish in modbus_tool.py 2025-07-02 10:03:23 +02:00
Eduard Iten 2418d4e218 fix: resolve build error by moving modbus register enums to header 2025-07-02 10:02:40 +02:00
Eduard Iten 2b4890f052 fix: correct modbus_tool.py update for reset command 2025-07-02 09:58:19 +02:00
Eduard Iten 85d493f24a feat: implement modbus reset command and update docs/tool 2025-07-02 09:55:42 +02:00
Eduard Iten f486d4c4ab cleanup: remove unused CMakeLists.txt and empty modbus directory 2025-07-02 09:54:01 +02:00
Eduard Iten 6cfd4b8b4d refactor: restructure slave_node into libraries 2025-07-02 09:45:22 +02:00
Eduard Iten 0088030d66 docs: replace svg logo with png version 2025-07-02 09:22:37 +02:00
Eduard Iten 4d828b41f1 docs: Add project logo to all markdown files
Added the new project logo to the header of all relevant markdown documentation files to improve brand consistency and visual appeal.
2025-07-01 23:37:30 +02:00
Eduard Iten 95f435923f feat(main): Add detailed source code documentation
Add comprehensive Doxygen-style comments to all functions, enums, and macros in `main.c`. This improves code clarity and maintainability. The Doxygen configuration itself was removed after deciding against generating a separate HTML manual, but the in-code comments provide significant value on their own.
2025-07-01 23:29:26 +02:00
Eduard Iten 33f2a15cf3 docs(slave_node): Add Doxygen comments to main.c
- Add Doxygen-compliant comments to functions, enums, and state variables in `main.c`.
- This provides a foundation for automatically generating source code documentation.
- Remove the separate, now redundant, `firmware-manual.de.md` file.
2025-07-01 22:56:30 +02:00
Eduard Iten c4e87a3125 docs: Add firmware manual and update main README
- Create a new firmware manual (`firmware-manual.de.md`) to document the current features of the slave node.
- Add a linked table of contents to the new manual.
- Update the main `README.de.md` to link to the new firmware manual and the existing Modbus tool README.
2025-07-01 22:51:17 +02:00
Eduard Iten 773027f6b0 feat(slave_node): Implement Modbus watchdog timer
- Add a fail-safe watchdog using a Zephyr kernel timer.
- The timer is reset on any successful Modbus communication.
- If the timer expires (no communication within the configured timeout), the valve is automatically closed as a safety measure.
- The watchdog is enabled by writing a non-zero value to the `WATCHDOG_TIMEOUT_S` register and disabled by writing 0.
2025-07-01 22:46:57 +02:00
Eduard Iten 461cce7a48 fix(modbus_tool): Adjust UI layout for alignment
- Shorten "Device Status" label to "Dev. Status".
- Realign the rightmost column for better readability.
2025-07-01 22:38:52 +02:00
Eduard Iten 23b88ada83 feat(modbus_tool): Add interactive file browser for firmware updates
- Implement a simple, curses-based file browser to allow selecting firmware files from the filesystem.
- The selected file path is used for the firmware update process.
- Fix a visual bug where the progress bar would not reach 100% upon completion.
- Remove a leftover  function that was causing a NameError.
2025-07-01 22:15:44 +02:00
Eduard Iten c2916662e2 feat(modbus_tool): Implement simulated firmware update
- Add a new thread to handle the firmware update process, preventing the UI from freezing.
- The UI now displays a progress bar and status messages during the update.
- The tool reads a  file and sends it to the slave in chunks.
- Add a dummy  for testing purposes.
- Fix Modbus communication issues by reducing the chunk size to a safe value (248 bytes) and sending data in smaller bursts to improve stability.
- Update the README with the new features and instructions.
2025-07-01 21:55:19 +02:00
Eduard Iten 24087f5622 fix(slave_node): Increase Modbus buffer size
- Set CONFIG_MODBUS_BUFFER_SIZE to 256 to ensure the slave can handle larger data packets sent by the client during firmware updates.
2025-07-01 21:55:01 +02:00
Eduard Iten 95fd88e93e feat(modbus_tool): Adapt UI to full register map
- Update the TUI to display all new registers from the slave, including digital I/O and system status.
- Add new menu buttons to control digital outputs and set the watchdog timer.
- Add a placeholder button for the firmware update process.
- Fix various bugs, including incorrect argument passing in Modbus calls and a module import error.
2025-07-01 21:36:28 +02:00
Eduard Iten 21797d8507 feat(slave_node): Implement full Modbus register map
- Implement all remaining Modbus registers as defined in the documentation v1.0.
- Add support for digital I/O, system status, and a simulated watchdog.
- Implement a placeholder for the firmware update mechanism, including CRC calculation for received data chunks.
- Remove the input simulation timer; digital inputs are now static and ready for real hardware.
2025-07-01 21:36:10 +02:00
Eduard Iten 6dcb11ae0c fix(modbus_tool): Improve UI stability and readability
- Refactor the curses drawing loop to be state-based, eliminating screen flicker after user input.
- Add a helper function to format uptime from seconds into a human-readable string (d/h/m/s).
2025-07-01 21:17:30 +02:00
Eduard Iten 38d6dbe95a feat(modbus_tool): Add interactive TUI and documentation
- Replace the basic command-line prompt with a full-screen, interactive TUI using the  library.
- The new UI provides a real-time, tabular status display and intuitive, button-style menu navigation.
- Implement a consistent blue background theme for better aesthetics.
- Add a detailed  with installation and usage instructions.
- Fix several bugs in the Modbus communication logic.
2025-07-01 20:59:47 +02:00
Eduard Iten b100a8acf7 feat(shell): Add commands for valve timing
- Add shell commands 'valve set_open_time' and 'valve set_close_time' to configure the virtual valve.
- Extend the 'show_config' command to display the new timing values.
- The new settings are persisted to flash storage.
2025-07-01 18:24:20 +02:00
Eduard Iten 269e9e88a1 feat(valve): Implement safe virtual valve control
- Implement virtual valve logic with time-based movement simulation.
- The valve state is now set to 'OPEN' immediately when the opening process starts, ensuring a safe and correct state representation.
- The state is only set to 'CLOSED' after the closing process has finished.
- Add persistence for max opening and closing times.
2025-07-01 18:15:54 +02:00
Eduard Iten 8cab3eecc1 feat(settings): Implement persistent Modbus configuration
- Integrate the Zephyr Settings subsystem to persist Modbus parameters.
- Use NVS (Non-Volatile Storage) as the backend with a dedicated flash partition.
- Modbus baudrate and slave ID are now loaded at startup.
- Changes made via the shell are saved to flash and survive a reboot.
- Add a 'reset' command to the shell for easier testing.
- Fix all compiler and devicetree warnings for a clean build.
2025-07-01 16:44:32 +02:00
Eduard Iten 6a9e4773ea feat(shell): Add commands to configure Modbus
- Implement a new 'modbus' command in the shell.
- Add sub-commands 'set_baud', 'set_id', and 'show'.
- Add validation for baud rate and slave ID inputs.
- The new parameters are applied to the Modbus server at runtime, allowing for live reconfiguration of the communication settings.
- The shell backend is set to RTT.
2025-07-01 15:27:57 +02:00
Eduard Iten b836f9a2f4 feat(slave_node): Implement system registers
- Add read support for system-level input registers:
  - FIRMWARE_VERSION_MAJOR_MINOR (0xF0)
  - FIRMWARE_VERSION_PATCH (0xF1)
  - DEVICE_STATUS (0xF2)
- Use enums for register addresses to improve readability.
- Implement a workaround for a Kconfig issue by hardcoding the firmware version.
- Stabilize multi-register reads by returning 0 for unhandled input registers instead of an exception.
- NOTE: Writing to holding registers is currently unstable with mbpoll and will be addressed separately.
2025-07-01 14:56:56 +02:00
Eduard Iten 032ddf2cc0 feat(slave_node): Implement uptime registers
- Add a callback for reading Modbus input registers.
- Implement logic to provide the system uptime in seconds, split across two 16-bit registers (UPTIME_SECONDS_LOW at 0x00F3 and UPTIME_SECONDS_HIGH at 0x00F4) as per documentation.
- Return 0 for unhandled registers to prevent "Invalid data" errors with certain Modbus masters.
2025-07-01 14:38:10 +02:00
Eduard Iten 1067796df4 fix(slave_node): Stabilize Modbus RTU communication
The Modbus server was previously unstable, leading to intermittent CRC errors when polled by a master. This was caused by the main thread exiting after initialization, which created timing and race condition issues for the interrupt-driven Modbus stack.

This fix ensures the main thread continues to run in a low-power sleep loop (). This provides a stable context for the Modbus server, resolving the CRC errors and ensuring reliable communication.
2025-07-01 14:30:22 +02:00
Eduard Iten 6f81e84541 feat(slave_node): Implement initial Modbus RTU server
- Add a basic Modbus RTU server implementation based on Zephyr samples.
- Configure usart1 for Modbus via a board overlay.
- The server initializes and runs, but polling with mbpoll results in a timeout.
- This commit captures a functional but non-working state for further debugging.
2025-07-01 13:41:22 +02:00
Eduard Iten 0d3696bf93 feat(slave_node): Switch to RTT console output
- Reconfigure the project to use SEGGER RTT for console output instead of UART.
- Update the main loop with a new printk message for testing purposes.
2025-07-01 12:36:11 +02:00
Eduard Iten b005fd5c11 feat(slave_node): Enable UART console and printk
- Enable the console subsystem and printk for debugging output.
- Configure the console to use the UART peripheral (usart1 on PA9/PA10).
- Disable RTT to ensure UART is the active console.
2025-07-01 12:13:59 +02:00
Eduard Iten 6c15b7021f refactor(slave_node): Clean up initial configuration
- Remove redundant DTS_ROOT from CMakeLists.txt as it's inferred from BOARD_ROOT.
- Clear the project configuration (prj.conf) to start with a minimal baseline.
2025-07-01 12:09:36 +02:00
Eduard Iten 842b204d36 refactor(build): Streamline multi-app CMake configuration
Remove the top-level  and configure each application to directly include the  directory as a module or root. This simplifies the build process by making each application more self-contained while still allowing access to shared boards and libraries.
2025-07-01 12:05:18 +02:00
Eduard Iten 5ce96a662d feat: Establish functional multi-app structure
This commit captures a working multi-app build where the board definition is located in the 'software' directory and explicitly included by the slave_node application. This serves as a stable baseline.
2025-07-01 11:05:12 +02:00
Eduard Iten fbeaa916b9 feat(project): Restructure software for multi-app setup
- Reorganize the software directory to support multiple Zephyr applications (gateway, slave_node).

- Create a clear separation between applications and shared libraries.

- Add placeholder files for gateway and slave_node applications.
2025-07-01 08:20:25 +02:00
Eduard Iten 423e3947ab feat(docs): Mark task 1.1 as done
Set the task 'Set up development environment for STM32/Zephyr' to done in all planning files.
2025-06-30 18:46:04 +02:00
Eduard Iten 3fd816daca fix(i18n): Correctly translate SVG files 2025-06-30 18:37:53 +02:00
Eduard Iten 7597f5ddc0 feat(i18n): Add French and Spanish translations 2025-06-30 18:10:51 +02:00
Eduard Iten 5971fde145 feat(docs): Deactivate links to the current language 2025-06-30 18:02:02 +02:00
Eduard Iten f008dfb6f0 fix(docs): Correctly translate SVG architecture image 2025-06-30 17:58:31 +02:00
Eduard Iten f9d4a3b971 docs: Restructure and internationalize documentation 2025-06-30 17:49:22 +02:00
Eduard Iten 0fd6466d81 Added planning 2025-06-30 17:25:32 +02:00
Eduard Iten c23d1f08c0 Added modbus register definitions 2025-06-30 17:18:19 +02:00
Eduard Iten 1dc78c948a Moved architecture image and renamed it for german, to enable translation 2025-06-30 16:25:05 +02:00
Eduard Iten c952b9f897 Added archritecture picture 2025-06-30 16:23:24 +02:00
Eduard Iten 97637a8315 Added concept 2025-06-30 16:15:17 +02:00
Eduard Iten 1b066d343b Hardware updated 2025-06-30 13:52:33 +02:00
Eduard Iten d36f3b85b4 sync 2025-06-20 18:41:50 +02:00
Eduard Iten a4aeaa5f91 Fixed modbus init 2025-06-19 17:09:46 +02:00
Eduard Iten 0b5ad510fe merging 2025-06-19 17:04:34 +02:00
Eduard Iten e9fc370094 canbus, modbus working, valve has to be implemented in real 2025-06-19 16:56:21 +02:00