From 51ab0414f45a53c823927abf9bb70598bc52991a Mon Sep 17 00:00:00 2001 From: Moreno Gasperini Date: Fri, 25 Oct 2024 19:00:47 +0200 Subject: [PATCH] Master Minor FIX and default set param for default init flash --- .../libraries/RmapCommon/stima_config.h | 7 +---- platformio/stima_v4/master/include/config.h | 5 +--- .../master/include/constantdata_config.h | 2 -- .../stima_v4/master/include/tasks/lcd_task.h | 4 +-- .../stima_v4/master/src/tasks/lcd_task.cpp | 2 +- .../master/src/tasks/supervisor_task.cpp | 28 ++++++++----------- 6 files changed, 16 insertions(+), 32 deletions(-) diff --git a/platformio/stima_v4/libraries/RmapCommon/stima_config.h b/platformio/stima_v4/libraries/RmapCommon/stima_config.h index 4bf2a4c5b..fbe1467ee 100644 --- a/platformio/stima_v4/libraries/RmapCommon/stima_config.h +++ b/platformio/stima_v4/libraries/RmapCommon/stima_config.h @@ -293,13 +293,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define STIMA_LCD_DECIMALS_ONE 1 #define STIMA_LCD_DECIMALS_TWO 2 -// AVAILABLE LEVEL -#define DATA_LEVEL_SAMPLE ("sample") -#define DATA_LEVEL_REPORT ("report") -#define DATA_LEVEL_MAINT ("maint") -#define DATA_LEVEL_RPC ("rpc") - // AVAILABLE NETWORK +#define NETWORK_AGRMET ("agrmet") #define NETWORK_FIXED ("fixed") #define NETWORK_MOBILE ("mobile") diff --git a/platformio/stima_v4/master/include/config.h b/platformio/stima_v4/master/include/config.h index 96ecb75f6..0d926f48c 100644 --- a/platformio/stima_v4/master/include/config.h +++ b/platformio/stima_v4/master/include/config.h @@ -347,14 +347,11 @@ /// @brief Default board slug. #define NAME_BSLUG_BOARD_PREFIX ("stimacan") -/// @brief Default data level. -#define CONFIGURATION_DEFAULT_DATA_LEVEL (DATA_LEVEL_REPORT) - /// @brief Default ident. #define CONFIGURATION_DEFAULT_IDENT ("") /// @brief Default network. -#define CONFIGURATION_DEFAULT_NETWORK (NETWORK_FIXED) +#define CONFIGURATION_DEFAULT_NETWORK (NETWORK_AGRMET) /// @brief Default latitude. #define CONFIGURATION_DEFAULT_LATITUDE (4412345) diff --git a/platformio/stima_v4/master/include/constantdata_config.h b/platformio/stima_v4/master/include/constantdata_config.h index 6567ca6f1..69985ef2d 100644 --- a/platformio/stima_v4/master/include/constantdata_config.h +++ b/platformio/stima_v4/master/include/constantdata_config.h @@ -30,8 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /// @brief Maximum lenght of value plus terminator for one constant data. #define CONSTANTDATA_VALUE_LENGTH (33) -/// @brief Data level length -#define DATA_LEVEL_LENGTH (20) /// @brief Network length #define NETWORK_LENGTH (20) /// @brief Ident length diff --git a/platformio/stima_v4/master/include/tasks/lcd_task.h b/platformio/stima_v4/master/include/tasks/lcd_task.h index 14fa0e346..6a968d233 100644 --- a/platformio/stima_v4/master/include/tasks/lcd_task.h +++ b/platformio/stima_v4/master/include/tasks/lcd_task.h @@ -86,8 +86,8 @@ #define TEMPERATURE_SCALE (100.0) #define TEMPERATURE_OFFSET (27315.0) #define RAIN_GAUGE_SCALE (10.0) -#define WIND_SPEED_SCALE (100.0) -#define CURRENT_CHARGE_SCALE (10.0) +#define WIND_SPEED_SCALE (10.0) +#define INPUT_VOLTAGE_SCALE (10.0) #define SOIL_MOISTURE_SCALE (10.0) #define LCD_TASK_PRINT_DELAY_MS (5000) diff --git a/platformio/stima_v4/master/src/tasks/lcd_task.cpp b/platformio/stima_v4/master/src/tasks/lcd_task.cpp index 2afa82c01..88c2fccb1 100644 --- a/platformio/stima_v4/master/src/tasks/lcd_task.cpp +++ b/platformio/stima_v4/master/src/tasks/lcd_task.cpp @@ -518,7 +518,7 @@ void LCDTask::display_print_channel_interface(uint8_t module_type) { printMeasB = true; printMeasC = true; value_display_A = (float)param.system_status->data_slave[channel].data_value[0]; - value_display_B = (float)param.system_status->data_slave[channel].data_value[1] / CURRENT_CHARGE_SCALE; + value_display_B = (float)param.system_status->data_slave[channel].data_value[1] / INPUT_VOLTAGE_SCALE; value_display_C = (float)param.system_status->data_slave[channel].data_value[2]; if ((value_display_A < MIN_VALID_POWER_CHG) || (value_display_A > MAX_VALID_POWER_CHG)) bMeasValid_A = false; if ((value_display_B < MIN_VALID_POWER_V) || (value_display_B > MAX_VALID_POWER_V)) bMeasValid_B = false; diff --git a/platformio/stima_v4/master/src/tasks/supervisor_task.cpp b/platformio/stima_v4/master/src/tasks/supervisor_task.cpp index 6f85d8d6d..ff6f99055 100644 --- a/platformio/stima_v4/master/src/tasks/supervisor_task.cpp +++ b/platformio/stima_v4/master/src/tasks/supervisor_task.cpp @@ -187,9 +187,8 @@ void SupervisorTask::Run() #if (FIXED_CONFIGURATION) strSafeCopy(param.configuration->gsm_apn, GSM_APN_WIND, GSM_APN_LENGTH); strSafeCopy(param.configuration->gsm_number, GSM_NUMBER_WIND, GSM_NUMBER_LENGTH); - strSafeCopy(param.configuration->mqtt_root_topic, CONFIGURATION_DEFAULT_MQTT_ROOT_TOPIC, MQTT_ROOT_TOPIC_LENGTH); // Acquisition from module - param.configuration->report_s = 900; + param.configuration->report_s = 180; param.configuration->observation_s = 60; param.system_status->flags.config_empty = false; #endif @@ -990,7 +989,6 @@ bool SupervisorTask::saveConfiguration(bool is_default) param.configuration->report_s = CONFIGURATION_DEFAULT_REPORT_S; strSafeCopy(param.configuration->ident, CONFIGURATION_DEFAULT_IDENT, IDENT_LENGTH); - strSafeCopy(param.configuration->network, CONFIGURATION_DEFAULT_DATA_LEVEL, DATA_LEVEL_LENGTH); strSafeCopy(param.configuration->network, CONFIGURATION_DEFAULT_NETWORK, NETWORK_LENGTH); param.configuration->latitude = CONFIGURATION_DEFAULT_LATITUDE; @@ -1041,16 +1039,14 @@ bool SupervisorTask::saveConfiguration(bool is_default) param.configuration->board_master.serial_number = StimaV4GetSerialNumber(); #if ((USE_MQTT)&&(FIXED_CONFIGURATION)) - uint8_t temp_psk_key[] = {0x1A, 0xF1, 0x9D, 0xC0, 0x05, 0xFF, 0xCE, 0x92, 0x77, 0xB4, 0xCF, 0xC6, 0x96, 0x41, 0x04, 0x25}; - osMemcpy(param.configuration->client_psk_key, temp_psk_key, CLIENT_PSK_KEY_LENGTH); - - strSafeCopy(param.configuration->mqtt_username, "userv4", MQTT_USERNAME_LENGTH); - strSafeCopy(param.configuration->stationslug, "verifica", STATIONSLUG_LENGTH); - - param.configuration->latitude = 4512345; - param.configuration->longitude = 1212345; - - strSafeCopy(param.configuration->board_master.boardslug, "stimav4", BOARDSLUG_LENGTH); + uint8_t temp_psk_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + memcpy(param.configuration->client_psk_key, temp_psk_key, CLIENT_PSK_KEY_LENGTH); + param.configuration->latitude = 4444444; + param.configuration->longitude = 1111111; + strSafeCopy(param.configuration->mqtt_username, "username", MQTT_USERNAME_LENGTH); + strSafeCopy(param.configuration->mqtt_password, "password", MQTT_PASSWORD_LENGTH); + strSafeCopy(param.configuration->stationslug, "stationslug", STATIONSLUG_LENGTH); + strSafeCopy(param.configuration->board_master.boardslug, "masterv4", BOARDSLUG_LENGTH); strSafeCopy(param.configuration->board_slave[0].boardslug, "stimacan1", BOARDSLUG_LENGTH); strSafeCopy(param.configuration->board_slave[1].boardslug, "stimacan2", BOARDSLUG_LENGTH); strSafeCopy(param.configuration->board_slave[2].boardslug, "stimacan3", BOARDSLUG_LENGTH); @@ -1059,10 +1055,8 @@ bool SupervisorTask::saveConfiguration(bool is_default) strSafeCopy(param.configuration->board_slave[5].boardslug, "stimacan6", BOARDSLUG_LENGTH); strSafeCopy(param.configuration->board_slave[6].boardslug, "stimacan7", BOARDSLUG_LENGTH); strSafeCopy(param.configuration->board_slave[7].boardslug, "stimacan8", BOARDSLUG_LENGTH); - - strSafeCopy(param.configuration->gsm_apn, GSM_APN_FASTWEB, GSM_APN_LENGTH); - strSafeCopy(param.configuration->gsm_number, GSM_NUMBER_FASTWEB, GSM_NUMBER_LENGTH); - + strSafeCopy(param.configuration->gsm_apn, GSM_APN_TIM, GSM_APN_LENGTH); + strSafeCopy(param.configuration->gsm_number, GSM_NUMBER_TIM, GSM_NUMBER_LENGTH); #endif }