diff options
| -rw-r--r-- | Layout/LayoutJoin.cpp | 11 | ||||
| -rw-r--r-- | Layout/LayoutJoin.h | 3 | ||||
| -rw-r--r-- | main.cpp | 4 | 
3 files changed, 17 insertions, 1 deletions
| diff --git a/Layout/LayoutJoin.cpp b/Layout/LayoutJoin.cpp index 1b0fb20..3b67c28 100644 --- a/Layout/LayoutJoin.cpp +++ b/Layout/LayoutJoin.cpp @@ -7,12 +7,14 @@ LayoutJoin::LayoutJoin(DOGS102* lcd, uint8_t band)      _lFsb(0, 3, "FSB="),      _lRate(0, 5, "DR="),      _lPower(6, 5, "P="), +    _lAttempt(11, 5, "A="),      _fStatus(0, 0, 17),      _fId(3, 1, 14),      _fKey(3, 2, 14),      _fFsb(4, 3, 2),      _fRate(3, 5, 2),      _fPower(8, 5, 2), +    _fAttempt(13, 5, 4),      _fCountdown(0, 7, 9),      _fCountdownLabel(0, 6, 17),      _fCancel(11, 7, 6), @@ -32,6 +34,7 @@ void LayoutJoin::display() {      }      writeLabel(_lRate);      writeLabel(_lPower); +    writeLabel(_lAttempt);      displayCancel(); @@ -66,6 +69,14 @@ void LayoutJoin::updatePower(uint32_t power) {      writeField(_fPower, buf, size, true);  } +void LayoutJoin::updateAttempt(uint32_t attempt) { +    char buf[16]; +    size_t size; + +    size = snprintf(buf, sizeof(buf), "%lu", attempt); +    writeField(_fAttempt, buf, size, true); +} +  void LayoutJoin::updateStatus(std::string status) {      writeField(_fStatus, status, true);  } diff --git a/Layout/LayoutJoin.h b/Layout/LayoutJoin.h index f2b7e41..2f71aec 100644 --- a/Layout/LayoutJoin.h +++ b/Layout/LayoutJoin.h @@ -16,6 +16,7 @@ class LayoutJoin : public Layout {          void updateFsb(uint8_t band);          void updateRate(std::string rate);          void updatePower(uint32_t power); +        void updateAttempt(uint32_t attempt);          void updateStatus(std::string status);          void updateCountdown(uint32_t seconds);          void removeCountdown(); @@ -27,6 +28,7 @@ class LayoutJoin : public Layout {          Label _lFsb;          Label _lRate;          Label _lPower; +        Label _lAttempt;          Field _fStatus;          Field _fId; @@ -34,6 +36,7 @@ class LayoutJoin : public Layout {          Field _fFsb;          Field _fRate;          Field _fPower; +        Field _fAttempt;          Field _fCountdown;          Field _fCountdownLabel;          Field _fCancel; @@ -138,6 +138,7 @@ void mainMenu() {  }  void join() { +    uint32_t attempts = 1;      uint32_t next_tx;      uint8_t rate;      uint8_t power; @@ -192,12 +193,13 @@ void join() {          if (next_tx) {              lj.updateCountdown(next_tx * 1000);          } else { +            lj.updateAttempt(attempts++);              lj.updateStatus("Joining...");              if (! lora->join())                  logError("cannot join - LoRa layer busy");          } -        osEvent e = Thread::signal_wait(0, 250); +        osEvent e = Thread::signal_wait(0);          if (e.status == osEventSignal) {              if (e.value.signals & buttonSignal) {                  ev = buttons->getButtonEvent(); | 
