mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-05 13:23:11 +00:00
that's enough for tonight. web server is in its own thread, needs to be further optimized but it works enough. next is to refactor.
This commit is contained in:
parent
977e47d109
commit
cfcb00b943
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define periodsToLog 48
|
#define periodsToLog 48
|
||||||
|
|
||||||
AirTime airTime;
|
AirTime *airTime;
|
||||||
|
|
||||||
// A reminder that there are 3600 seconds in an hour so I don't have
|
// A reminder that there are 3600 seconds in an hour so I don't have
|
||||||
// to keep googling it.
|
// to keep googling it.
|
||||||
|
@ -51,4 +51,4 @@ class AirTime : private concurrency::OSThread
|
|||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern AirTime airTime;
|
extern AirTime *airTime;
|
@ -518,8 +518,10 @@ void setup()
|
|||||||
initWifi(forceSoftAP);
|
initWifi(forceSoftAP);
|
||||||
|
|
||||||
// Start web server thread.
|
// Start web server thread.
|
||||||
//webServerThread = new WebServerThread();
|
webServerThread = new WebServerThread();
|
||||||
|
|
||||||
|
// Start airtime logger thread.
|
||||||
|
airTime = new AirTime();
|
||||||
|
|
||||||
if (!rIf)
|
if (!rIf)
|
||||||
recordCriticalError(CriticalErrorCode_NoRadio);
|
recordCriticalError(CriticalErrorCode_NoRadio);
|
||||||
|
@ -97,7 +97,8 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
|||||||
|
|
||||||
// Count the packet toward our TX airtime utilization.
|
// Count the packet toward our TX airtime utilization.
|
||||||
// We only count it if it can be added to the TX queue.
|
// We only count it if it can be added to the TX queue.
|
||||||
airTime.logAirtime(TX_LOG, xmitMsec);
|
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||||
|
//airTime.logAirtime(TX_LOG, xmitMsec);
|
||||||
|
|
||||||
// We want all sending/receiving to be done by our daemon thread, We use a delay here because this packet might have been sent
|
// We want all sending/receiving to be done by our daemon thread, We use a delay here because this packet might have been sent
|
||||||
// in response to a packet we just received. So we want to make sure the other side has had a chance to reconfigure its radio
|
// in response to a packet we just received. So we want to make sure the other side has had a chance to reconfigure its radio
|
||||||
@ -216,7 +217,8 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
size_t length = iface->getPacketLength();
|
size_t length = iface->getPacketLength();
|
||||||
|
|
||||||
xmitMsec = getPacketTime(length);
|
xmitMsec = getPacketTime(length);
|
||||||
airTime.logAirtime(RX_ALL_LOG, xmitMsec);
|
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||||
|
//airTime.logAirtime(RX_ALL_LOG, xmitMsec);
|
||||||
|
|
||||||
int state = iface->readData(radiobuf, length);
|
int state = iface->readData(radiobuf, length);
|
||||||
if (state != ERR_NONE) {
|
if (state != ERR_NONE) {
|
||||||
@ -258,7 +260,8 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
printPacket("Lora RX", mp);
|
printPacket("Lora RX", mp);
|
||||||
|
|
||||||
xmitMsec = getPacketTime(mp);
|
xmitMsec = getPacketTime(mp);
|
||||||
airTime.logAirtime(RX_LOG, xmitMsec);
|
airTime->logAirtime(RX_LOG, xmitMsec);
|
||||||
|
//airTime.logAirtime(RX_LOG, xmitMsec);
|
||||||
|
|
||||||
deliverToReceiver(mp);
|
deliverToReceiver(mp);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "mesh/wifi/WebServerThread.h"
|
#include "mesh/wifi/WebServerThread.h"
|
||||||
|
#include "meshwifi/meshhttp.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
WebServerThread *webServerThread;
|
WebServerThread *webServerThread;
|
||||||
@ -7,8 +8,10 @@ WebServerThread::WebServerThread() : concurrency::OSThread("WebServerThread") {}
|
|||||||
|
|
||||||
int32_t WebServerThread::runOnce()
|
int32_t WebServerThread::runOnce()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("WebServerThread::runOnce()\n");
|
//DEBUG_MSG("WebServerThread::runOnce()\n");
|
||||||
|
handleWebResponse();
|
||||||
|
|
||||||
return (1000 * 1);
|
// Loop every 5ms.
|
||||||
|
return (5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user