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; static volatile uint8_t timer0_time;
ISR(TIMER0_OVF_vect) { ISR(TIMER0_OVF_vect) {
timer0_time++; timer0_time++;
LED2_Toggle(); LED2_Toggle();
} }
uint8_t sim800_wait_for(PGM_P str) { uint8_t sim800_wait_for(PGM_P str) {
@ -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;
}
} }