mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* SerialWifiInterface: misc tidy-ups
This commit is contained in:
parent
669e417e27
commit
5c4ec1bc22
3 changed files with 15 additions and 13 deletions
|
|
@ -20,13 +20,13 @@ void SerialWifiInterface::disable() {
|
|||
|
||||
size_t SerialWifiInterface::writeFrame(const uint8_t src[], size_t len) {
|
||||
if (len > MAX_FRAME_SIZE) {
|
||||
Serial.printf("writeFrame(), frame too big, len=%d\n", len);
|
||||
WIFI_DEBUG_PRINTLN("writeFrame(), frame too big, len=%d\n", len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (deviceConnected && len > 0) {
|
||||
if (send_queue_len >= FRAME_QUEUE_SIZE) {
|
||||
Serial.println("writeFrame(), send_queue is full!");
|
||||
WIFI_DEBUG_PRINTLN("writeFrame(), send_queue is full!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -39,27 +39,22 @@ size_t SerialWifiInterface::writeFrame(const uint8_t src[], size_t len) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define SER_WRITE_MIN_INTERVAL 0
|
||||
|
||||
bool SerialWifiInterface::isWriteBusy() const {
|
||||
return millis() < _last_write + SER_WRITE_MIN_INTERVAL; // still too soon to start another write?
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t SerialWifiInterface::checkRecvFrame(uint8_t dest[]) {
|
||||
if (isWriteBusy())
|
||||
return 0;
|
||||
|
||||
if (!client) client = server.available();
|
||||
|
||||
if (client.connected()) {
|
||||
if (!deviceConnected) {
|
||||
Serial.println("Got connexion");
|
||||
WIFI_DEBUG_PRINTLN("Got connection");
|
||||
deviceConnected = true;
|
||||
}
|
||||
} else {
|
||||
if (deviceConnected) {
|
||||
deviceConnected = false;
|
||||
Serial.println("Disconnected");
|
||||
WIFI_DEBUG_PRINTLN("Disconnected");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue