Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev v3 scene merge #43

Merged
merged 34 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7fd1ac2
added expressions components
KrrishnaShah Dec 7, 2023
6c9cc98
working on hub.scenes.block.data.list: incomplete
KrrishnaShah Dec 11, 2023
3752389
adding action-methods into 'hub.scenes.block.data.list'}
KrrishnaShah Dec 12, 2023
bea5e0a
added set-expression action method in hub.scene.block.data.list
KrrishnaShah Dec 12, 2023
0d6b048
added cj_action_methods in scenes
krishna-ezlo Dec 12, 2023
9099dd8
working on hub.scenes.block.data.list
KrrishnaShah Dec 12, 2023
c439752
test
ezlo-rikenm Dec 13, 2023
0859264
Merge branch 'feature_expression_riken' into feature_expression
ezlo-rikenm Dec 13, 2023
8fdcdea
renamed name conflicts 'add_data_src_dest_array_to_object'
ezlo-rikenm Dec 13, 2023
f68c820
optimized devices, and fixed device freeing
KrrishnaShah Dec 14, 2023
5cf3143
completing 'hub.scenes.block.list'
KrrishnaShah Dec 18, 2023
8bd9589
adding block list
KrrishnaShah Dec 18, 2023
5353c3a
working on expression-list
KrrishnaShah Dec 20, 2023
0639926
refactored expressions-list
KrrishnaShah Dec 21, 2023
0ca87e2
added delete, fixed list, and set
KrrishnaShah Dec 21, 2023
e9e158c
segregating string constants
KrrishnaShah Dec 25, 2023
4ac3749
segregating string constants
KrrishnaShah Dec 25, 2023
8784676
adding 'hub.scene.added'
KrrishnaShah Dec 27, 2023
364e274
created updater-methods document, added hub.scene.deleted, hub.scene.…
KrrishnaShah Dec 28, 2023
53f753c
fixing bugs in ble modules
KrrishnaShah Dec 29, 2023
78116a2
completed adding 'hub.scenes.notification.add/remove'
KrrishnaShah Dec 31, 2023
1835b52
adding 'hub.scenes.block.list'
KrrishnaShah Jan 1, 2024
a675a69
added scene.run, hub.scenes.blocks.list, hub.scenes.notificatios.add/…
KrrishnaShah Jan 5, 2024
b7f550b
room complete except 'room.reorder'
KrrishnaShah Jan 8, 2024
9a0e420
adding 'hub.room.order.set'
KrrishnaShah Jan 9, 2024
da9127c
adding device-name-set
KrrishnaShah Jan 10, 2024
2c32a34
issues with adding device-id in ezlopi-config, need to be fixed
KrrishnaShah Jan 11, 2024
293a66a
segregating populate functions from scenes (File has become too long)…
KrrishnaShah Jan 12, 2024
12e78fe
fixed room & device logicx
KrrishnaShah Jan 15, 2024
d4ee601
fix: https://jira.mios.com/browse/EZPI-252
lomasSE89 Jan 16, 2024
7c6104d
merged feature_scenes_expression #42.
lomasSE89 Jan 16, 2024
2b13116
cleaned unwanted files.
lomasSE89 Jan 16, 2024
b5eac16
merged #42
lomasSE89 Jan 16, 2024
75291f8
Merge pull request #42 from ezloteam/feature_scenes_expression
lomasSE89 Jan 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions burn_id.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
baud_rate=921600
controller="esp32s3"
# controller="esp32"

# usb_port="/dev/ttyACM0"
usb_port="/dev/ttyUSB0"
fimrware_loc="firmware/id"

id_bin="100002119.bin"
# id_bin="100005802.bin"


