mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 09:42:35 +00:00
Portduino WIP now compiles but does not link
This commit is contained in:
parent
6a475d8288
commit
fefd3d78f3
@ -248,7 +248,7 @@ lib_deps =
|
|||||||
|
|
||||||
[env:linux]
|
[env:linux]
|
||||||
platform = https://github.com/geeksville/platform-portduino.git
|
platform = https://github.com/geeksville/platform-portduino.git
|
||||||
src_filter = ${env.src_filter} -<esp32/> -<nimble/>
|
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/>
|
||||||
build_flags = ${env.build_flags} -DRADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
build_flags = ${env.build_flags}
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = linux_x86_64
|
board = linux_x86_64
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
static void sdsEnter()
|
static void sdsEnter()
|
||||||
{
|
{
|
||||||
@ -16,7 +15,7 @@ static void sdsEnter()
|
|||||||
|
|
||||||
// Don't deepsleep if we have USB power or if the user as pressed a button recently
|
// Don't deepsleep if we have USB power or if the user as pressed a button recently
|
||||||
// !isUSBPowered <- doesn't work yet because the axp192 isn't letting the battery fully charge when we are awake - FIXME
|
// !isUSBPowered <- doesn't work yet because the axp192 isn't letting the battery fully charge when we are awake - FIXME
|
||||||
if (timing::millis() - lastPressMs > radioConfig.preferences.mesh_sds_timeout_secs)
|
if (millis() - lastPressMs > radioConfig.preferences.mesh_sds_timeout_secs)
|
||||||
{
|
{
|
||||||
doDeepSleep(radioConfig.preferences.sds_secs);
|
doDeepSleep(radioConfig.preferences.sds_secs);
|
||||||
}
|
}
|
||||||
@ -131,7 +130,7 @@ static void onEnter()
|
|||||||
|
|
||||||
static uint32_t lastPingMs;
|
static uint32_t lastPingMs;
|
||||||
|
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
|
|
||||||
if (now - lastPingMs > 30 * 1000) { // if more than a minute since our last press, ask other nodes to update their state
|
if (now - lastPingMs > 30 * 1000) { // if more than a minute since our last press, ask other nodes to update their state
|
||||||
if (displayedNodeNum)
|
if (displayedNodeNum)
|
||||||
|
@ -15,6 +15,13 @@ class BaseNotifiedWorkerThread : public WorkerThread
|
|||||||
*/
|
*/
|
||||||
virtual void notify(uint32_t v = 0, eNotifyAction action = eNoAction) = 0;
|
virtual void notify(uint32_t v = 0, eNotifyAction action = eNoAction) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify from an ISR
|
||||||
|
*
|
||||||
|
* This must be inline or IRAM_ATTR on ESP32
|
||||||
|
*/
|
||||||
|
virtual void notifyFromISR(BaseType_t *highPriWoken, uint32_t v = 0, eNotifyAction action = eNoAction) { notify(v, action); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* The notification that was most recently used to wake the thread. Read from loop()
|
* The notification that was most recently used to wake the thread. Read from loop()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "timing.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace concurrency
|
namespace concurrency
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#ifdef HAS_FREE_RTOS
|
#ifdef HAS_FREE_RTOS
|
||||||
|
|
||||||
#include "timing.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "PeriodicScheduler.h"
|
#include "PeriodicScheduler.h"
|
||||||
#include "PeriodicTask.h"
|
#include "PeriodicTask.h"
|
||||||
#include "LockGuard.h"
|
#include "LockGuard.h"
|
||||||
#include "../timing.h"
|
|
||||||
|
|
||||||
namespace concurrency {
|
namespace concurrency {
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ void PeriodicScheduler::loop()
|
|||||||
{
|
{
|
||||||
LockGuard lg(&lock);
|
LockGuard lg(&lock);
|
||||||
|
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
for (auto t : tasks) {
|
for (auto t : tasks) {
|
||||||
if (t->period && (now - t->lastMsec) >= t->period) {
|
if (t->period && (now - t->lastMsec) >= t->period) {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
#include "PeriodicScheduler.h"
|
#include "PeriodicScheduler.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
namespace concurrency {
|
namespace concurrency {
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class PeriodicTask
|
|||||||
*/
|
*/
|
||||||
void setPeriod(uint32_t p)
|
void setPeriod(uint32_t p)
|
||||||
{
|
{
|
||||||
lastMsec = timing::millis(); // reset starting from now
|
lastMsec = millis(); // reset starting from now
|
||||||
period = p;
|
period = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "WorkerThread.h"
|
#include "WorkerThread.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
namespace concurrency {
|
namespace concurrency {
|
||||||
|
|
||||||
@ -17,8 +16,8 @@ void WorkerThread::doRun()
|
|||||||
|
|
||||||
#ifdef DEBUG_STACK
|
#ifdef DEBUG_STACK
|
||||||
static uint32_t lastPrint = 0;
|
static uint32_t lastPrint = 0;
|
||||||
if (timing::millis() - lastPrint > 10 * 1000L) {
|
if (millis() - lastPrint > 10 * 1000L) {
|
||||||
lastPrint = timing::millis();
|
lastPrint = millis();
|
||||||
meshtastic::printThreadInfo("net");
|
meshtastic::printThreadInfo("net");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -341,6 +341,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define HW_VENDOR "nrf52unknown" // FIXME - unknown nrf52 board
|
#define HW_VENDOR "nrf52unknown" // FIXME - unknown nrf52 board
|
||||||
|
|
||||||
|
#elif PORTDUINO
|
||||||
|
|
||||||
|
#define HW_VENDOR "portduino"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RF95
|
#ifdef USE_RF95
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include "../concurrency/LockGuard.h"
|
#include "../concurrency/LockGuard.h"
|
||||||
#include "../timing.h"
|
|
||||||
#include "BluetoothSoftwareUpdate.h"
|
#include "BluetoothSoftwareUpdate.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RadioLibInterface.h"
|
#include "RadioLibInterface.h"
|
||||||
@ -102,7 +101,7 @@ int update_crc32_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble
|
|||||||
} else {
|
} else {
|
||||||
if (Update.end()) {
|
if (Update.end()) {
|
||||||
DEBUG_MSG("OTA done, rebooting in 5 seconds!\n");
|
DEBUG_MSG("OTA done, rebooting in 5 seconds!\n");
|
||||||
rebootAtMsec = timing::millis() + 5000;
|
rebootAtMsec = millis() + 5000;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Error Occurred. Error #: %d\n", Update.getError());
|
DEBUG_MSG("Error Occurred. Error #: %d\n", Update.getError());
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ int update_result_callback(uint16_t conn_handle, uint16_t attr_handle, struct bl
|
|||||||
|
|
||||||
void bluetoothRebootCheck()
|
void bluetoothRebootCheck()
|
||||||
{
|
{
|
||||||
if (rebootAtMsec && timing::millis() > rebootAtMsec) {
|
if (rebootAtMsec && millis() > rebootAtMsec) {
|
||||||
DEBUG_MSG("Rebooting for update\n");
|
DEBUG_MSG("Rebooting for update\n");
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,6 @@ typedef uint32_t BaseType_t;
|
|||||||
// Don't do anything on non free rtos platforms when done with the ISR
|
// Don't do anything on non free rtos platforms when done with the ISR
|
||||||
#define portYIELD_FROM_ISR(x)
|
#define portYIELD_FROM_ISR(x)
|
||||||
|
|
||||||
enum eNotifyAction {
|
enum eNotifyAction { eNoAction, eSetValueWithoutOverwrite, eSetValueWithOverwrite };
|
||||||
eNoAction
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
#include "GPS.h"
|
#include "GPS.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "timing.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ void readFromRTC()
|
|||||||
struct timeval tv; /* btw settimeofday() is helpfull here too*/
|
struct timeval tv; /* btw settimeofday() is helpfull here too*/
|
||||||
|
|
||||||
if (!gettimeofday(&tv, NULL)) {
|
if (!gettimeofday(&tv, NULL)) {
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
|
|
||||||
DEBUG_MSG("Read RTC time as %ld (cur millis %u) valid=%d\n", tv.tv_sec, now, timeSetFromGPS);
|
DEBUG_MSG("Read RTC time as %ld (cur millis %u) valid=%d\n", tv.tv_sec, now, timeSetFromGPS);
|
||||||
timeStartMsec = now;
|
timeStartMsec = now;
|
||||||
@ -79,7 +78,7 @@ void perhapsSetRTC(struct tm &t)
|
|||||||
|
|
||||||
uint32_t getTime()
|
uint32_t getTime()
|
||||||
{
|
{
|
||||||
return ((timing::millis() - timeStartMsec) / 1000) + zeroOffsetSecs;
|
return ((millis() - timeStartMsec) / 1000) + zeroOffsetSecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getValidTime()
|
uint32_t getValidTime()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "NEMAGPS.h"
|
#include "NEMAGPS.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
static int32_t toDegInt(RawDegrees d)
|
static int32_t toDegInt(RawDegrees d)
|
||||||
{
|
{
|
||||||
@ -19,7 +18,7 @@ void NEMAGPS::loop()
|
|||||||
reader.encode(c);
|
reader.encode(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
if ((now - lastUpdateMsec) > 20 * 1000) { // Ugly hack for now - limit update checks to once every 20 secs (but still consume
|
if ((now - lastUpdateMsec) > 20 * 1000) { // Ugly hack for now - limit update checks to once every 20 secs (but still consume
|
||||||
// serial chars at whatever rate)
|
// serial chars at whatever rate)
|
||||||
lastUpdateMsec = now;
|
lastUpdateMsec = now;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "timing.h"
|
|
||||||
#include <OneButton.h>
|
#include <OneButton.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
// #include <driver/rtc_io.h>
|
// #include <driver/rtc_io.h>
|
||||||
@ -392,15 +391,15 @@ void loop()
|
|||||||
|
|
||||||
// Show boot screen for first 3 seconds, then switch to normal operation.
|
// Show boot screen for first 3 seconds, then switch to normal operation.
|
||||||
static bool showingBootScreen = true;
|
static bool showingBootScreen = true;
|
||||||
if (showingBootScreen && (timing::millis() > 3000)) {
|
if (showingBootScreen && (millis() > 3000)) {
|
||||||
screen.stopBootScreen();
|
screen.stopBootScreen();
|
||||||
showingBootScreen = false;
|
showingBootScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_STACK
|
#ifdef DEBUG_STACK
|
||||||
static uint32_t lastPrint = 0;
|
static uint32_t lastPrint = 0;
|
||||||
if (timing::millis() - lastPrint > 10 * 1000L) {
|
if (millis() - lastPrint > 10 * 1000L) {
|
||||||
lastPrint = timing::millis();
|
lastPrint = millis();
|
||||||
meshtastic::printThreadInfo("main");
|
meshtastic::printThreadInfo("main");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
receivedPacketQueue - this is a queue of messages we've received from the mesh, which we are keeping to deliver to the phone.
|
receivedPacketQueue - this is a queue of messages we've received from the mesh, which we are keeping to deliver to the phone.
|
||||||
@ -309,7 +308,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
|
|||||||
|
|
||||||
// We limit our GPS broadcasts to a max rate
|
// We limit our GPS broadcasts to a max rate
|
||||||
static uint32_t lastGpsSend;
|
static uint32_t lastGpsSend;
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
if (lastGpsSend == 0 || now - lastGpsSend > radioConfig.preferences.position_broadcast_secs * 1000) {
|
if (lastGpsSend == 0 || now - lastGpsSend > radioConfig.preferences.position_broadcast_secs * 1000) {
|
||||||
lastGpsSend = now;
|
lastGpsSend = now;
|
||||||
DEBUG_MSG("Sending position to mesh\n");
|
DEBUG_MSG("Sending position to mesh\n");
|
||||||
|
@ -36,7 +36,7 @@ DeviceState versions used to be defined in the .proto file but really only this
|
|||||||
// Portduino version
|
// Portduino version
|
||||||
#include "PortduinoFS.h"
|
#include "PortduinoFS.h"
|
||||||
#define FS PortduinoFS
|
#define FS PortduinoFS
|
||||||
#define FSBegin() FS.begin(true)
|
#define FSBegin() true
|
||||||
#define FILE_O_WRITE "w"
|
#define FILE_O_WRITE "w"
|
||||||
#define FILE_O_READ "r"
|
#define FILE_O_READ "r"
|
||||||
#elif !defined(NO_ESP32)
|
#elif !defined(NO_ESP32)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "PacketHistory.h"
|
#include "PacketHistory.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "../timing.h"
|
|
||||||
|
|
||||||
PacketHistory::PacketHistory()
|
PacketHistory::PacketHistory()
|
||||||
{
|
{
|
||||||
@ -19,7 +18,7 @@ bool PacketHistory::wasSeenRecently(const MeshPacket *p, bool withUpdate)
|
|||||||
return false; // Not a floodable message ID, so we don't care
|
return false; // Not a floodable message ID, so we don't care
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
for (size_t i = 0; i < recentPackets.size();) {
|
for (size_t i = 0; i < recentPackets.size();) {
|
||||||
PacketRecord &r = recentPackets[i];
|
PacketRecord &r = recentPackets[i];
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RadioInterface.h"
|
#include "RadioInterface.h"
|
||||||
#include "timing.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
PhoneAPI::PhoneAPI()
|
PhoneAPI::PhoneAPI()
|
||||||
@ -21,7 +20,7 @@ void PhoneAPI::init()
|
|||||||
void PhoneAPI::checkConnectionTimeout()
|
void PhoneAPI::checkConnectionTimeout()
|
||||||
{
|
{
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
bool newConnected = (timing::millis() - lastContactMsec < radioConfig.preferences.phone_timeout_secs * 1000L);
|
bool newConnected = (millis() - lastContactMsec < radioConfig.preferences.phone_timeout_secs * 1000L);
|
||||||
if (!newConnected) {
|
if (!newConnected) {
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
onConnectionChanged(isConnected);
|
onConnectionChanged(isConnected);
|
||||||
@ -35,7 +34,7 @@ void PhoneAPI::checkConnectionTimeout()
|
|||||||
void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||||
{
|
{
|
||||||
powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); // As long as the phone keeps talking to us, don't let the radio go to sleep
|
powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); // As long as the phone keeps talking to us, don't let the radio go to sleep
|
||||||
lastContactMsec = timing::millis();
|
lastContactMsec = millis();
|
||||||
if (!isConnected) {
|
if (!isConnected) {
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
onConnectionChanged(isConnected);
|
onConnectionChanged(isConnected);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "timing.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
@ -163,7 +162,7 @@ size_t RadioInterface::beginSending(MeshPacket *p)
|
|||||||
// DEBUG_MSG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
// DEBUG_MSG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||||
assert(p->which_payload == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
assert(p->which_payload == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||||
|
|
||||||
lastTxStart = timing::millis();
|
lastTxStart = millis();
|
||||||
|
|
||||||
PacketHeader *h = (PacketHeader *)radiobuf;
|
PacketHeader *h = (PacketHeader *)radiobuf;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "MeshTypes.h"
|
#include "MeshTypes.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
// ReliableRouter::ReliableRouter() {}
|
// ReliableRouter::ReliableRouter() {}
|
||||||
|
|
||||||
@ -163,7 +162,7 @@ PendingPacket *ReliableRouter::startRetransmission(MeshPacket *p)
|
|||||||
*/
|
*/
|
||||||
void ReliableRouter::doRetransmissions()
|
void ReliableRouter::doRetransmissions()
|
||||||
{
|
{
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
|
|
||||||
// FIXME, we should use a better datastructure rather than walking through this map.
|
// FIXME, we should use a better datastructure rather than walking through this map.
|
||||||
// for(auto el: pending) {
|
// for(auto el: pending) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include "FloodingRouter.h"
|
#include "FloodingRouter.h"
|
||||||
#include "../concurrency/PeriodicTask.h"
|
#include "../concurrency/PeriodicTask.h"
|
||||||
#include "../timing.h"
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +48,7 @@ struct PendingPacket {
|
|||||||
PendingPacket() {}
|
PendingPacket() {}
|
||||||
PendingPacket(MeshPacket *p);
|
PendingPacket(MeshPacket *p);
|
||||||
|
|
||||||
void setNextTx() { nextTxMsec = timing::millis() + random(20 * 1000L, 22 * 1000L); }
|
void setNextTx() { nextTxMsec = millis() + random(20 * 1000L, 22 * 1000L); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlobalPacketIdHashFunction
|
class GlobalPacketIdHashFunction
|
||||||
|
@ -53,7 +53,7 @@ template <class T> class TypedQueue
|
|||||||
public:
|
public:
|
||||||
TypedQueue(int maxElements) {}
|
TypedQueue(int maxElements) {}
|
||||||
|
|
||||||
// int numFree() { return uxQueueSpacesAvailable(h); }
|
int numFree() { return 1; } // Always claim 1 free, because we can grow to any size
|
||||||
|
|
||||||
bool isEmpty() { return q.empty(); }
|
bool isEmpty() { return q.empty(); }
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
#ifdef NO_ESP32
|
#if 0 // FIXME NRF52 only
|
||||||
#include "Adafruit_LittleFS.h"
|
#include "Adafruit_LittleFS.h"
|
||||||
using namespace Adafruit_LittleFS_Namespace; // To get File type
|
using namespace Adafruit_LittleFS_Namespace; // To get File type
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include "timing.h"
|
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "esp32/pm.h"
|
#include "esp32/pm.h"
|
||||||
@ -123,11 +122,11 @@ bool doPreflightSleep()
|
|||||||
/// Tell devices we are going to sleep and wait for them to handle things
|
/// Tell devices we are going to sleep and wait for them to handle things
|
||||||
static void waitEnterSleep()
|
static void waitEnterSleep()
|
||||||
{
|
{
|
||||||
uint32_t now = timing::millis();
|
uint32_t now = millis();
|
||||||
while (!doPreflightSleep()) {
|
while (!doPreflightSleep()) {
|
||||||
delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
|
delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
|
||||||
|
|
||||||
if (timing::millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep
|
if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep
|
||||||
recordCriticalError(ErrSleepEnterWait);
|
recordCriticalError(ErrSleepEnterWait);
|
||||||
assert(0); // FIXME - for now we just restart, need to fix bug #167
|
assert(0); // FIXME - for now we just restart, need to fix bug #167
|
||||||
break;
|
break;
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#include "timing.h"
|
|
||||||
#include "freertosinc.h"
|
|
||||||
|
|
||||||
namespace timing {
|
|
||||||
|
|
||||||
uint32_t millis() {
|
|
||||||
return xTaskGetTickCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace timing
|
|
@ -1,9 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
namespace timing {
|
|
||||||
|
|
||||||
uint32_t millis();
|
|
||||||
|
|
||||||
} // namespace timing
|
|
Loading…
Reference in New Issue
Block a user