#include "cmd_version.h" #include "app_config.h" #include "uart_cmd.h" #ifndef POWERPOD_FW_VERSION #define POWERPOD_FW_VERSION 1u #endif #ifndef POWERPOD_GIT_HASH #define POWERPOD_GIT_HASH "unknown" #endif static const char *TAG = "[VERSION]"; static void handle_version(const uint8_t *data, size_t len) { (void)data; (void)len; alox_UartMessage response; uart_cmd_init_response(&response, alox_MessageType_VERSION, alox_UartMessage_version_response_tag); response.payload.version_response.version = POWERPOD_FW_VERSION; response.payload.version_response.git_hash.funcs.encode = uart_cmd_encode_string; response.payload.version_response.git_hash.arg = (void *)POWERPOD_GIT_HASH; const app_config_t *cfg = app_config_get(); if (cfg != NULL && cfg->running_partition[0] != '\0') { response.payload.version_response.running_partition.funcs.encode = uart_cmd_encode_string; response.payload.version_response.running_partition.arg = (void *)cfg->running_partition; } uart_cmd_send(&response, TAG); } void cmd_version_register(void) { uart_cmd_register(alox_MessageType_VERSION, handle_version); }