Skip to content

Commit

Permalink
v4.3.5
Browse files Browse the repository at this point in the history
Set RTC offset on powerup
  • Loading branch information
srdjastankovic authored Mar 28, 2018
2 parents d3f1d88 + 1234f83 commit 743ee0e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
4 changes: 4 additions & 0 deletions RELEASE NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
WolkSensor is a device with built-in temperature, pressure, humidity and movement sensor.
List of Firmware Release Versions for WolkSensor device in WolkSensor.bin file:

**Version 4.3.5**
- [BUGFIX] If offset values read from EEPROM higher than limits reset it to zero
- [IMPROVEMENT] Set new date&time for ca.crt on device init

**Version 4.3.4**
- [BUGFIX] "nan" for OFFSET_FACTORY's while read from eeprom changed with 0,0,0 as default offset factory values
- [NEW] New decimal numbers scale is 1. Example T:20.1
Expand Down
13 changes: 13 additions & 0 deletions wolksensor/SDK/core/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,14 @@ bool load_offset_status(void)
{
if (global_dependencies.config_read(&atmo_offset, CFG_OFFSET, 1, sizeof(atmo_offset)))
{
if((atmo_offset[0] > TEMPERATURE_OFFSET_MAX) || (atmo_offset[0] < TEMPERATURE_OFFSET_MIN))
atmo_offset[0] = 0;
if((atmo_offset[1] > PRESSURE_OFFSET_MAX) || (atmo_offset[1] < PRESSURE_OFFSET_MIN))
atmo_offset[1] = 0;
if((atmo_offset[2] > HUMIDITY_OFFSET_MAX) || (atmo_offset[2] < HUMIDITY_OFFSET_MIN))
atmo_offset[2] = 0;
LOG_PRINT(1, PSTR("Temperature offset is written: %.1f \n\rPressure offset is written: %.1f \n\rHumidity offset is written: %.1f \n\r"), atmo_offset[0], atmo_offset[1], atmo_offset[2]);

return true;
}

Expand All @@ -332,6 +339,12 @@ bool load_offset_factory_status(void)

return false;
}
if((atmo_offset_factory[0] > TEMPERATURE_OFFSET_MAX) || (atmo_offset_factory[0] < TEMPERATURE_OFFSET_MIN))
atmo_offset_factory[0] = 0;
if((atmo_offset_factory[1] > PRESSURE_OFFSET_MAX) || (atmo_offset_factory[1] < PRESSURE_OFFSET_MIN))
atmo_offset_factory[1] = 0;
if((atmo_offset_factory[2] > HUMIDITY_OFFSET_MAX) || (atmo_offset_factory[2] < HUMIDITY_OFFSET_MIN))
atmo_offset_factory[2] = 0;

return true;
}
Expand Down
1 change: 1 addition & 0 deletions wolksensor/wolksensor/WolkSensor/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ int main(void)
sei(); // allows interrupts, cli() disables them

RTC_init(start_type == POWER_ON);
chrono_init(start_type == POWER_ON);

uart_init();

Expand Down
4 changes: 2 additions & 2 deletions wolksensor/wolksensor/WolkSensor/platform_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define FW_VERSION_MAJOR 4 // number 0 -99
#define FW_VERSION_MINOR 3 // number 0 -99
#define FW_VERSION_PATCH 4 // number 0 -99
#define FW_VERSION_PATCH 5 // number 0 -99

#define SYNCHRONIZED_BLOCK_START register8_t saved_sreg = SREG; cli();
#define SYNCHRONIZED_BLOCK_END SREG = saved_sreg;
Expand All @@ -29,7 +29,7 @@

#define MAX_BUFFER_SIZE 768

#define NUMBER_OF_ACTUATORS 0
#define NUMBER_OF_ACTUATORS 0

#define NUMBER_OF_SENSORS 4

Expand Down
23 changes: 17 additions & 6 deletions wolksensor/wolksensor/src/OS/CC3100/wifi_cc3100.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ static uint8_t get_surroundig_networks(wifi_network_t* networks, uint8_t network

static _i32 SetTime(void)
{
LOG(1, "Updating certification Time");

_i32 retVal = -1;
SlDateTime_t dateTime= {0};

Expand All @@ -380,8 +382,9 @@ static _i32 SetTime(void)
dateTime.sl_tm_min = times->tm_min;
dateTime.sl_tm_sec = times->tm_sec;

retVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
sizeof(SlDateTime_t),(_u8 *)(&dateTime));
LOG_PRINT(1, PSTR("Date and Time D/M/Y - H:M:S : %lu/%lu/%lu - %lu:%lu:%lu \n\r"), dateTime.sl_tm_day, dateTime.sl_tm_mon, dateTime.sl_tm_year, dateTime.sl_tm_hour, dateTime.sl_tm_min, dateTime.sl_tm_sec);

retVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t),(_u8 *)(&dateTime));
ASSERT_ON_ERROR(retVal);

return SUCCESS;
Expand Down Expand Up @@ -569,9 +572,19 @@ bool init_wifi(void)
return false;
}

SetTime();
if(SetTime() < 0)
{
LOG(1, "Unable to Set Time");

return false;
}

update_ca_cert();
if(update_ca_cert() < 0)
{
LOG(1, "Unable to update ca certificate");

return false;
}

if(sl_Stop(1000) < 0)
{
Expand Down Expand Up @@ -915,8 +928,6 @@ int wifi_open_socket(char* address, uint16_t port, bool secure)
socket_address_in.sin_port = sl_Htons((uint16_t)server_port);

socket_address_in.sin_addr.s_addr = sl_Htonl((uint32_t)ip_address);

SetTime();//Solution

uint8_t retries = 0;
int16_t connect_result = -1;
Expand Down

0 comments on commit 743ee0e

Please sign in to comment.