Make SPI frequency and TOPHONE queue size configurable on Native (#4369)

* Make SPI frequency configurable on Native

* Make the tophone queue size configurable for Portduino

* The modified SPISettings must be configured in setup(), after config.yaml is processed

* make MeshService a pointer, so we can configure MAX_RX_TOPHONE at run time

* Got a little over excited with refactoring

* Silence a warning
This commit is contained in:
Jonathan Bennett
2024-08-01 19:29:49 -05:00
committed by GitHub
parent 4c1c5b070e
commit d2ea430a3e
36 changed files with 110 additions and 83 deletions

View File

@@ -208,7 +208,6 @@ uint32_t timeLastPowered = 0;
static Periodic *ledPeriodic;
static OSThread *powerFSMthread;
static OSThread *ambientLightingThread;
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
RadioInterface *rIf = NULL;
@@ -231,6 +230,12 @@ void printInfo()
void setup()
{
concurrency::hasBeenSetup = true;
#if ARCH_PORTDUINO
SPISettings spiSettings(settingsMap[spiSpeed], MSBFIRST, SPI_MODE0);
#else
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
#endif
meshtastic_Config_DisplayConfig_OledType screen_model =
meshtastic_Config_DisplayConfig_OledType::meshtastic_Config_DisplayConfig_OledType_OLED_AUTO;
OLEDDISPLAY_GEOMETRY screen_geometry = GEOMETRY_128_64;
@@ -714,8 +719,8 @@ void setup()
LOG_DEBUG("Starting audio thread\n");
audioThread = new AudioThread();
#endif
service.init();
service = new MeshService();
service->init();
// Now that the mesh service is created, create any modules
setupModules();
@@ -1080,7 +1085,7 @@ void loop()
// TODO: This should go into a thread handled by FreeRTOS.
// handleWebResponse();
service.loop();
service->loop();
long delayMsec = mainController.runOrDelay();
@@ -1094,4 +1099,4 @@ void loop()
mainDelay.delay(delayMsec);
}
// if (didWake) LOG_DEBUG("wake!\n");
}
}