Open mavishak opened 3 years ago
As of now our main:
int main(void)
{
init_usart2(); // for debugging
init_queue();
init_sensor_with_interrupt();
init_timer2();// for monitoring switch state.
init_timer3(); //for sensor delay
init_timer4(); //for ESP8266 timeout
init_usart1(); // for ESP8266
write_usart2((uint8_t*)("\r\n_______________\r\n"));//For test
while(1)
{
do_event();
monitor_switch_state(120); // every 2 minutes
}
}
monitor_switch_state() is a function in system_control.c if 120 seconds passed since the last time the event "control_Handler" was queued, it queues it.
"control_Handler" calls "checkSwitchState", there the conrtol state (ON/OFF mode) is sampled from realtime database firebase.
If it comes back as "on" the sensor is enabled: its handler is enabled - need to check that is good enough
If it comes back as "off", null or if the comuniction is down the sensor is disabled: its handler is disabled - need to check that is good enough
tried to disable clock source from rcc - that did not work.
A few problems to look out for:
04/05/2021
We started building the functionality that will allow us to turn on and off the motion sensor:
Here is the HTTP request:
For AT commands need to add one more \r\n: