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

Strange behavior regarding the "flash reset" flag #40

Open
adamoferro opened this issue Apr 9, 2022 · 0 comments
Open

Strange behavior regarding the "flash reset" flag #40

adamoferro opened this issue Apr 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@adamoferro
Copy link
Collaborator

adamoferro commented Apr 9, 2022

Setting the "Reset Flash at every startup" flag seems to create inconsistencies in the use of the leaf INIT functions.
A dedicated branch has been created to reproduce the problem here:
https://github.com/ogghst/grownode/tree/test_parameter-store_and_gpio-3

@adamoferro adamoferro added the bug Something isn't working label Apr 9, 2022
adamoferro referenced this issue Apr 9, 2022
FIRST TRIAL
1) created a blink bloard WITHOUT "flash reset" flag. No network.
Standard blink board uses GPIO 2.
2) Compiled, flashed and run. First logs on my board:

I (533) grownode: grownode startup sequence completed!
D (543) gn_leaf_gpio: [blink] gn_gpio_config
D (543) grownode: gn_leaf_param_create status
D (553) grownode: check stored value for key blink_status
D (553) grownode: found stored value for key blink_status
D (563) grownode: .. value: 0
D (563) grownode: gn_leaf_param_create inverted
D (563) grownode: check stored value for key blink_inverted
D (573) grownode: found stored value for key blink_inverted
D (583) grownode: .. value: 0
D (583) grownode: gn_leaf_param_create gpio
D (583) grownode: check stored value for key blink_gpio
D (593) grownode: found stored value for key blink_gpio
D (593) grownode: .. value: 2.000000
D (603) grownode: Param status added in blink
D (603) grownode: Param inverted added in blink
D (613) grownode: Param gpio added in blink
D (613) grownode: gn_create_leaf success
D (613) grownode: gn_leaf_param_init_double gpio 2
D (623) grownode: .. value already found: (2.000000) - skipping
D (633) grownode: gn_leaf_param_init_bool inverted 0
D (633) grownode: .. value already found: (204) - skipping
D (643) grownode: gn_leaf_param_init_bool status 0
D (643) grownode: .. value already found: (244) - skipping
D (653) grownode: gn_start_node: nft2, leaves: 1
I (653) grownode: _gn_leaf_start blink
D (663) gn_leaf_gpio: [blink] gn_gpio_task
D (663) gn_leaf_gpio: configuring - gpio 2, status 0, inverted 0
D (673) gn_leaf_gpio: [blink] task cycle..
I (763) grownode: _gn_start_leaf blink completed
I (763) grownode: looping. grownode startup status: Started, sleep mode
= 0
D (2653) gn_blink: blinking - old status = 0
I (2653) gn_blink: blinking - new status = 1
D (2653) grownode: gn_leaf_parameter_update. param=status
D (2653) gn_leaf_gpio: [blink] received message: 260
D (2663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (2663) gn_leaf_gpio: written: 1
D (2673) grownode: gn_leaf_param_write_bool: after validator: 1
W (2893) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (2893) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (2893) gn_leaf_gpio: [blink] task cycle..
D (4653) gn_blink: blinking - old status = 1
I (4653) gn_blink: blinking - new status = 0
D (4653) grownode: gn_leaf_parameter_update. param=status
D (4653) gn_leaf_gpio: [blink] received message: 260
D (4663) gn_leaf_gpio: [blink] request to update param status, data =
'0'
D (4663) gn_leaf_gpio: written: 0
D (4673) grownode: gn_leaf_param_write_bool: after validator: 0
D (4673) grownode: gn_leaf_param_write_bool - result 0
D (4683) gn_leaf_gpio: [blink] - gpio 2, toggle 0, inverted 0
D (4683) gn_leaf_gpio: [blink] task cycle..
D (6653) gn_blink: blinking - old status = 0
I (6653) gn_blink: blinking - new status = 1
D (6653) grownode: gn_leaf_parameter_update. param=status
D (6653) gn_leaf_gpio: [blink] received message: 260
D (6663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (6663) gn_leaf_gpio: written: 1
D (6673) grownode: gn_leaf_param_write_bool: after validator: 1
W (6893) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (6893) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (6903) gn_leaf_gpio: [blink] task cycle..
D (8653) gn_blink: blinking - old status = 1
I (8653) gn_blink: blinking - new status = 0
D (8653) grownode: gn_leaf_parameter_update. param=status
D (8653) gn_leaf_gpio: [blink] received message: 260
D (8663) gn_leaf_gpio: [blink] request to update param status, data =
'0'
D (8663) gn_leaf_gpio: written: 0
D (8673) grownode: gn_leaf_param_write_bool: after validator: 0
D (8673) grownode: gn_leaf_param_write_bool - result 0
D (8683) gn_leaf_gpio: [blink] - gpio 2, toggle 0, inverted 0
D (8683) gn_leaf_gpio: [blink] task cycle..
D (10653) gn_blink: blinking - old status = 0
I (10653) gn_blink: blinking - new status = 1
D (10653) grownode: gn_leaf_parameter_update. param=status
D (10653) gn_leaf_gpio: [blink] received message: 260
D (10663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (10663) gn_leaf_gpio: written: 1
D (10673) grownode: gn_leaf_param_write_bool: after validator: 1
I (10763) grownode: looping. grownode startup status: Started, sleep
mode = 0
W (10903) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (10903) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (10913) gn_leaf_gpio: [blink] task cycle..


SECOND TRIAL
3) modified gn_blink.c and set GPIO 3
4) modified sdkconfig and SET "Reset Flash at every startup"
5) compiled, flashed and run. From the logs you can see that the GPIO
has been set, but the INIT function is skipped because value 2 has been
already found. So the "reset" flag is not considered.

