begin cleanup on radio abstraction, details below:

* to allow changing to new mesh transport
* to allow a different chipset for the radio
* to allow testing on hardware with a SimRadio
* new "bare" build env for a devboard with virtually no hardware
* make buttons optional
This commit is contained in:
geeksville
2020-03-31 21:56:35 -07:00
parent 17de6f9532
commit da74803ffb
10 changed files with 206 additions and 48 deletions

View File

@@ -31,7 +31,7 @@ static void lsEnter()
screen.setOn(false);
uint32_t now = millis();
while (!service.radio.rf95.canSleep()) {
while (!service.radio.radioIf.canSleep()) {
delay(10); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep
@@ -82,7 +82,12 @@ static void lsIdle()
} else {
DEBUG_MSG("wakeCause %d\n", wakeCause);
if (!digitalRead(BUTTON_PIN)) // If we woke because of press, instead generate a PRESS event.
#ifdef BUTTON_PIN
bool pressed = !digitalRead(BUTTON_PIN);
#else
bool pressed = false;
#endif
if (pressed) // If we woke because of press, instead generate a PRESS event.
{
powerFSM.trigger(EVENT_PRESS);
} else {