feat(app): Integrate application versioning
This commit introduces application versioning, exposing version information through the Modbus server and logging it at startup. - Add to provide version information - Update to log the application version at startup - Update to expose firmware version via Modbus - Add file association for in
This commit is contained in:
parent
45d011952f
commit
537d76ef5d
|
|
@ -8,5 +8,6 @@
|
|||
|
||||
// File Associations
|
||||
"files.associations": {
|
||||
"app_version.h": "c"
|
||||
}
|
||||
}
|
||||
|
|
@ -4,12 +4,13 @@
|
|||
#include <lib/modbus_server.h>
|
||||
#include <lib/valve.h>
|
||||
#include <lib/fwu.h>
|
||||
#include <app_version.h>
|
||||
|
||||
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LOG_INF("Starting Irrigation System Slave Node");
|
||||
LOG_INF("Starting Irrigation System Slave Node version %s (Build version %s)", APP_VERSION_STRING, STRINGIFY(APP_BUILD_VERSION));
|
||||
|
||||
if (settings_subsys_init() || settings_load()) {
|
||||
LOG_ERR("Settings initialization or loading failed");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <lib/modbus_server.h>
|
||||
#include <lib/valve.h>
|
||||
#include <lib/fwu.h>
|
||||
#include <app_version.h>
|
||||
|
||||
#include <zephyr/usb/usb_device.h>
|
||||
|
||||
|
|
@ -135,10 +136,10 @@ static int input_reg_rd(uint16_t addr, uint16_t *reg)
|
|||
*reg = fwu_get_last_chunk_crc();
|
||||
break;
|
||||
case REG_INPUT_FIRMWARE_VERSION_MAJOR_MINOR:
|
||||
*reg = (0 << 8) | 0;
|
||||
*reg = (APP_VERSION_MAJOR << 8) | APP_VERSION_MINOR;
|
||||
break;
|
||||
case REG_INPUT_FIRMWARE_VERSION_PATCH:
|
||||
*reg = 2;
|
||||
*reg = APP_PATCHLEVEL;
|
||||
break;
|
||||
default:
|
||||
*reg = 0;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ void valve_init(void)
|
|||
|
||||
LOG_INF("Valve initialized: max_open=%us, max_close=%us", max_opening_time_s, max_closing_time_s);
|
||||
}
|
||||
}
|
||||
|
||||
void valve_open(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue