Skip to content

Commit

Permalink
Merge pull request #125 from ezloteam/pre_release_3.5.8
Browse files Browse the repository at this point in the history
Pre release 3.5.8
  • Loading branch information
lomasSE89 authored May 8, 2024
2 parents 072533d + 5ffcc22 commit 69aafd4
Show file tree
Hide file tree
Showing 23 changed files with 244 additions and 123 deletions.
33 changes: 20 additions & 13 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@

## New:
1. Implementation of 6-function-APIs (for less, for at-least, repeat, follow, pulse, latch): [EZPI-351](https://jira.mios.com/browse/EZPI-351)
2. Implementation of heap-memory guard when 'scene_create' triggered: [EZPI-358](https://jira.mios.com/browse/EZPI-358)
3. Implementation of 'toggle-value' method; [testing remained] [EZPI-349](https://jira.mios.com/browse/EZPI-349)
4. Implementation fake Token based security on local API [EZPI-341](https://jira.mios.com/browse/EZPI-341)
5. Implementation of WiFi Change API [EZPI-302](https://jira.mios.com/browse/EZPI-302)
6. Implementation of Battery status on Firmware Core [EZPI-332](https://jira.mios.com/browse/EZPI-332)
7. Implementation of Status indicator based on LED and BLE for EzloPi [EZPI-344](https://jira.mios.com/browse/EZPI-344)
8. Implementation of UART (serial) configuration from serial and BLE [EZPI-347](https://jira.mios.com/browse/EZPI-347)
2. Implement EzloPi Device Statuses API [EZPI-254](https://jira.mios.com/browse/EZPI-254)
3. Change Serial Config, Update NVS and Reboot EzloPi Device if only new config [EZPI-365](https://jira.mios.com/browse/EZPI-365)
4. Implement hub.device.armed.set API [EZPI-379](https://jira.mios.com/browse/EZPI-379)
5. EzloPi Distro Design and implementation [EZPI-385](https://jira.mios.com/browse/EZPI-385)
6. EzloPi - Framework for house-modes [EZPI-280](https://jira.mios.com/browse/EZPI-280)
7. 'hub.modes.current.get' api integration [EZPI-292](https://jira.mios.com/browse/EZPI-292)
8. Implementation of then-method 'toggle-value' [EZPI-349](https://jira.mios.com/browse/EZPI-349)
9. Implementation of isHouseMode_changed_from_method [EZPI-366](https://jira.mios.com/browse/EZPI-366)
10. Implementation of switchHouseMode_then_method [EZPI-366](https://jira.mios.com/browse/EZPI-366)
11. Implementation of isHouseModeAlarmPhaseRange [EZPI-367](https://jira.mios.com/browse/EZPI-367)
12. Implementation of isHouseModeSwitchToRange [EZPI-373](https://jira.mios.com/browse/EZPI-373)

## Fixes:
1. Fix device tree free-issue when initialization: [EZPI-333](https://jira.mios.com/browse/EZPI-333)
2. Fix 'NOT' scene method parsing failure: [EZPI-363](https://jira.mios.com/browse/EZPI-363)
3. Fix 'Scene_State' enable/disable not update in NVS: [EZPI-364](https://jira.mios.com/browse/EZPI-364)
4. mDNS Service type modification: [EZPI-356](https://jira.mios.com/browse/EZPI-356)
5. Replacenemt of dynamic buffer to static buffer for minimizing heap fragmentation [EZPI-352](https://jira.mios.com/browse/EZPI-352)
6. WiFi SSID and PSW to be matched len with factory info [EZPI-316](https://jira.mios.com/browse/EZPI-316)
1. Memory leak fixing causing device to go offline [EZPI-369](https://jira.mios.com/browse/EZPI-369)
2. Add Filter on serial info such that if not provisioned send data 0 [EZPI-353](https://jira.mios.com/browse/EZPI-353)
3. Implement cloud API controlled logs for cloud and serial on EzloPi [EZPI-370](https://jira.mios.com/browse/EZPI-370)
4. Cleanup distro merge [EZPI-378](https://jira.mios.com/browse/EZPI-378)
5. Fix Flash overflow with converting LOG macros into a function based implementaion [EZPI-384](https://jira.mios.com/browse/EZPI-384)
6. Connect to SNTP if only WiFi connected and reduce delay time [EZPI-386](https://jira.mios.com/browse/EZPI-386)
7. Meshbots Branch "review" refactoring [EZPI-261](https://jira.mios.com/browse/EZPI-261)
8. Test and fixing on 'house-modes' [EZPI-301](https://jira.mios.com/browse/EZPI-301)
9. When several scenes (more than 6) are created, the next created scenes stop coming from the controller [EZPI-250](https://jira.mios.com/browse/EZPI-250)
2 changes: 2 additions & 0 deletions ezlopi-core/ezlopi-core-ezlopi/ezlopi_core_ezlopi.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ void ezlopi_init(void)
ezlopi_event_queue_init();

#if (defined(CONFIG_EZPI_ENABLE_WIFI) || defined(CONFIG_EZPI_CORE_ENABLE_ETH))
#ifdef CONFIG_EZPI_ENABLE_PING
ezlopi_ping_init();
#endif // CONFIG_EZPI_ENABLE_PING
EZPI_CORE_sntp_init();
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ extern "C"
\"dev_name\": \"temp_humi\",\
\"id_room\": \"\",\
\"id_item\": 16,\
\"gpio\": 18\
\"gpio\": 33\
},\
{\
\"dev_type\": 1,\
\"dev_name\": \"for_test\",\
\"id_room\": \"\",\
\"id_item\": 2,\
\"gpio_in\": 0,\
\"gpio_out\": 32,\
\"gpio_out\": 26,\
\"pullup_ip\": false,\
\"pullup_op\": false,\
\"is_ip\": false,\
Expand Down
71 changes: 34 additions & 37 deletions ezlopi-core/ezlopi-core-log/ezlopi_core_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@

#include "ezlopi_core_log.h"

const char* cloud_log_severity_enum[ENUM_EZLOPI_CLOUD_LOG_SEVERITY_MAX] = {
"ERROR",
"WARNING",
"INFO",
"DEBUG",
"TRACE"
};

const char* serial_log_severity_enum[ENUM_EZLOPI_SERIAL_LOG_SEVERITY_MAX] = {
const char* ezlopi_log_severity_enum[ENUM_EZLOPI_LOG_SEVERITY_MAX] = {
"NONE"
"ERROR",
"WARNING",
Expand All @@ -36,17 +28,18 @@ const char* serial_log_severity_enum[ENUM_EZLOPI_SERIAL_LOG_SEVERITY_MAX] = {
"TRACE"
};

static e_ezlopi_cloud_log_severity_t cloud_log_severity = ENUM_EZLOPI_CLOUD_LOG_SEVERITY_INFO;
static e_ezlopi_serial_log_severity_t serial_log_severity = ENUM_EZLOPI_SERIAL_LOG_SEVERITY_TRACE;

static e_ezlopi_log_severity_t cloud_log_severity = ENUM_EZLOPI_LOG_SEVERITY_INFO;
static e_ezlopi_log_severity_t serial_log_severity = ENUM_EZLOPI_LOG_SEVERITY_TRACE;

static int ezlopi_hub_cloud_log_set_severity(const char* severity_str)
{
int ret = 0;
if (severity_str)
{
for (int i = 0; i < ENUM_EZLOPI_CLOUD_LOG_SEVERITY_MAX; i++)
for (int i = 0; i < ENUM_EZLOPI_LOG_SEVERITY_MAX; i++)
{
if (0 == strncmp(cloud_log_severity_enum[i], severity_str, strlen(cloud_log_severity_enum[i])))
if (0 == strncmp(ezlopi_log_severity_enum[i], severity_str, strlen(ezlopi_log_severity_enum[i])))
{
cloud_log_severity = i;
ret = 1;
Expand All @@ -62,9 +55,9 @@ static int ezlopi_hub_serial_log_set_severity(const char* severity_str)
int ret = 0;
if (severity_str)
{
for (int i = 0; i < ENUM_EZLOPI_SERIAL_LOG_SEVERITY_MAX; i++)
for (int i = 0; i < ENUM_EZLOPI_LOG_SEVERITY_MAX; i++)
{
if (0 == strncmp(serial_log_severity_enum[i], severity_str, strlen(serial_log_severity_enum[i])))
if (0 == strncmp(ezlopi_log_severity_enum[i], severity_str, strlen(ezlopi_log_severity_enum[i])))
{
serial_log_severity = i;
ret = 1;
Expand All @@ -91,7 +84,7 @@ int ezlopi_core_cloud_log_severity_process(bool severity_enable, const char* sev
}
else
{
cloud_log_severity = ENUM_EZLOPI_CLOUD_LOG_SEVERITY_MAX;
cloud_log_severity = ENUM_EZLOPI_LOG_SEVERITY_NONE;
ret = 1;
}
EZPI_CORE_nvs_write_cloud_log_severity(cloud_log_severity);
Expand All @@ -108,7 +101,7 @@ int ezlopi_core_serial_log_severity_process(const char* severity_str)
}
else
{
serial_log_severity = ENUM_EZLOPI_SERIAL_LOG_SEVERITY_TRACE;
serial_log_severity = ENUM_EZLOPI_LOG_SEVERITY_NONE;
ret = 1;
}
EZPI_CORE_nvs_write_serial_log_severity(serial_log_severity);
Expand All @@ -117,37 +110,41 @@ int ezlopi_core_serial_log_severity_process(const char* severity_str)

const char* ezlopi_core_cloud_log_get_current_severity_enum_str()
{
return cloud_log_severity_enum[cloud_log_severity];
return ezlopi_log_severity_enum[cloud_log_severity];
}

const char* ezlopi_core_serial_log_get_current_severity_enum_str()
{
return serial_log_severity_enum[serial_log_severity];
return ezlopi_log_severity_enum[serial_log_severity];
}

e_ezlopi_cloud_log_severity_t ezlopi_core_cloud_log_get_current_severity_enum_val()
e_ezlopi_log_severity_t ezlopi_core_cloud_log_get_current_severity_enum_val()
{
return cloud_log_severity;
}

e_ezlopi_serial_log_severity_t ezlopi_core_serial_log_get_current_severity_enum_val()
e_ezlopi_log_severity_t ezlopi_core_serial_log_get_current_severity_enum_val()
{
return serial_log_severity;
}

int ezlopi_core_send_cloud_log(int severity, const char* format, ...)
int ezlopi_core_send_cloud_log(int severity, const char* log_str)
{
int ret = 0;
if (severity <= ENUM_EZLOPI_CLOUD_LOG_SEVERITY_WARNING)
if (severity == ENUM_EZLOPI_LOG_SEVERITY_NONE)
{
ret = 1;
}
else if (severity <= ENUM_EZLOPI_LOG_SEVERITY_WARNING)
{
e_ezlopi_event_t event = ezlopi_get_event_bit_status();
if ((event & EZLOPI_EVENT_NMA_REG) == EZLOPI_EVENT_NMA_REG)
{
char formatted_log[500];
va_list arglist;
va_start(arglist, format);
int bytes_written = vsnprintf(formatted_log, 4096, format, arglist);
va_end(arglist);
// char formatted_log[500];
// va_list arglist;
// va_start(arglist, format);
// int bytes_written = vsnprintf(formatted_log, 4096, format, arglist);
// va_end(arglist);

cJSON* cj_log_broadcast = cJSON_CreateObject(__FUNCTION__);
if (cj_log_broadcast)
Expand All @@ -158,18 +155,17 @@ int ezlopi_core_send_cloud_log(int severity, const char* format, ...)
if (cj_result)
{
uint64_t timestamp = EZPI_CORE_sntp_get_current_time_ms();
size_t total_len = 15 + bytes_written + 2;
size_t total_len = 15 + strlen(log_str) + 2;
char message[total_len];
memset(message, 0, total_len);
snprintf(message, total_len, "%lld: %s", timestamp, formatted_log);
snprintf(message, total_len, "%lld: %s", timestamp, log_str);

cJSON_AddStringToObject(__FUNCTION__, cj_result, ezlopi_message_str, message);

char severity_str[10];
memset(severity_str, 0, 10);
snprintf(severity_str, 10, "%s", cloud_log_severity_enum[severity]);
cJSON_AddStringToObject(__FUNCTION__, cj_result, ezlopi_severity_str, severity_str);

ezlopi_core_broadcast_log_cjson(cj_log_broadcast);

ret = 1;
Expand All @@ -180,15 +176,16 @@ int ezlopi_core_send_cloud_log(int severity, const char* format, ...)
return ret;
}

static int ezlopi_core_serial_log_upcall(int severity, const char* format, ...)
static int ezlopi_core_serial_log_upcall(int severity, const char* log_str)
{
int ret = 0;
if (severity > ENUM_EZLOPI_SERIAL_LOG_SEVERITY_NONE && severity <= serial_log_severity)
if (severity > ENUM_EZLOPI_LOG_SEVERITY_NONE && severity <= serial_log_severity)
{
va_list arglist;
va_start(arglist, format);
vprintf(format, arglist);
va_end(arglist);
// va_list arglist;
// va_start(arglist, format);
// vprintf(format, arglist);
printf("%s", log_str);
// va_end(arglist);
ret = 1;
}
return ret;
Expand Down
29 changes: 11 additions & 18 deletions ezlopi-core/ezlopi-core-log/ezlopi_core_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,27 @@
#include <stdbool.h>

typedef enum {
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_ERROR = 0,
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_WARNING,
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_INFO,
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_DEBUG,
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_TRACE,
ENUM_EZLOPI_CLOUD_LOG_SEVERITY_MAX,
}e_ezlopi_cloud_log_severity_t;
ENUM_EZLOPI_LOG_SEVERITY_NONE = 0,
ENUM_EZLOPI_LOG_SEVERITY_ERROR,
ENUM_EZLOPI_LOG_SEVERITY_WARNING,
ENUM_EZLOPI_LOG_SEVERITY_INFO,
ENUM_EZLOPI_LOG_SEVERITY_DEBUG,
ENUM_EZLOPI_LOG_SEVERITY_TRACE,
ENUM_EZLOPI_LOG_SEVERITY_MAX,
}e_ezlopi_log_severity_t;

typedef enum {
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_NONE = 0,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_ERROR,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_WARNING,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_INFO,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_DEBUG,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_TRACE,
ENUM_EZLOPI_SERIAL_LOG_SEVERITY_MAX,
}e_ezlopi_serial_log_severity_t;

void ezlopi_core_read_set_log_severities();
int ezlopi_core_cloud_log_severity_process(bool severity_enable, const char* severity_str);
const char* ezlopi_core_cloud_log_get_current_severity_enum_str();
e_ezlopi_cloud_log_severity_t ezlopi_core_cloud_log_get_current_severity_enum_val();
int ezlopi_core_send_cloud_log(int severity, const char* format, ...);
// int ezlopi_core_send_cloud_log(int severity, const char* format, ...);
int ezlopi_core_send_cloud_log(int severity, const char* log_str);
void ezlopi_core_set_log_upcalls();

int ezlopi_core_serial_log_severity_process(const char* severity_str);
const char* ezlopi_core_serial_log_get_current_severity_enum_str();
e_ezlopi_serial_log_severity_t ezlopi_core_serial_log_get_current_severity_enum_val();
e_ezlopi_log_severity_t ezlopi_core_serial_log_get_current_severity_enum_val();

#endif // CONFIG_EZPI_UTIL_TRACE_EN

Expand Down
5 changes: 5 additions & 0 deletions ezlopi-core/ezlopi-core-net/ezlopi_core_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ s_ezlopi_net_status_t* ezlopi_get_net_status(void)
{

net_stat.wifi_status = ezlopi_wifi_status();
#ifdef CONFIG_EZPI_ENABLE_PING
net_stat.internet_status = ezlopi_ping_get_internet_status();
#else // CONFIG_EZPI_ENABLE_PING
net_stat.internet_status = EZLOPI_PING_STATUS_UNKNOWN;
#endif // CONFIG_EZPI_ENABLE_PING

net_stat.nma_cloud_connection_status = ezlopi_websocket_client_is_connected();

return &net_stat;
Expand Down
11 changes: 8 additions & 3 deletions ezlopi-core/ezlopi-core-ping/ezlopi_core_ping.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "../../build/config/sdkconfig.h"
#ifdef CONFIG_EZPI_ENABLE_PING

#include <string.h>

#include "freertos/FreeRTOS.h"
Expand Down Expand Up @@ -92,8 +95,8 @@ static void ezlopi_ping_on_ping_success(esp_ping_handle_t hdl, void* args)
esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr));
esp_ping_get_profile(hdl, ESP_PING_PROF_SIZE, &recv_len, sizeof(recv_len));
esp_ping_get_profile(hdl, ESP_PING_PROF_TIMEGAP, &elapsed_time, sizeof(elapsed_time));
TRACE_I("%d bytes from %s icmp_seq=%d ttl=%d time=%d ms\n",
recv_len, inet_ntoa(target_addr.u_addr.ip4), seqno, ttl, elapsed_time);
// TRACE_I("%d bytes from %s icmp_seq=%d ttl=%d time=%d ms\n",
// recv_len, inet_ntoa(target_addr.u_addr.ip4), seqno, ttl, elapsed_time);
__ping_fail_count = 0;
__ping_status = EZLOPI_PING_STATUS_LIVE;
}
Expand Down Expand Up @@ -125,7 +128,7 @@ static void ezlopi_ping_on_ping_end(esp_ping_handle_t hdl, void* args)
esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr));
esp_ping_get_profile(hdl, ESP_PING_PROF_DURATION, &total_time_ms, sizeof(total_time_ms));

#if (1 == ENABLE_TRACE)
#if (1 == ENABLE_TRACE)
uint32_t loss = (uint32_t)((1 - ((float)received) / transmitted) * 100);

if (IP_IS_V4(&target_addr))
Expand All @@ -147,3 +150,5 @@ static void ezlopi_ping_on_ping_end(esp_ping_handle_t hdl, void* args)

// esp_ping_delete_session(hdl);
}

#endif // CONFIG_EZPI_ENABLE_PING
7 changes: 7 additions & 0 deletions ezlopi-core/ezlopi-core-ping/ezlopi_core_ping.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#ifndef _EZLOPI_CORE_PING_H_
#define _EZLOPI_CORE_PING_H_



typedef enum e_ping_status
{
EZLOPI_PING_STATUS_UNKNOWN = 0,
EZLOPI_PING_STATUS_LIVE,
EZLOPI_PING_STATUS_DISCONNECTED,
} e_ping_status_t;

#include "../../build/config/sdkconfig.h"
#ifdef CONFIG_EZPI_ENABLE_PING

void ezlopi_ping_init(void);
e_ping_status_t ezlopi_ping_get_internet_status(void);

#endif // CONFIG_EZPI_ENABLE_PING

#endif // _EZLOPI_CORE_PING_H_
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ int ezlopi_scene_when_is_sun_state(l_scenes_list_v2_t* scene_node, void* arg)
{
if (0 < ezlopi_event_group_wait_for_event(EZLOPI_EVENT_NMA_REG, 100, false))
{
TRACE_W("module not online");
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions ezlopi-core/ezlopi-core-sntp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(EZLOPI_CORE_COMPONENTS
micro_tz_db
ezlopi-util-trace
ezlopi-core-nvs
ezlopi-core-wifi
)
set(EZLOPI_HAL_COMPONENTS

Expand Down
Loading

0 comments on commit 69aafd4

Please sign in to comment.