Optimizations

This commit is contained in:
vlad 2022-10-31 13:18:01 +03:00
parent 2d0261c3bb
commit f5db4cb95d

22
main.c
View File

@ -19,8 +19,8 @@ uint16_t sensor_2[MEASUREMENTS];
static volatile uint8_t timer0_time;
ISR(TIMER0_OVF_vect) {
timer0_time++;
LED2_Toggle();
timer0_time++;
LED2_Toggle();
}
uint8_t sim800_wait_for(PGM_P str) {
@ -372,14 +372,14 @@ ISR(TIMER1_OVF_vect) {
}
}
// без скорости
if (exec == 1) {
if (exec > 0) {
exec = -1;
MCUCR &= ~(1 << SE);
sei();
read_sensors();
// если измерений 6 (и мало ли больше), то отправляем смс
if (sensor_measurements >= MEASUREMENTS) {
// если под скоростью, то тоже отправляем смс
if (exec == 2 || sensor_measurements >= MEASUREMENTS) {
try_to_send_telemetry();
}
@ -387,16 +387,4 @@ ISR(TIMER1_OVF_vect) {
MCUCR |= (1 << SE);
exec = 0;
}
// под скоростью
if (exec == 2) {
exec = -1;
MCUCR &= ~(1 << SE);
sei();
read_sensors();
try_to_send_telemetry();
cli();
MCUCR |= (1 << SE);
exec = 0;
}
}