feat(nodes): adding battery percent as new key/value in the BLE frame
Closes: #66
This commit is contained in:
@@ -3,3 +3,9 @@ CONFIG_I2C=y
|
|||||||
CONFIG_SENSOR=y
|
CONFIG_SENSOR=y
|
||||||
CONFIG_BT=y
|
CONFIG_BT=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
CONFIG_LOG=n
|
||||||
|
CONFIG_CONSOLE=n
|
||||||
|
CONFIG_SERIAL=n
|
||||||
|
CONFIG_PRINTK=n
|
||||||
|
CONFIG_UART_CONSOLE=n
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ enum error_code battery_get_value(int* holder){
|
|||||||
// battery_voltage in [mV]
|
// battery_voltage in [mV]
|
||||||
int battery_voltage = battery_sample();
|
int battery_voltage = battery_sample();
|
||||||
if(battery_voltage >= 0){
|
if(battery_voltage >= 0){
|
||||||
*holder = battery_level_pptt(battery_voltage, levels);
|
*holder = (battery_level_pptt(battery_voltage, levels)/100);
|
||||||
ret = success;
|
ret = success;
|
||||||
}else{}
|
}else{}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
int main(void){
|
int main(void){
|
||||||
supervisor_init();
|
supervisor_init();
|
||||||
// todo : sohuld init fail, activate led ?
|
|
||||||
supervisor_run();
|
supervisor_run();
|
||||||
// should never come here
|
// should never come here
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ enum error_code supervisor_init(){
|
|||||||
success == co2_lvl_init() &&
|
success == co2_lvl_init() &&
|
||||||
success == hygro_init() &&
|
success == hygro_init() &&
|
||||||
success == thermo_init() &&
|
success == thermo_init() &&
|
||||||
success == window_init()
|
success == window_init() &&
|
||||||
|
success == battery_init()
|
||||||
){
|
){
|
||||||
ret = success;
|
ret = success;
|
||||||
}else{}
|
}else{}
|
||||||
@@ -58,7 +59,7 @@ enum error_code supervisor_run(){
|
|||||||
current_sleep_time = SLEEP_MAX_DURATION;
|
current_sleep_time = SLEEP_MAX_DURATION;
|
||||||
}else{}
|
}else{}
|
||||||
}
|
}
|
||||||
//k_sleep(K_MINUTES(current_sleep_time));
|
k_sleep(K_MINUTES(current_sleep_time));
|
||||||
}
|
}
|
||||||
return error_unknown; // should never return
|
return error_unknown; // should never return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 window_init(){
|
||||||
enum error_code ret = init_failed;
|
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;
|
ret = success;
|
||||||
}else{}
|
}else{}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user