esptool.py -p $usb_port -b $baud_rate --before default_reset --after hard_reset --chip $controller write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x3b0000 $fimrware_loc/$id_bin
2 changes: 1 addition & 1 deletion components/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C"
{
#endif

#define ENABLE_TRACE 0
#define ENABLE_TRACE 1

void __dump(const char *file_name, uint32_t line, char *buffer_name, void *_buff, uint32_t ofs, uint32_t cnt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
#include "trace.h"

#include "items.h"
#include "gpio_isr_service.h"

#include "ezlopi_gpio.h"
#include "ezlopi_cloud.h"
#include "ezlopi_timer.h"
#include "ezlopi_actions.h"
#include "ezlopi_devices_list.h"
#include "ezlopi_cjson_macros.h"
#include "ezlopi_valueformatter.h"
#include "ezlopi_cloud_constants.h"
#include "ezlopi_device_value_updated.h"

#include "gpio_isr_service.h"
#include "ezlopi_nvs.h"
#include "ezlopi_gpio.h"
#include "ezlopi_cloud.h"
#include "ezlopi_devices_list.h"
#include "ezlopi_device_value_updated.h"
#include "ezlopi_cloud_constants.h"
#include "ezlopi_valueformatter.h"
#include "ezlopi_nvs.h"
#include "ezlopi_cloud_constants.h"
#include "ezlopi_device_value_updated.h"

#include "gpio_isr_service.h"
#include "device_0001_digitalOut_generic.h"

// #define DEV_TEST_SETTINGS_EN
Expand All @@ -34,9 +34,9 @@ static int __init(l_ezlopi_item_t *item);
static int __set_value(l_ezlopi_item_t *item, void *arg);
static int __get_value_cjson(l_ezlopi_item_t *item, void *arg);

static void __interrupt_upcall(void *arg);
static void __toggle_gpio(l_ezlopi_item_t *item);
static void __write_gpio_value(l_ezlopi_item_t *item);
static void __interrupt_upcall(l_ezlopi_item_t *item);
static void __set_gpio_value(l_ezlopi_item_t *item, int value);

#ifdef DEV_TEST_SETTINGS_EN
Expand Down Expand Up @@ -142,16 +142,16 @@ static int __settings_get(void *arg, l_ezlopi_device_settings_v3_t *setting)
cJSON_AddStringToObject(description, "text", "User defined operation mode, where user can set several distance parameters for setting a custom operation mode");
cJSON_AddStringToObject(description, "lang_tag", "ezlopi_presence_user_defined_mode_description");

cJSON_AddItemToObject(cjson_propertise, "label", label);
cJSON_AddItemToObject(cjson_propertise, ezlopi_label_str, label);
cJSON_AddItemToObject(cjson_propertise, "description", description);
cJSON_AddStringToObject(cjson_propertise, "valueType", "presence_operation_mode");
cJSON_AddStringToObject(cjson_propertise, ezlopi_valueType_str, "presence_operation_mode");

cJSON_AddNumberToObject(value, "min_move_distance", 0.75);
cJSON_AddNumberToObject(value, "max_move_distance", 1.5);
cJSON_AddNumberToObject(value, "min_still_distance", 0.75);
cJSON_AddNumberToObject(value, "max_still_distance", 1.5);
cJSON_AddTrueToObject(value, "is_active");
cJSON_AddItemToObject(cjson_propertise, "value", value);
cJSON_AddItemToObject(cjson_propertise, ezlopi_value_str, value);

cJSON_AddNumberToObject(value_default, "min_move_distance", 0.75);
cJSON_AddNumberToObject(value_default, "max_move_distance", 6.0);
Expand All @@ -171,13 +171,13 @@ static int __settings_get(void *arg, l_ezlopi_device_settings_v3_t *setting)
cJSON_AddStringToObject(description, "text", "This is PWM setting value for setting the backlight brightness");
cJSON_AddStringToObject(description, "lang_tag", "ezlopi_digitalio_pwm_setting_description");

cJSON_AddItemToObject(cjson_propertise, "label", label);
cJSON_AddItemToObject(cjson_propertise, ezlopi_label_str, label);
cJSON_AddItemToObject(cjson_propertise, "description", description);
cJSON_AddStringToObject(cjson_propertise, "valueType", "int");
cJSON_AddStringToObject(cjson_propertise, ezlopi_valueType_str, "int");

s_digio_settings_t *settings_data = (s_digio_settings_t *)setting->user_arg;

cJSON_AddNumberToObject(cjson_propertise, "value", settings_data->settings_int_data);
cJSON_AddNumberToObject(cjson_propertise, ezlopi_value_str, settings_data->settings_int_data);
cJSON_AddNumberToObject(cjson_propertise, "valueMin", 0);
cJSON_AddNumberToObject(cjson_propertise, "valueMax", 100);
cJSON_AddNumberToObject(cjson_propertise, "valueDefault", 50);
Expand All @@ -200,7 +200,7 @@ static int __settings_set(void *arg, l_ezlopi_device_settings_v3_t *setting)
else if (setting->cloud_properties.setting_id == settings_ids[1])
{
int32_t value = 0;
CJSON_GET_VALUE_INT(cjson_propertise, "value", value);
CJSON_GET_VALUE_INT(cjson_propertise, ezlopi_value_str, value);
TRACE_D("Setting Value : %d", value);

s_digio_settings_t *settings_data = (s_digio_settings_t *)setting->user_arg;
Expand Down Expand Up @@ -247,7 +247,7 @@ static int __settings_update(void *arg, l_ezlopi_device_settings_v3_t *setting)
else if (setting->cloud_properties.setting_id == settings_ids[1])
{
s_digio_settings_t *settings_data = (s_digio_settings_t *)setting->user_arg;
cJSON_AddNumberToObject(cjson_propertise, "value", settings_data->settings_int_data);
cJSON_AddNumberToObject(cjson_propertise, ezlopi_value_str, settings_data->settings_int_data);
}
}
return ret;
Expand All @@ -257,16 +257,18 @@ static int __settings_update(void *arg, l_ezlopi_device_settings_v3_t *setting)

static void __setup_device_cloud_properties(l_ezlopi_device_t *device, cJSON *cjson_device)
{
char *device_name = NULL;
CJSON_GET_VALUE_STRING(cjson_device, "dev_name", device_name);
// uint32_t device_id = 0;
// char *device_name = NULL;
// CJSON_GET_VALUE_STRING(cjson_device, ezlopi_dev_name_str, device_name);
// CJSON_GET_ID(device_id, cJSON_GetObjectItem(cjson_device, ezlopi__id_str));
// device->cloud_properties.device_id = ezlopi_cloud_generate_device_id();
// ASSIGN_DEVICE_NAME_V2(device, device_name);

ASSIGN_DEVICE_NAME_V2(device, device_name);
device->cloud_properties.category = category_switch;
device->cloud_properties.subcategory = subcategory_in_wall;
device->cloud_properties.device_type = dev_type_switch_inwall;
device->cloud_properties.info = NULL;
device->cloud_properties.device_type_id = NULL;
device->cloud_properties.device_id = ezlopi_cloud_generate_device_id();
}

static void __setup_item_properties(l_ezlopi_item_t *item, cJSON *cjson_device)
Expand All @@ -280,21 +282,21 @@ static void __setup_item_properties(l_ezlopi_item_t *item, cJSON *cjson_device)
item->cloud_properties.scale = NULL;
item->cloud_properties.item_id = ezlopi_cloud_generate_item_id();

CJSON_GET_VALUE_INT(cjson_device, "dev_type", item->interface_type);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_dev_type_str, item->interface_type);

CJSON_GET_VALUE_INT(cjson_device, "is_ip", item->interface.gpio.gpio_in.enable);
CJSON_GET_VALUE_INT(cjson_device, "gpio_in", item->interface.gpio.gpio_in.gpio_num);
CJSON_GET_VALUE_INT(cjson_device, "ip_inv", item->interface.gpio.gpio_in.invert);
CJSON_GET_VALUE_INT(cjson_device, "val_ip", item->interface.gpio.gpio_in.value);
CJSON_GET_VALUE_INT(cjson_device, "pullup_ip", tmp_var);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_is_ip_str, item->interface.gpio.gpio_in.enable);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_gpio_in_str, item->interface.gpio.gpio_in.gpio_num);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_ip_inv_str, item->interface.gpio.gpio_in.invert);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_val_ip_str, item->interface.gpio.gpio_in.value);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_pullup_ip_str, tmp_var);
item->interface.gpio.gpio_in.pull = tmp_var ? GPIO_PULLUP_ONLY : GPIO_PULLDOWN_ONLY;
item->interface.gpio.gpio_in.interrupt = GPIO_INTR_DISABLE;

