Fixed no connected Radio handling

This commit is contained in:
atc1441
2024-03-29 23:29:36 +01:00
parent d8196c76e2
commit 93eba41376

View File

@@ -180,7 +180,8 @@ void APTagReset() {
// Send data to the AP
uint16_t sendBlock(const void* data, const uint16_t len) {
time_t timeCanary = millis();
if (!apInfo.isOnline) return false;
if(apInfo.state == AP_STATE_NORADIO)return true;
if (!apInfo.isOnline) return false;
if (!txStart()) return 0;
// don't retry now, as it collides with communication from the tag
for (uint8_t attempt = 0; attempt < 1; attempt++) {
@@ -248,6 +249,7 @@ blksend:
}
bool sendDataAvail(struct pendingData* pending) {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (!apInfo.isOnline) return false;
if (!txStart()) return false;
addCRC(pending, sizeof(struct pendingData));
@@ -269,6 +271,7 @@ bool sendDataAvail(struct pendingData* pending) {
return false;
}
bool sendCancelPending(struct pendingData* pending) {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (!apInfo.isOnline) return false;
if (!txStart()) return false;
addCRC(pending, sizeof(struct pendingData));
@@ -289,6 +292,7 @@ bool sendCancelPending(struct pendingData* pending) {
return false;
}
bool sendChannelPower(struct espSetChannelPower* scp) {
if(apInfo.state == AP_STATE_NORADIO)return true;
if ((apInfo.state != AP_STATE_ONLINE) && (apInfo.state != AP_STATE_COMING_ONLINE)) return false;
if (!txStart()) return false;
addCRC(scp, sizeof(struct espSetChannelPower));
@@ -311,6 +315,7 @@ bool sendChannelPower(struct espSetChannelPower* scp) {
return false;
}
bool sendPing() {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (apInfo.state == AP_STATE_FLASHING) return false;
Serial.print("ping");
int t = millis();
@@ -329,6 +334,7 @@ bool sendPing() {
return false;
}
bool sendGetInfo() {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (!txStart()) return false;
for (uint8_t attempt = 0; attempt < 5; attempt++) {
cmdReplyValue = CMD_REPLY_WAIT;
@@ -342,6 +348,7 @@ bool sendGetInfo() {
return false;
}
bool sendHighspeed() {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (!txStart()) return false;
for (uint8_t attempt = 0; attempt < 5; attempt++) {
cmdReplyValue = CMD_REPLY_WAIT;
@@ -738,6 +745,7 @@ void segmentedShowIp() {
}
bool bringAPOnline() {
if(apInfo.state == AP_STATE_NORADIO)return true;
if (apInfo.state == AP_STATE_FLASHING) return false;
setAPstate(false, AP_STATE_OFFLINE);
// try without rebooting