Skip to content

Commit

Permalink
Master
Browse files Browse the repository at this point in the history
Minor FIX and default set param for default init flash
  • Loading branch information
digitecomg committed Oct 25, 2024
1 parent f9ca6ca commit 51ab041
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 32 deletions.
7 changes: 1 addition & 6 deletions platformio/stima_v4/libraries/RmapCommon/stima_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
5 changes: 1 addition & 4 deletions platformio/stima_v4/master/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions platformio/stima_v4/master/include/constantdata_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions platformio/stima_v4/master/include/tasks/lcd_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion platformio/stima_v4/master/src/tasks/lcd_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 11 additions & 17 deletions platformio/stima_v4/master/src/tasks/supervisor_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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
}

Expand Down

0 comments on commit 51ab041

Please sign in to comment.