item->interface.gpio.gpio_out.enable = true;
CJSON_GET_VALUE_INT(cjson_device, "gpio_out", item->interface.gpio.gpio_out.gpio_num);
CJSON_GET_VALUE_INT(cjson_device, "op_inv", item->interface.gpio.gpio_out.invert);
CJSON_GET_VALUE_INT(cjson_device, "val_op", item->interface.gpio.gpio_out.value);
CJSON_GET_VALUE_INT(cjson_device, "pullup_op", tmp_var);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_gpio_out_str, item->interface.gpio.gpio_out.gpio_num);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_op_inv_str, item->interface.gpio.gpio_out.invert);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_val_op_str, item->interface.gpio.gpio_out.value);
CJSON_GET_VALUE_INT(cjson_device, ezlopi_pullup_op_str, tmp_var);
item->interface.gpio.gpio_out.interrupt = GPIO_INTR_DISABLE;
item->interface.gpio.gpio_out.pull = tmp_var ? GPIO_PULLUP_ONLY : GPIO_PULLDOWN_ONLY;
}
Expand All @@ -314,7 +316,7 @@ static int __prepare(void *arg)
cJSON *cjson_device = prep_arg->cjson_device;
if (cjson_device)
{
l_ezlopi_device_t *device = ezlopi_device_add_device();
l_ezlopi_device_t *device = ezlopi_device_add_device(cjson_device);
if (device)
{
__setup_device_cloud_properties(device, cjson_device);
Expand Down Expand Up @@ -398,6 +400,7 @@ static int __init(l_ezlopi_item_t *item)
gpio_config(&io_conf);
// digital_io_write_gpio_value(item);
__write_gpio_value(item);
ret = 1;
}
}

