fix: all the bugs with the new database and commanding
This commit is contained in:
parent
9602e6e937
commit
924633f272
12 changed files with 99 additions and 149 deletions
src/models
|
@ -60,10 +60,11 @@ controller_db_select_mapper(sqlite3_stmt *stmt)
|
|||
uint8_t i;
|
||||
for(i = 0; i < global_config.relay_count; ++i)
|
||||
{
|
||||
new_controller->relays[i] = relay_load(new_controller->id);
|
||||
new_controller->relays[i] = relay_load(i);
|
||||
if(!new_controller->relays[i])
|
||||
{
|
||||
new_controller->relays[i] = relay_create(i);
|
||||
relay_save(new_controller->relays[i]);
|
||||
}
|
||||
}
|
||||
return new_controller;
|
||||
|
@ -206,10 +207,11 @@ controller_create(void)
|
|||
uint8_t i;
|
||||
for(i = 0; i < global_config.relay_count; ++i)
|
||||
{
|
||||
new_controller->relays[i] = relay_load(new_controller->id);
|
||||
new_controller->relays[i] = relay_load(i);
|
||||
if(!new_controller->relays[i])
|
||||
{
|
||||
new_controller->relays[i] = relay_create(i);
|
||||
relay_save(new_controller->relays[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue