Skip to content
Snippets Groups Projects
Commit a7d77d37 authored by Nick Tsintolas's avatar Nick Tsintolas
Browse files

cleaned things up

parent c33bc739
Branches main
No related tags found
No related merge requests found
Pipeline #459814 passed
......@@ -63,13 +63,9 @@ static struct gpio_callback gather_button_data;
static struct gpio_callback ble_button_data;
//INTS + FLOATS
float sin_100hz_conversion = 1.0/45.0; //%/mV
float sin_500hz_conversion = 1.0/140.0; // %/mV
float battery_lvl;
float led1_brightness;
float led2_brightness;
int64_t work_queue_time;
int64_t work_done;
bool usbregstatus;
static int32_t atm_pressure_kPa;
float data_collector[3]; // { LED 1 Brightness, LED 2 Brightness, Pressure (Pa) }
......@@ -266,7 +262,7 @@ void sin100hzStopperWork(){
if (data_collector[0] < 0){
data_collector[0] = 0;
}
LOG_INF("Voltage 1 VALUE: %f", data_collector[0]); //brightness percent for LED1
LOG_INF("Brightness for LED1 VALUE: %f", data_collector[0]); //brightness percent for LED1
k_event_post(&s_obj.collectDone, FREQEVENT1); //notifies this sampling is done
}
......@@ -310,7 +306,7 @@ void sin500hzStopperWork(){
if (data_collector[1] < 0){
data_collector[1] = 0;
}
LOG_INF("Voltage 2 VALUE: %f", data_collector[1]); //brightness % for LED2
LOG_INF("Brightness for LED2 VALUE: %f", data_collector[1]); //brightness % for LED2
k_event_post(&s_obj.collectDone, FREQEVENT2); //notifies this sampling is done
}
......@@ -483,6 +479,7 @@ static void idle_exit(void *o){
//GATHER STATE
static void gather_info_entry(void *o){
LOG_INF("Gather Entry");
//start sampling timers unitl all samples collected
k_timer_start(&sin100hzTimer, K_NO_WAIT, K_USEC(1000000/FREQ1/SAMPLINGMULTIPLIER)); //1000 samples/sec, 1 sample every 1000us
k_timer_start(&sin500hzTimer, K_NO_WAIT, K_USEC(1000000/FREQ2/SAMPLINGMULTIPLIER)); //5000 samples/sec, 1 sample every 200us
......@@ -505,6 +502,7 @@ static void gather_info_run(void *o){
//ERROR STATE
static void error_entry(void *o){
LOG_INF("Error Entry");
gpio_pin_set_dt(&error_led, 1);
}
......@@ -514,9 +512,9 @@ static void ble_notification_entry(void *o){
ble_data[0]=data_collector[0];
ble_data[1]=data_collector[1];
ble_data[2]=data_collector[2];
LOG_INF("READY TO SEND: LED1 Brightness: %d", ble_data[0]);
LOG_INF("READY TO SEND: LED2 Brightness: %d", ble_data[1]);
LOG_INF("READY TO SEND: Pressure: %d", ble_data[2]);
//LOG_INF("READY TO SEND: LED1 Brightness: %d", ble_data[0]);
//LOG_INF("READY TO SEND: LED2 Brightness: %d", ble_data[1]);
//LOG_INF("READY TO SEND: Pressure: %d", ble_data[2]);
//battery GATT
err = bt_bas_set_battery_level((int)battery_lvl);
......@@ -539,6 +537,7 @@ static void ble_notification_entry(void *o){
//VBUS STATE
static void vbus_entry(void *o){
LOG_INF("VBUS Detected");
k_timer_start(&error_timer, K_MSEC(ERROR_CYCLE_TIME_MS), K_MSEC(ERROR_CYCLE_TIME_MS));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment