fix: typos

This commit is contained in:
Tobias Reisinger 2020-08-20 22:04:52 +02:00
parent d7c274ca86
commit d4ba7177d1
3 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ mqtt-port = 1885
mqtt-host = localhost mqtt-host = localhost
relay-count = 10 relay-count = 10
relay-init = 1 relays-init = 1
database = controller_db.lmdb database = controller_db.lmdb
log-level = debug log-level = debug
@ -24,7 +24,7 @@ init = 0
driver = piface driver = piface
pin = 1 pin = 1
inverted = 0 inverted = 0
init = 0 init = 1
[relay-2] [relay-2]
driver = gpio driver = gpio

View file

@ -128,9 +128,9 @@ config_load(IniDispatch *disp, void *config_void)
strcpy(config->mqtt_host, disp->value); strcpy(config->mqtt_host, disp->value);
return 0; return 0;
} }
if(CONFINI_IS_KEY("controller", "relay-init")) if(CONFINI_IS_KEY("controller", "relays-init"))
{ {
strcpy(config->relay_init, disp->value); config->relays_init = atoi(disp->value);
return 0; return 0;
} }
if(CONFINI_IS_KEY("controller", "relay-count")) if(CONFINI_IS_KEY("controller", "relay-count"))

View file

@ -78,7 +78,7 @@ main(int argc, const char** argv)
global_config.mqtt_port = 1885; global_config.mqtt_port = 1885;
global_config.relay_count = 0; global_config.relay_count = 0;
global_config.relay_init = -1; global_config.relays_init = -1;
global_config.log_level = LOG_INFO; global_config.log_level = LOG_INFO;
global_config.log_file = stdout; global_config.log_file = stdout;
@ -141,14 +141,14 @@ main(int argc, const char** argv)
for(uint_fast8_t i = 0; i < global_controller->relay_count; ++i) for(uint_fast8_t i = 0; i < global_controller->relay_count; ++i)
{ {
int relay_default = global_config.relay_configs[i].init int relay_default = global_config.relay_configs[i].init;
if(relay_default == -1) if(relay_default == -1)
{ {
relay_default = global_config.relays_init; relay_default = global_config.relays_init;
} }
if(relay_default == -1) if(relay_default == -1)
{ {
relay_default = global_config.relay_configs[i].inverted relay_default = global_config.relay_configs[i].inverted;
} }
if(global_config.relay_configs[i].driver == RELAY_DRIVER_GPIO) if(global_config.relay_configs[i].driver == RELAY_DRIVER_GPIO)