diff --git a/nodes/prj.conf b/nodes/prj.conf index 2bf9438..823c35b 100644 --- a/nodes/prj.conf +++ b/nodes/prj.conf @@ -3,3 +3,9 @@ CONFIG_I2C=y CONFIG_SENSOR=y CONFIG_BT=y CONFIG_GPIO=y + +CONFIG_LOG=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_PRINTK=n +CONFIG_UART_CONSOLE=n diff --git a/nodes/src/battery_percent.c b/nodes/src/battery_percent.c index d722a92..85ec3d7 100644 --- a/nodes/src/battery_percent.c +++ b/nodes/src/battery_percent.c @@ -35,7 +35,7 @@ enum error_code battery_get_value(int* holder){ // battery_voltage in [mV] int battery_voltage = battery_sample(); if(battery_voltage >= 0){ - *holder = battery_level_pptt(battery_voltage, levels); + *holder = (battery_level_pptt(battery_voltage, levels)/100); ret = success; }else{} return ret; diff --git a/nodes/src/main.c b/nodes/src/main.c index f9532f0..899afdd 100644 --- a/nodes/src/main.c +++ b/nodes/src/main.c @@ -12,7 +12,6 @@ int main(void){ supervisor_init(); - // todo : sohuld init fail, activate led ? supervisor_run(); // should never come here return 0; diff --git a/nodes/src/supervisor.c b/nodes/src/supervisor.c index 525fcee..11ccaa2 100644 --- a/nodes/src/supervisor.c +++ b/nodes/src/supervisor.c @@ -11,7 +11,8 @@ enum error_code supervisor_init(){ success == co2_lvl_init() && success == hygro_init() && success == thermo_init() && - success == window_init() + success == window_init() && + success == battery_init() ){ ret = success; }else{} @@ -58,7 +59,7 @@ enum error_code supervisor_run(){ current_sleep_time = SLEEP_MAX_DURATION; }else{} } - //k_sleep(K_MINUTES(current_sleep_time)); + k_sleep(K_MINUTES(current_sleep_time)); } return error_unknown; // should never return } diff --git a/nodes/src/window_status.c b/nodes/src/window_status.c index 4115419..85c0c48 100644 --- a/nodes/src/window_status.c +++ b/nodes/src/window_status.c @@ -4,7 +4,7 @@ static const struct gpio_dt_spec window_switch = GPIO_DT_SPEC_GET(DT_NODELABEL(w enum error_code window_init(){ enum error_code ret = init_failed; - if(gpio_is_ready_dt(&window_switch) && gpio_pin_configure_dt(&window_switch, GPIO_INPUT)){ + if(gpio_is_ready_dt(&window_switch) && (0 == gpio_pin_configure_dt(&window_switch, GPIO_INPUT))){ ret = success; }else{} return ret;