From cf392a4c201f03361563fbcf54caf303d0617fd6 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 11 Aug 2024 20:06:38 +0800 Subject: [PATCH] Address some FIXME comments (#4435) * Address some FIXME comments These comments have since been addressed by more modern code. Remove them to reduce the clutter in the codebase. * Remove 'dumb idea' from SimpleAllocator 4 year old code that was set never to run can probably be safely deleted. --- src/gps/GPS.h | 2 +- src/main.h | 10 ++----- src/platform/esp32/SimpleAllocator.cpp | 38 -------------------------- 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 1c0977bdd..96171cba5 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -51,7 +51,7 @@ enum GPSPowerState : uint8_t { const char *getDOPString(uint32_t dop); /** - * A gps class that only reads from the GPS periodically (and FIXME - eventually keeps the gps powered down except when reading) + * A gps class that only reads from the GPS periodically and keeps the gps powered down except when reading * * When new data is available it will notify observers. */ diff --git a/src/main.h b/src/main.h index ea2d80f94..52a3fff1f 100644 --- a/src/main.h +++ b/src/main.h @@ -65,12 +65,6 @@ extern bool isVibrating; extern int TCPPort; // set by Portduino -// extern Observable newPowerStatus; //TODO: move this to main-esp32.cpp somehow or a helper class - -// extern meshtastic::PowerStatus *powerStatus; -// extern meshtastic::GPSStatus *gpsStatus; -// extern meshtastic::NodeStatusHandler *nodeStatusHandler; - // Return a human readable string of the form "Meshtastic_ab13" const char *getDeviceName(); @@ -91,5 +85,5 @@ void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearB meshtastic_DeviceMetadata getDeviceMetadata(); -// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that -extern SPISettings spiSettings; \ No newline at end of file +// We default to 4MHz SPI, SPI mode 0 +extern SPISettings spiSettings; diff --git a/src/platform/esp32/SimpleAllocator.cpp b/src/platform/esp32/SimpleAllocator.cpp index 63f3b02de..04ce35eb3 100644 --- a/src/platform/esp32/SimpleAllocator.cpp +++ b/src/platform/esp32/SimpleAllocator.cpp @@ -26,41 +26,3 @@ void *operator new(size_t size, SimpleAllocator &p) { return p.alloc(size); } - -#if 0 -// This was a dumb idea, turn off for now - -SimpleAllocator *activeAllocator; - -AllocatorScope::AllocatorScope(SimpleAllocator &a) -{ - assert(!activeAllocator); - activeAllocator = &a; -} - -AllocatorScope::~AllocatorScope() -{ - assert(activeAllocator); - activeAllocator = NULL; -} - -/// Global new/delete, uses a simple allocator if it is in scope - -void *operator new(size_t sz) throw(std::bad_alloc) -{ - void *mem = activeAllocator ? activeAllocator->alloc(sz) : malloc(sz); - if (mem) - return mem; - else - throw std::bad_alloc(); -} - -void operator delete(void *ptr) throw() -{ - if (activeAllocator) - LOG_WARN("Leaking an active allocator object\n"); // We don't properly handle this yet - else - free(ptr); -} - -#endif \ No newline at end of file