diff --git a/pico-sensor/README.md b/pico-sensor/README.md index c1d4195..c6c2c86 100644 --- a/pico-sensor/README.md +++ b/pico-sensor/README.md @@ -1,75 +1,92 @@ # TSM_PicoW_Sensor -This project uses the PicoW board to publish sensor values (humidity and temperature) to an MQTT broker. + +This project utilizes the Raspberry Pi Pico W board to measure data (humidity and temperature) and publish these values to an MQTT broker. + +## Project Overview + +The TSM_PicoW_Sensor firmware collects sensor data and publishes it to an MQTT broker over Wi-Fi. The configuration is flexible and can be updated at runtime using a serial terminal. The project supports automated testing, including remote execution via a J-Link tunnel. + +--- + +## CI/CD + +> **Note:** The automated test job in the CI pipeline is currently commented out because a Pico W board is not always available. To enable automated testing, uncomment the test job in the CI configuration and ensure a J-Link tunnel is set up as described below. + +--- ## Target Configuration -Use a serial terminal (baud rate: 115200) to configure the board by sending commands. The application stores the parameters in flash memory. You must restart the device to apply any changes. +The device parameters (Wi-Fi credentials, MQTT broker, topics, etc.) are stored in flash memory and can be configured via a serial terminal (baud rate: **115200**). After updating any parameter, restart the device to apply changes. -### Wi-Fi +### Wi-Fi Setup + +Set the Wi-Fi SSID and password using the following commands: ```shell McuMinINI write settings.ini WiFi ssid "YOUR_SSID" McuMinINI write settings.ini WiFi pass "YOUR_PASSWORD" ``` -### MQTT +### MQTT Setup + +Configure the MQTT broker and authentication: -Broker information: ```shell McuMinINI write settings.ini MQTT broker "BROKER_NAME" McuMinINI write settings.ini MQTT user "USERNAME" McuMinINI write settings.ini MQTT pass "PASSWORD" ``` -Topic names: +Set the MQTT topic names: + ```shell McuMinINI write settings.ini MQTT topic_sensor_update "///update" McuMinINI write settings.ini MQTT topic_send_measurement "///cmd/measure" ``` -## Build -Project has `Debug`, `Release` and `Test` targets, using CMake Presets. +--- + +## Build Instructions + +The project uses CMake presets for different build configurations: **Debug**, **Release**, and **Test**. + +### Configure the Project + +Here are the avalaible cmake presets: -**Configure:** ```shell -cmake --list-presets -cmake --preset Debug -cmake --preset Release -cmake --preset Test +cmake --preset Debug +cmake --preset Release +cmake --preset Test ``` -**Build:** +### Build the Project + +Here are the build options: + ```shell -cmake --build --list-presets cmake --build --preset app-debug cmake --build --preset app-release cmake --build --preset app-test ``` -**Test:** -```shell -ctest --list-presets -ctest --test-dir build/Test -R Led_1 -``` +## Running Tests -**Workflow:** -```shell -cmake --workflow --list-presets -``` +The project supports running tests both locally and remotely. Remote testing is useful for CI pipelines or when the hardware is not directly connected to your development machine. -## Running Tests on Another Machine +### Remote Test Execution -To run tests on a target connected to another machine (e.g., in a GitLab CI pipeline), follow these steps: +To execute tests on a target connected to another machine (e.g., in a CI/CD environment): -### On the Host Machine +#### 1. On the Host Machine (with the Pico W board) -Set up a J-Link tunnel to make the target accessible from anywhere: +Start a J-Link Remote Server with tunneling enabled: ```shell JLinkRemoteServerCL -UseTunnel -TunnelBySN ``` -The terminal output should look like this: +Sample output: ``` 2025-06-04 08:43:57 - Remote Server started @@ -80,10 +97,14 @@ The terminal output should look like this: 2025-06-04 08:43:57 - Waiting for client connection ``` -`801000372` is the tunnel ID required to reach the target. Include it in your CMake command: +The serial number (e.g., `801000372`) is your **tunnel ID**. + +#### 2. On the Development/CI Machine + +Configure CMake to use the tunnel ID: ```shell cmake --preset Test -DTUNNEL_ID=801000372 ``` -When you run the tests, they will automatically execute on the host machine. \ No newline at end of file +When you run the tests, they will be executed on the remote host machine where the Pico W board is connected. \ No newline at end of file