I (533) grownode: grownode startup sequence completed!
D (543) gn_leaf_gpio: [blink] gn_gpio_config
D (543) grownode: gn_leaf_param_create status
D (553) grownode: check stored value for key blink_status
D (553) grownode: found stored value for key blink_status
D (563) grownode: .. value: 0
D (563) grownode: gn_leaf_param_create inverted
D (563) grownode: check stored value for key blink_inverted
D (573) grownode: found stored value for key blink_inverted
D (583) grownode: .. value: 0
D (583) grownode: gn_leaf_param_create gpio
D (583) grownode: check stored value for key blink_gpio
D (593) grownode: found stored value for key blink_gpio
D (593) grownode: .. value: 2.000000
D (603) grownode: Param status added in blink
D (603) grownode: Param inverted added in blink
D (613) grownode: Param gpio added in blink
D (613) grownode: gn_create_leaf success
D (613) grownode: gn_leaf_param_init_double gpio 3
D (623) grownode: .. value already found: (3.000000) - skipping
D (633) grownode: gn_leaf_param_init_bool inverted 0
D (633) grownode: .. value already found: (204) - skipping
D (643) grownode: gn_leaf_param_init_bool status 0
D (643) grownode: .. value already found: (244) - skipping
D (653) grownode: gn_start_node: nft2, leaves: 1
I (653) grownode: _gn_leaf_start blink
D (663) gn_leaf_gpio: [blink] gn_gpio_task
D (663) gn_leaf_gpio: configuring - gpio 2, status 0, inverted 0
D (673) gn_leaf_gpio: [blink] task cycle..
I (763) grownode: _gn_start_leaf blink completed
I (763) grownode: looping. grownode startup status: Started, sleep mode
= 0
D (2653) gn_blink: blinking - old status = 0
I (2653) gn_blink: blinking - new status = 1
D (2653) grownode: gn_leaf_parameter_update. param=status
D (2653) gn_leaf_gpio: [blink] received message: 260
D (2663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (2663) gn_leaf_gpio: written: 1
D (2673) grownode: gn_leaf_param_write_bool: after validator: 1
W (2903) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (2903) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (2913) gn_leaf_gpio: [blink] task cycle..
D (4653) gn_blink: blinking - old status = 1
I (4653) gn_blink: blinking - new status = 0
D (4653) grownode: gn_leaf_parameter_update. param=status
D (4653) gn_leaf_gpio: [blink] received message: 260
D (4663) gn_leaf_gpio: [blink] request to update param status, data =
'0'
D (4663) gn_leaf_gpio: written: 0
D (4673) grownode: gn_leaf_param_write_bool: after validator: 0
D (4673) grownode: gn_leaf_param_write_bool - result 0
D (4683) gn_leaf_gpio: [blink] - gpio 2, toggle 0, inverted 0
D (4683) gn_leaf_gpio: [blink] task cycle..
D (6653) gn_blink: blinking - old status = 0
I (6653) gn_blink: blinking - new status = 1
D (6653) grownode: gn_leaf_parameter_update. param=status
D (6653) gn_leaf_gpio: [blink] received message: 260
D (6663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (6663) gn_leaf_gpio: written: 1
D (6673) grownode: gn_leaf_param_write_bool: after validator: 1
W (6923) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (6923) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (6923) gn_leaf_gpio: [blink] task cycle..
D (8653) gn_blink: blinking - old status = 1
I (8653) gn_blink: blinking - new status = 0
D (8653) grownode: gn_leaf_parameter_update. param=status
D (8653) gn_leaf_gpio: [blink] received message: 260
D (8663) gn_leaf_gpio: [blink] request to update param status, data =
'0'
D (8663) gn_leaf_gpio: written: 0
D (8673) grownode: gn_leaf_param_write_bool: after validator: 0
D (8673) grownode: gn_leaf_param_write_bool - result 0
D (8683) gn_leaf_gpio: [blink] - gpio 2, toggle 0, inverted 0
D (8683) gn_leaf_gpio: [blink] task cycle..
D (10653) gn_blink: blinking - old status = 0
I (10653) gn_blink: blinking - new status = 1
D (10653) grownode: gn_leaf_parameter_update. param=status
D (10653) gn_leaf_gpio: [blink] received message: 260
D (10663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (10663) gn_leaf_gpio: written: 1
D (10673) grownode: gn_leaf_param_write_bool: after validator: 1
I (10763) grownode: looping. grownode startup status: Started, sleep
mode = 0
W (10883) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (10883) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (10883) gn_leaf_gpio: [blink] task cycle..
D (12653) gn_blink: blinking - old status = 1
I (12653) gn_blink: blinking - new status = 0
D (12653) grownode: gn_leaf_parameter_update. param=status
D (12653) gn_leaf_gpio: [blink] received message: 260
D (12663) gn_leaf_gpio: [blink] request to update param status, data =
'0'
D (12663) gn_leaf_gpio: written: 0
D (12673) grownode: gn_leaf_param_write_bool: after validator: 0
D (12673) grownode: gn_leaf_param_write_bool - result 0
D (12683) gn_leaf_gpio: [blink] - gpio 2, toggle 0, inverted 0
D (12683) gn_leaf_gpio: [blink] task cycle..
D (14653) gn_blink: blinking - old status = 0
I (14653) gn_blink: blinking - new status = 1
D (14653) grownode: gn_leaf_parameter_update. param=status
D (14653) gn_leaf_gpio: [blink] received message: 260
D (14663) gn_leaf_gpio: [blink] request to update param status, data =
'1'
D (14663) gn_leaf_gpio: written: 1
D (14673) grownode: gn_leaf_param_write_bool: after validator: 1
W (14883) grownode: not possible to store leaf parameter value - key
blink_status value 1
D (14883) gn_leaf_gpio: [blink] - gpio 2, toggle 1, inverted 0
D (14883) gn_leaf_gpio: [blink] task cycle..


THIRD TRIAL
5) changed the leaf name into gn_blink.c, keeping GPIO configured to 3
6) compiled, flashed and run. The code searches for already set
parameters and fails. Blinking GPIO is set to 32 instead of 3 (confirmed
measuring with a tester on GPIO 32)

I (533) grownode: grownode startup sequence completed!
D (543) gn_leaf_gpio: [blink123] gn_gpio_config
D (543) grownode: gn_leaf_param_create status
D (553) grownode: check stored value for key blink123_status
D (553) grownode: gn_storage_get(blink123_status) - FAIL
D (563) grownode: not found stored value for key blink123_status
D (563) grownode: gn_leaf_param_create inverted
D (573) grownode: check stored value for key blink123_inverted
D (573) grownode: gn_storage_get(blink123_inverted) - FAIL
D (583) grownode: not found stored value for key blink123_inverted
D (593) grownode: gn_leaf_param_create gpio
D (593) grownode: check stored value for key blink123_gpio
D (603) grownode: gn_storage_get(blink123_gpio) - FAIL
D (603) grownode: not found stored value for key blink123_gpio
D (613) grownode: Param status added in blink123
D (613) grownode: Param inverted added in blink123
D (623) grownode: Param gpio added in blink123
D (623) grownode: gn_create_leaf success
D (623) grownode: gn_leaf_param_init_double gpio 3
D (633) grownode: gn_storage_get(blink123_gpio) - FAIL
W (813) grownode: not possible to store leaf parameter value - key
blink123_gpio value 3.000000
D (823) grownode: gn_leaf_param_init_bool inverted 0
D (823) grownode: gn_storage_get(blink123_inverted) - FAIL
W (1003) grownode: not possible to store leaf parameter value - key
blink123_inverted value 0
D (1003) grownode: gn_leaf_param_init_bool status 0
D (1013) grownode: gn_storage_get(blink123_status) - FAIL
W (1193) grownode: not possible to store leaf parameter value - key
blink123_status value 0
D (1193) grownode: gn_start_node: nft2, leaves: 1
I (1203) grownode: _gn_leaf_start blink123
D (1203) gn_leaf_gpio: [blink123] gn_gpio_task
D (1213) gn_leaf_gpio: configuring - gpio 32, status 0, inverted 0
D (1213) gn_leaf_gpio: [blink123] task cycle..
I (1303) grownode: _gn_start_leaf blink123 completed
I (1303) grownode: looping. grownode startup status: Started, sleep mode
= 0
D (3193) gn_blink: blinking - old status = 0
I (3193) gn_blink: blinking - new status = 1
D (3193) grownode: gn_leaf_parameter_update. param=status
D (3203) gn_leaf_gpio: [blink123] received message: 260
D (3203) gn_leaf_gpio: [blink123] request to update param status, data =
'1'
D (3213) gn_leaf_gpio: written: 1
D (3213) grownode: gn_leaf_param_write_bool: after validator: 1
W (3423) grownode: not possible to store leaf parameter value - key
blink123_status value 1
D (3423) gn_leaf_gpio: [blink123] - gpio 32, toggle 1, inverted 0
D (3423) gn_leaf_gpio: [blink123] task cycle..
D (5193) gn_blink: blinking - old status = 1
I (5193) gn_blink: blinking - new status = 0
D (5193) grownode: gn_leaf_parameter_update. param=status
D (5203) gn_leaf_gpio: [blink123] received message: 260
D (5203) gn_leaf_gpio: [blink123] request to update param status, data =
'0'
D (5213) gn_leaf_gpio: written: 0
D (5213) grownode: gn_leaf_param_write_bool: after validator: 0
W (5423) grownode: not possible to store leaf parameter value - key
blink123_status value 0
D (5423) gn_leaf_gpio: [blink123] - gpio 32, toggle 0, inverted 0
D (5423) gn_leaf_gpio: [blink123] task cycle..
D (7193) gn_blink: blinking - old status = 0
I (7193) gn_blink: blinking - new status = 1
D (7193) grownode: gn_leaf_parameter_update. param=status
D (7203) gn_leaf_gpio: [blink123] received message: 260
D (7203) gn_leaf_gpio: [blink123] request to update param status, data =
'1'
D (7213) gn_leaf_gpio: written: 1
D (7213) grownode: gn_leaf_param_write_bool: after validator: 1
W (7443) grownode: not possible to store leaf parameter value - key
blink123_status value 1
D (7443) gn_leaf_gpio: [blink123] - gpio 32, toggle 1, inverted 0
D (7453) gn_leaf_gpio: [blink123] task cycle..
D (9193) gn_blink: blinking - old status = 1
I (9193) gn_blink: blinking - new status = 0
D (9193) grownode: gn_leaf_parameter_update. param=status
D (9203) gn_leaf_gpio: [blink123] received message: 260
D (9203) gn_leaf_gpio: [blink123] request to update param status, data =
'0'
D (9213) gn_leaf_gpio: written: 0
D (9213) grownode: gn_leaf_param_write_bool: after validator: 0
W (9433) grownode: not possible to store leaf parameter value - key
blink123_status value 0
D (9433) gn_leaf_gpio: [blink123] - gpio 32, toggle 0, inverted 0
D (9443) gn_leaf_gpio: [blink123] task cycle..
D (11193) gn_blink: blinking - old status = 0
I (11193) gn_blink: blinking - new status = 1
D (11193) grownode: gn_leaf_parameter_update. param=status
D (11203) gn_leaf_gpio: [blink123] received message: 260
D (11203) gn_leaf_gpio: [blink123] request to update param status, data
= '1'
D (11213) gn_leaf_gpio: written: 1
D (11213) grownode: gn_leaf_param_write_bool: after validator: 1
I (11303) grownode: looping. grownode startup status: Started, sleep
mode = 0
W (11443) grownode: not possible to store leaf parameter value - key
blink123_status value 1
D (11443) gn_leaf_gpio: [blink123] - gpio 32, toggle 1, inverted 0
D (11453) gn_leaf_gpio: [blink123] task cycle..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant