Optimizations

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

18
main.c
View File

@ -372,14 +372,14 @@ ISR(TIMER1_OVF_vect) {
} }
} }
// без скорости if (exec > 0) {
if (exec == 1) {
exec = -1; exec = -1;
MCUCR &= ~(1 << SE); MCUCR &= ~(1 << SE);
sei(); sei();
read_sensors(); read_sensors();
// если измерений 6 (и мало ли больше), то отправляем смс // если измерений 6 (и мало ли больше), то отправляем смс
if (sensor_measurements >= MEASUREMENTS) { // если под скоростью, то тоже отправляем смс
if (exec == 2 || sensor_measurements >= MEASUREMENTS) {
try_to_send_telemetry(); try_to_send_telemetry();
} }
@ -387,16 +387,4 @@ ISR(TIMER1_OVF_vect) {
MCUCR |= (1 << SE); MCUCR |= (1 << SE);
exec = 0; exec = 0;
} }
// под скоростью
if (exec == 2) {
exec = -1;
MCUCR &= ~(1 << SE);
sei();
read_sensors();
try_to_send_telemetry();
cli();
MCUCR |= (1 << SE);
exec = 0;
}
} }