Expand All @@ -423,7 +426,19 @@ static int __init(l_ezlopi_item_t *item)

gpio_config(&io_conf);
gpio_isr_service_register_v3(item, __interrupt_upcall, 1000);
ret = 1;
}

if (0 == ret)
{
ret = -1;
if (item->user_arg)
{
free(item->user_arg);
item->user_arg = NULL;
}
}

return ret;
}

Expand All @@ -433,8 +448,8 @@ static int __get_value_cjson(l_ezlopi_item_t *item, void *arg)
cJSON *cjson_propertise = (cJSON *)arg;
if (cjson_propertise)
{
cJSON_AddBoolToObject(cjson_propertise, "value", item->interface.gpio.gpio_out.value);
cJSON_AddStringToObject(cjson_propertise, "valueFormatted", ezlopi_valueformatter_bool(item->interface.gpio.gpio_out.value ? true : false));
cJSON_AddBoolToObject(cjson_propertise, ezlopi_value_str, item->interface.gpio.gpio_out.value);
cJSON_AddStringToObject(cjson_propertise, ezlopi_valueFormatted_str, ezlopi_valueformatter_bool(item->interface.gpio.gpio_out.value ? true : false));
ret = 1;
}

Expand All @@ -443,7 +458,6 @@ static int __get_value_cjson(l_ezlopi_item_t *item, void *arg)

static void __set_gpio_value(l_ezlopi_item_t *item, int value)
{
int temp_value = (0 == item->interface.gpio.gpio_out.invert) ? value : !(value);
gpio_set_level(item->interface.gpio.gpio_out.gpio_num, value);
item->interface.gpio.gpio_out.value = value;
}
Expand All @@ -455,15 +469,10 @@ static int __set_value(l_ezlopi_item_t *item, void *arg)

if (NULL != cjson_params)
{
char *cjson_params_str = cJSON_Print(cjson_params);
if (cjson_params)
{
TRACE_D("cjson_params: %s", cjson_params_str);
free(cjson_params_str);
}
CJSON_TRACE("cjson_params", cjson_params);

int value = 0;
cJSON *cj_value = cJSON_GetObjectItem(cjson_params, "value");
cJSON *cj_value = cJSON_GetObjectItem(cjson_params, ezlopi_value_str);
if (cj_value)
{
switch (cj_value->type)
Expand Down Expand Up @@ -531,10 +540,14 @@ static void __write_gpio_value(l_ezlopi_item_t *item)
gpio_set_level(item->interface.gpio.gpio_out.gpio_num, write_value);
}

static void __interrupt_upcall(l_ezlopi_item_t *item)
static void __interrupt_upcall(void *arg)
{
__toggle_gpio(item);
ezlopi_device_value_updated_from_device_v3(item);
l_ezlopi_item_t *item = (l_ezlopi_item_t *)arg;
if (item)
{
__toggle_gpio(item);
ezlopi_device_value_updated_from_device_v3(item);
}
}

static void __toggle_gpio(l_ezlopi_item_t *item)
Expand Down
Loading