move is_sending

This commit is contained in:
sessionm21 2020-05-15 13:55:33 +01:00
parent 6a41232a54
commit 39223c0f48

View File

@ -174,7 +174,6 @@ uint8_t buffer[] = {
void do_send(osjob_t* j){ void do_send(osjob_t* j){
// Check if there is not a current TX/RX job running // Check if there is not a current TX/RX job running
is_sending = 1;
if (LMIC.opmode & OP_TXRXPEND) { if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F("OP_TXRXPEND, not sending")); Serial.println(F("OP_TXRXPEND, not sending"));
} else { } else {
@ -199,6 +198,7 @@ void do_gps(osjob_t* j){
gps.encode(softserial_read()); gps.encode(softserial_read());
} }
if(!is_sending && gps.location.isValid()) { if(!is_sending && gps.location.isValid()) {
is_sending = 1;
do_send(&sendjob); do_send(&sendjob);
} }
os_setTimedCallback(&gpsjob, os_getTime()+sec2osticks(GPS_INTERVAL), do_gps); os_setTimedCallback(&gpsjob, os_getTime()+sec2osticks(GPS_INTERVAL), do_gps);