From 002532401d789dd989215ca2ba44cdfa663222f7 Mon Sep 17 00:00:00 2001 From: Jm Date: Wed, 17 Mar 2021 21:52:30 -0700 Subject: [PATCH 01/15] #743 - Stub out for "mode 10" - NMEA string. --- src/plugins/SerialPlugin.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/SerialPlugin.cpp b/src/plugins/SerialPlugin.cpp index a2e2113b3..a79982129 100644 --- a/src/plugins/SerialPlugin.cpp +++ b/src/plugins/SerialPlugin.cpp @@ -186,9 +186,19 @@ bool SerialPluginRadio::handleReceived(const MeshPacket &mp) } } else { - // DEBUG_MSG("* * Message came from the mesh\n"); - // Serial2.println("* * Message came from the mesh"); - Serial2.printf("%s", p.payload.bytes); + + if (radioConfig.preferences.serialplugin_mode == 0 || radioConfig.preferences.serialplugin_mode == 1) { + // DEBUG_MSG("* * Message came from the mesh\n"); + // Serial2.println("* * Message came from the mesh"); + Serial2.printf("%s", p.payload.bytes); + + } else if (radioConfig.preferences.serialplugin_mode == 10) { + /* + @jobionekabnoi + Add code here to handle what gets sent out to the serial interface. + Format it the way you want. + */ + } } } else { From 3bb1206b9c8f5c329d7080774b98d7898c45eebb Mon Sep 17 00:00:00 2001 From: Jm Date: Wed, 17 Mar 2021 22:47:19 -0700 Subject: [PATCH 02/15] Update RangeTestPlugin.md --- docs/software/plugins/RangeTestPlugin.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/software/plugins/RangeTestPlugin.md b/docs/software/plugins/RangeTestPlugin.md index ab2f2c4df..4915016c3 100644 --- a/docs/software/plugins/RangeTestPlugin.md +++ b/docs/software/plugins/RangeTestPlugin.md @@ -63,6 +63,26 @@ Be sure to turn off either the plugin configured as a sender or the device where Also be mindful of your space usage on the file system. It has protections from filling up the space but it's best to delete old range test results. +# Application Examples + +## Google Earth Integration + +@jfirwin on our forum [meshtastic.discourse.org](https://meshtastic.discourse.group/t/new-plugin-rangetestplugin/2591/49?u=mc-hamster) shared how to integrate the resulting csv file with Google Earth. + +Steps: + +1. [Download](https://www.google.com/earth/versions/#download-pro) 1 and open Google Earth + 1. Select File > Import + 2. Select CSV + 3. Select Delimited, Comma + 4. Make sure the button that states “This dataset does not contain latitude/longitude information, but street addresses” is unchecked + 5. Select “rx lat” & “rx long” for the appropriate lat/lng fields + 6. Click finish +2. When it prompts you to create a style template, click yes. + 1. Set the name field to whichever column you want to be displayed on the map (don’t worry about this too much, when you click on an icon, all the relavant data appears) + 2. select a color, icon, etc. and hit ok. + +Your data will load onto the map, make sure to click the checkbox next to your dataset in the sidebar to view it. # Known Problems From 2b74260e2b056637bf620879dd7c6dd528c71301 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 20 Mar 2021 10:22:06 +0800 Subject: [PATCH 03/15] only show time on OLED if we have a valid UTC clock --- docs/software/TODO.md | 8 +++-- src/RedirectablePrint.cpp | 62 +++++++++++++++++----------------- src/gps/RTC.h | 6 +++- src/graphics/Screen.cpp | 71 ++++++++++++++++++++++++++------------- 4 files changed, 89 insertions(+), 58 deletions(-) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 7ffe9361f..a717c3f78 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -11,11 +11,15 @@ You probably don't care about this section - skip to the next one. * DONE channel sharing in android * DONE test 1.0 firmware update on android * DONE test 1.1 firmware update on android -* test 1.2.10 firmware update on android +* DONE test 1.2.10 firmware update on android * DONE test link sharing on android * luxon bug report - seeing rx acks for nodes that are not on the network * document how to do remote admin -* release py, android, device +* release py +* DONE show GPS time only if we know what global time is +* android should always provide time to nodes - so that it is easier for the mesh to learn the current time +* nrf52 should preserve local time across reset +* firmware OTA updates of is_router true nodes fails? ## 1.2 cleanup & multichannel support: diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp index 0bb2864e2..73600b327 100644 --- a/src/RedirectablePrint.cpp +++ b/src/RedirectablePrint.cpp @@ -1,58 +1,56 @@ #include "RedirectablePrint.h" +#include "RTC.h" #include "concurrency/OSThread.h" #include "configuration.h" #include #include #include -#include "RTC.h" /** * A printer that doesn't go anywhere */ NoopPrint noopPrint; -void RedirectablePrint::setDestination(Print *_dest) { - assert(_dest); - dest = _dest; +void RedirectablePrint::setDestination(Print *_dest) +{ + assert(_dest); + dest = _dest; } -size_t RedirectablePrint::write(uint8_t c) { - // Always send the characters to our segger JTAG debugger +size_t RedirectablePrint::write(uint8_t c) +{ + // Always send the characters to our segger JTAG debugger #ifdef SEGGER_STDOUT_CH SEGGER_RTT_PutChar(SEGGER_STDOUT_CH, c); #endif - dest->write(c); - return 1; // We always claim one was written, rather than trusting what the - // serial port said (which could be zero) + dest->write(c); + return 1; // We always claim one was written, rather than trusting what the + // serial port said (which could be zero) } size_t RedirectablePrint::vprintf(const char *format, va_list arg) { - va_list copy; - - va_copy(copy, arg); - int len = vsnprintf(printBuf, printBufLen, format, copy); - va_end(copy); - if (len < 0) { - va_end(arg); - return 0; - }; - if (len >= printBufLen) { - delete[] printBuf; - printBufLen *= 2; - printBuf = new char[printBufLen]; - len = vsnprintf(printBuf, printBufLen, format, arg); - } + va_list copy; - len = Print::write(printBuf, len); - return len; + va_copy(copy, arg); + int len = vsnprintf(printBuf, printBufLen, format, copy); + va_end(copy); + if (len < 0) { + va_end(arg); + return 0; + }; + if (len >= printBufLen) { + delete[] printBuf; + printBufLen *= 2; + printBuf = new char[printBufLen]; + len = vsnprintf(printBuf, printBufLen, format, arg); + } + + len = Print::write(printBuf, len); + return len; } -#define SEC_PER_DAY 86400 -#define SEC_PER_HOUR 3600 -#define SEC_PER_MIN 60 - size_t RedirectablePrint::logDebug(const char *format, ...) { size_t r = 0; @@ -70,7 +68,7 @@ size_t RedirectablePrint::logDebug(const char *format, ...) if (!isContinuationMessage) { uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityFromNet); if (rtc_sec > 0) { - long hms =rtc_sec % SEC_PER_DAY; + long hms = rtc_sec % SEC_PER_DAY; // hms += tz.tz_dsttime * SEC_PER_HOUR; // hms -= tz.tz_minuteswest * SEC_PER_MIN; // mod `hms` to ensure in positive range of [0...SEC_PER_DAY) @@ -102,5 +100,5 @@ size_t RedirectablePrint::logDebug(const char *format, ...) inDebugPrint = false; } - return r; + return r; } \ No newline at end of file diff --git a/src/gps/RTC.h b/src/gps/RTC.h index d6e8703ee..3a89d9810 100644 --- a/src/gps/RTC.h +++ b/src/gps/RTC.h @@ -27,4 +27,8 @@ uint32_t getTime(); /// Return time since 1970 in secs. If quality is RTCQualityNone return zero uint32_t getValidTime(RTCQuality minQuality); -void readFromRTC(); \ No newline at end of file +void readFromRTC(); + +#define SEC_PER_DAY 86400 +#define SEC_PER_HOUR 3600 +#define SEC_PER_MIN 60 \ No newline at end of file diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index e341aea0b..9698f41b1 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -28,11 +28,12 @@ along with this program. If not, see . #include "Screen.h" #include "configuration.h" #include "fonts.h" +#include "gps/RTC.h" #include "graphics/images.h" #include "main.h" #include "mesh-pb-constants.h" -#include "plugins/TextMessagePlugin.h" #include "mesh/Channels.h" +#include "plugins/TextMessagePlugin.h" #include "target_specific.h" #include "utils.h" @@ -155,24 +156,22 @@ static void drawPluginFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int { uint8_t plugin_frame; // there's a little but in the UI transition code - // where it invokes the function at the correct offset + // where it invokes the function at the correct offset // in the array of "drawScreen" functions; however, - // the passed-state doesn't quite reflect the "current" + // the passed-state doesn't quite reflect the "current" // screen, so we have to detect it. if (state->frameState == IN_TRANSITION && state->transitionFrameRelationship == INCOMING) { - // if we're transitioning from the end of the frame list back around to the first + // if we're transitioning from the end of the frame list back around to the first // frame, then we want this to be `0` plugin_frame = state->transitionFrameTarget; - } - else { + } else { // otherwise, just display the plugin frame that's aligned with the current frame plugin_frame = state->currentFrame; - //DEBUG_MSG("Screen is not in transition. Frame: %d\n\n", plugin_frame); + // DEBUG_MSG("Screen is not in transition. Frame: %d\n\n", plugin_frame); } - //DEBUG_MSG("Drawing Plugin Frame %d\n\n", plugin_frame); + // DEBUG_MSG("Drawing Plugin Frame %d\n\n", plugin_frame); MeshPlugin &pi = *pluginFrames.at(plugin_frame); - pi.drawFrame(display,state,x,y); - + pi.drawFrame(display, state, x, y); } static void drawFrameBluetooth(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) @@ -204,11 +203,10 @@ static void drawFrameFirmware(OLEDDisplay *display, OLEDDisplayUiState *state, i display->setFont(FONT_SMALL); display->drawString(64 + x, FONT_HEIGHT_SMALL + y + 2, "Please wait..."); - //display->setFont(FONT_LARGE); - //display->drawString(64 + x, 26 + y, btPIN); + // display->setFont(FONT_LARGE); + // display->drawString(64 + x, 26 + y, btPIN); } - /// Draw the last text message we received static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { @@ -793,7 +791,7 @@ void Screen::setup() powerStatusObserver.observe(&powerStatus->onNewStatus); gpsStatusObserver.observe(&gpsStatus->onNewStatus); nodeStatusObserver.observe(&nodeStatus->onNewStatus); - if(textMessagePlugin) + if (textMessagePlugin) textMessageObserver.observe(textMessagePlugin); } @@ -842,7 +840,7 @@ int32_t Screen::runOnce() break; case Cmd::START_FIRMWARE_UPDATE_SCREEN: handleStartFirmwareUpdateScreen(); - break; + break; case Cmd::STOP_BLUETOOTH_PIN_SCREEN: case Cmd::STOP_BOOT_SCREEN: setFrames(); @@ -936,7 +934,7 @@ void Screen::setFrames() for (auto i = pluginFrames.begin(); i != pluginFrames.end(); ++i) { normalFrames[numframes++] = drawPluginFrame; } - + DEBUG_MSG("Added plugins. numframes: %d\n", numframes); // If we have a critical fault, show it first @@ -1286,14 +1284,41 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat uint32_t minutes = seconds / 60; uint32_t hours = minutes / 60; uint32_t days = hours / 24; - currentMillis %= 1000; - seconds %= 60; - minutes %= 60; - hours %= 24; + // currentMillis %= 1000; + // seconds %= 60; + // minutes %= 60; + // hours %= 24; - display->drawString(x, y + FONT_HEIGHT_SMALL * 1, - String(days) + "d " + (hours < 10 ? "0" : "") + String(hours) + ":" + (minutes < 10 ? "0" : "") + - String(minutes) + ":" + (seconds < 10 ? "0" : "") + String(seconds)); + // Show uptime as days, hours, minutes OR seconds + String uptime; + if (days >= 2) + uptime += String(days) + "d "; + else if (hours >= 2) + uptime += String(hours) + "h "; + else if (minutes >= 1) + uptime += String(minutes) + "m "; + else + uptime += String(seconds) + "s "; + + uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityFromNet); + if (rtc_sec > 0) { + long hms = rtc_sec % SEC_PER_DAY; + // hms += tz.tz_dsttime * SEC_PER_HOUR; + // hms -= tz.tz_minuteswest * SEC_PER_MIN; + // mod `hms` to ensure in positive range of [0...SEC_PER_DAY) + hms = (hms + SEC_PER_DAY) % SEC_PER_DAY; + + // Tear apart hms into h:m:s + int hour = hms / SEC_PER_HOUR; + int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN; + int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN + + char timebuf[9]; + snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", hour, min, sec); + uptime += timebuf; + } + + display->drawString(x, y + FONT_HEIGHT_SMALL * 1, uptime); #ifndef NO_ESP32 // Show CPU Frequency. From 4666c125474c4e1bca1daf22f9e7672320950adf Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 20 Mar 2021 13:13:39 +0800 Subject: [PATCH 04/15] change android-too-old webpage to be less scary --- docs/software/TODO.md | 5 +++-- docs/software/android-too-old.md | 10 ++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index a717c3f78..29a28758d 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -15,7 +15,7 @@ You probably don't care about this section - skip to the next one. * DONE test link sharing on android * luxon bug report - seeing rx acks for nodes that are not on the network * document how to do remote admin -* release py +* DONE release py * DONE show GPS time only if we know what global time is * android should always provide time to nodes - so that it is easier for the mesh to learn the current time * nrf52 should preserve local time across reset @@ -81,8 +81,9 @@ You probably don't care about this section - skip to the next one. * restrict gpio & serial & settings operations to the admin channel (unless local to the current node) * add channel restrictions for plugins (and restrict routing plugin to the "control" channel) * stress test multi channel -* investigate @mc-hamster report of heap corruption +* DONE investigate @mc-hamster report of heap corruption * DONE use set-user from android +* untrusted users should not be allowed to provide bogus times (via position broadcasts) to the rest of the mesh. Invent a new lowest quality notion of UntrustedTime. * generalize the concept of "shortstrings" use it for both PSKs and well known channel names. Possibly use a ShortString class. * use portuino TCP connection to debug with python API * document the relationship between want_response (indicating remote node received it) and want_ack (indicating that this message should be sent reliably - and also get acks from the first rx node and naks if it is never delivered) diff --git a/docs/software/android-too-old.md b/docs/software/android-too-old.md index 4f0c2403b..ca2041e25 100644 --- a/docs/software/android-too-old.md +++ b/docs/software/android-too-old.md @@ -2,12 +2,6 @@ Hi. -If you've landed here that means your android application is too old for the running device firmware. Usually our updates are backwards compatible, but in this special circumstance it is not. Sorry. +If you've landed here that means your android application is too old for the running device firmware. Usually our updates are backwards compatible, but about once a year we have a "major protocol update" which requires all apps and devices to update to keep working with that version. Version 1.2 in March 2021 was one of those updates. -Probably, what this means is that you installed the **alpha test** version of the firmware from github. We really love people helping with development by running the alpha test binaries. But if you aren't ready to sign up for that right now, please go back to [github](https://github.com/meshtastic/Meshtastic-device/releases) and install the latest **not alpha** 1.1.x firmware. - -If you **do** intend to run the alpha test please [opt-in](https://play.google.com/apps/testing/com.geeksville.mesh) to receive the alpha test version of the android application. - -If you are willing to be an alpha tester, please keep an eye on our forum where we post frequent release notes. We also will actively help you with any bugs you might encounter (along our shared journey of new feature goodness). - -If you have problems/questions please post in our [forum](https://meshtastic.discourse.group) and some nice person will probably help. \ No newline at end of file +If you have problems/questions please post in our [forum](https://meshtastic.discourse.group) and some nice person will probably help. From d652664126cc687d348aa2d8a2616b7af0012270 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 20 Mar 2021 13:35:27 +0800 Subject: [PATCH 05/15] TODO updates --- docs/software/TODO.md | 122 ++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/docs/software/TODO.md b/docs/software/TODO.md index 29a28758d..aff62aaa8 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,6 +4,8 @@ You probably don't care about this section - skip to the next one. ## before next release +* document how to do remote admin +* firmware OTA updates of is_router true nodes fails? * DONE timestamps on oled screen are wrong - don't seem to be updating based on message rx (actually: this is expected behavior when no node on the mesh has GPS time) * DONE add ch-del * DONE channel hash suffixes are wrong on android @@ -13,23 +15,21 @@ You probably don't care about this section - skip to the next one. * DONE test 1.1 firmware update on android * DONE test 1.2.10 firmware update on android * DONE test link sharing on android -* luxon bug report - seeing rx acks for nodes that are not on the network -* document how to do remote admin +* FIXED? luxon bug report - seeing rx acks for nodes that are not on the network * DONE release py * DONE show GPS time only if we know what global time is -* android should always provide time to nodes - so that it is easier for the mesh to learn the current time -* nrf52 should preserve local time across reset -* firmware OTA updates of is_router true nodes fails? - -## 1.2 cleanup & multichannel support: +* DONE android should always provide time to nodes - so that it is easier for the mesh to learn the current time + +## MQTT + +## Multichannel support * DONE cleanup the external notification and serial plugins * non ack version of stress test fails sometimes! - -* tx fault test has a bug #734 +* tx fault test has a bug #734 - * turn off fault 8: https://github.com/meshtastic/Meshtastic-device/issues/734 * DONE move device types into an enum in nodeinfo -* fix android to use new device types for firmware update - +* DONE fix android to use new device types for firmware update +* nrf52 should preserve local time across reset * cdcacm bug on nrf52: emittx thinks it emitted but client sees nothing. works again later * nrf52: segger logs have errors in formatting that should be impossible (because not going through serial, try stalling on segger) * DONE call RouterPlugin for *all* packets - not just Router packets @@ -57,12 +57,11 @@ You probably don't care about this section - skip to the next one. * DONE release protobufs * DONE release to developers * DONE fix setch-fast in python tool -* turn off fault 8: https://github.com/meshtastic/Meshtastic-device/issues/734 * age out pendingrequests in the python API * DONE stress test channel download from python, sometimes it seems like we don't get all replies, bug was due to simultaneous android connection * DONE combine acks and responses in a single message if possible (do routing plugin LAST and drop ACK if someone else has already replied) * DONE don't send packets we received from the phone BACK TOWARDS THE PHONE (possibly use fromnode 0 for packets the phone sends?) -* fix 1.1.50 android debug panel display +* DONE fix 1.1.50 android debug panel display * DONE test android channel setting * DONE release to users * DONE warn in android app about unset regions @@ -71,20 +70,20 @@ You probably don't care about this section - skip to the next one. * DONE clean up python channel usage * DONE use bindToChannel to limit admin access for remote nodes * DONE move channels and radio config out of device settings -* test remote info and remote settings changes +* DONE test remote info and remote settings changes * make python tests more exhaustive -* pick default random admin key +* DONE pick default random admin key * exclude admin channels from URL? * make a way to share just secondary channels via URL -* use single byte 'well known' channel names for the four default channel names (longslow etc), and for admin, gpio, etc... +* generalize the concept of "shortstrings" use it for both PSKs and well known channel names. Possibly use a ShortString class. +* use single byte 'well known' channel names for admin, gpio, etc... * use presence of gpio channel to enable gpio ops, same for serial etc... -* restrict gpio & serial & settings operations to the admin channel (unless local to the current node) -* add channel restrictions for plugins (and restrict routing plugin to the "control" channel) +* DONE restrict gpio & serial & settings operations to the admin channel (unless local to the current node) +* DONE add channel restrictions for plugins (and restrict routing plugin to the "control" channel) * stress test multi channel * DONE investigate @mc-hamster report of heap corruption * DONE use set-user from android * untrusted users should not be allowed to provide bogus times (via position broadcasts) to the rest of the mesh. Invent a new lowest quality notion of UntrustedTime. -* generalize the concept of "shortstrings" use it for both PSKs and well known channel names. Possibly use a ShortString class. * use portuino TCP connection to debug with python API * document the relationship between want_response (indicating remote node received it) and want_ack (indicating that this message should be sent reliably - and also get acks from the first rx node and naks if it is never delivered) * DONE android should stop fetching channels once we've reached our first empty channel definition (hasSettings == true) @@ -96,18 +95,21 @@ You probably don't care about this section - skip to the next one. * allow chaning packets in single transmission - to increase airtime efficiency and amortize packet overhead * DONE move most parts of meshpacket into the Data packet, so that we can chain multiple Data for sending when they all have a common destination and key. * when selecting a MeshPacket for transmit, scan the TX queue for any Data packets we can merge together as a WirePayload. In the low level send/rx code expand that into multiple MeshPackets as needed (thus 'hiding' from MeshPacket that over the wire we send multiple datapackets -* confirm we are still calling the plugins for messages inbound from the phone (or generated locally) -* confirm we are still multi hop routing flood broadcasts -* confirm we are still doing resends on unicast reliable packets +* DONE confirm we are still calling the plugins for messages inbound from the phone (or generated locally) +* DONE confirm we are still multi hop routing flood broadcasts +* DONE confirm we are still doing resends on unicast reliable packets * add history to routed packets: https://meshtastic.discourse.group/t/packet-source-tracking/2764/2 * add support for full DSR unicast delivery * DONE move acks into routing * DONE make all subpackets different versions of data * DONE move routing control into a data packet * have phoneapi done via plugin (will allow multiple simultaneous API clients - stop disabling BLE while using phone API) +* use reference counting and dynamic sizing for meshpackets. +* let multiple PhoneAPI endpoints work at once +* allow multiple simultaneous bluetooth connections (create the bluetooth phoneapi instance dynamically based on client id) * DONE figure out how to add micro_delta to position, make it so that phone apps don't need to understand it? * only send battery updates a max of once a minute -* add python channel selection for sending +* DONE add python channel selection for sending * DONE record recevied channel in meshpacket * test remote settings operations (confirm it works 3 hops away) * DONE make a primaryChannel global and properly maintain it when the phone sends setChannel @@ -118,42 +120,6 @@ You probably don't care about this section - skip to the next one. are allowed on any channel (this lets the local user do anything)." Probably by adding a "secure_local_interface" settings bool. * DOUBLE CHECK android app can still upgrade 1.1 and 1.0 loads -eink: - -* DONE check email of reported issues -* DONE turn off vbus driving (in bootloader) -* new battery level sensing -* current draw no good -* DONE: fix backlight -* DONE - USB is busted because of power enable mode? -* test CPU voltage? something is bad with RAM (removing eink module does not help) -* test that board leaves bootloader always -* test USB - works in bootloader -* test LEDs -* Test BME280 -* test gps -* check GPS fast locking -* tested! dlora -* test eink backlight -* tested! eink -* test buttons -* test battery charging -* test serial flash -* send updated app and bootloader image -* OHH BME280! THAT IS GREAT! -* make new screen work, ask for datasheet -* say I think you could ship this -* leds seem busted -* fix hw_model: "nrf52unknown" -* use larger icon for meshtastic logo -* send email about variants & faster flash programming - https://github.com/geeksville/Meshtastic-esp32/commit/f110225173a77326aac029321cdb6491bfa640f6 -* send PR for bootloader -* fix nrf52 time/date -* send new master bin file -* send email about low power mode problems -* support new flash chip in appload, possibly use low power mode -* swbug! stuck busy tx occurred! - For app cleanup: * use structured logging to kep logs in ram. Also send logs as packets to api clients @@ -205,6 +171,44 @@ This should nicely help 'router' nodes do the right thing when long range, or if * turn on amazon reviews support * add a tablet layout (with map next to messages) in the android app +# Completed + +## eink 1.0 + +* DONE check email of reported issues +* DONE turn off vbus driving (in bootloader) +* new battery level sensing +* current draw no good +* DONE: fix backlight +* DONE - USB is busted because of power enable mode? +* test CPU voltage? something is bad with RAM (removing eink module does not help) +* test that board leaves bootloader always +* test USB - works in bootloader +* test LEDs +* Test BME280 +* test gps +* check GPS fast locking +* tested! dlora +* test eink backlight +* tested! eink +* test buttons +* test battery charging +* test serial flash +* send updated app and bootloader image +* OHH BME280! THAT IS GREAT! +* make new screen work, ask for datasheet +* say I think you could ship this +* leds seem busted +* fix hw_model: "nrf52unknown" +* use larger icon for meshtastic logo +* send email about variants & faster flash programming - https://github.com/geeksville/Meshtastic-esp32/commit/f110225173a77326aac029321cdb6491bfa640f6 +* send PR for bootloader +* fix nrf52 time/date +* send new master bin file +* send email about low power mode problems +* support new flash chip in appload, possibly use low power mode +* swbug! stuck busy tx occurred! + # Old docs to merge MESH RADIO PROTOCOL From dd9beff9a5d7b500c451a420e3e81ea312bbbc4f Mon Sep 17 00:00:00 2001 From: Jm Date: Fri, 19 Mar 2021 23:34:36 -0700 Subject: [PATCH 06/15] Script to publish nightly builds. --- bin/build-nightly.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/build-nightly.sh diff --git a/bin/build-nightly.sh b/bin/build-nightly.sh new file mode 100755 index 000000000..cd545c7fb --- /dev/null +++ b/bin/build-nightly.sh @@ -0,0 +1,37 @@ +#!/bin/bash +source ~/.bashrc + +# Meshtastic Nightly Build Script. +# McHamster (jm@casler.org) +# +# This is the script that is used for the nightly build server. +# +# It's probably not useful for most people, but you may want to run your own +# nightly builds. +# +# The last line of ~/.bashrc contains an inclusion of platformio in the path. +# Without this, the build script won't run from the crontab: +# +# export PATH="$HOME/.platformio/penv/bin:$PATH" +# +# The crontab contains: +# 0 2 * * * cd ~/meshtastic/github/meshtastic && source "~/.bashrc"; ./build-nightly.sh > ~/cronout.txt 2> ~/cronout.txt + +cd Meshtastic-device + +git pull + +bin/build-all.sh + +date_stamp=$(date +'%Y-%m-%d') + +cd .. + +# TODO: Archive the same binaries used by the build-all script. +zip -r meshtastic_device_nightly_${date_stamp} Meshtastic-device/release/latest/bins + +# Copy the file to the webserver +scp meshtastic_device_nightly_${date_stamp}.zip jm@10.11.12.20:/volume1/web/meshtastic/nightly_builds/ + +# Delete the local copy +rm meshtastic_device_nightly_${date_stamp}.zip From b357d8ae5b1ed40928c2ef22869980b5aaf43d82 Mon Sep 17 00:00:00 2001 From: Jm Date: Fri, 19 Mar 2021 23:35:46 -0700 Subject: [PATCH 07/15] Update RangeTestPlugin.md --- docs/software/plugins/RangeTestPlugin.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/software/plugins/RangeTestPlugin.md b/docs/software/plugins/RangeTestPlugin.md index 4915016c3..79b4ddcd7 100644 --- a/docs/software/plugins/RangeTestPlugin.md +++ b/docs/software/plugins/RangeTestPlugin.md @@ -65,9 +65,11 @@ Also be mindful of your space usage on the file system. It has protections from # Application Examples -## Google Earth Integration +## Google Integration -@jfirwin on our forum [meshtastic.discourse.org](https://meshtastic.discourse.group/t/new-plugin-rangetestplugin/2591/49?u=mc-hamster) shared how to integrate the resulting csv file with Google Earth. +@jfirwin on our forum [meshtastic.discourse.org](https://meshtastic.discourse.group/t/new-plugin-rangetestplugin/2591/49?u=mc-hamster) shared how to integrate the resulting csv file with Google Products. + +### Earth Steps: @@ -84,6 +86,14 @@ Steps: Your data will load onto the map, make sure to click the checkbox next to your dataset in the sidebar to view it. +### My Maps + +You can use [My Maps](http://mymaps.google.com/). It takes CSVs and the whole interface is much easier to work with. + +Google has instructions on how to do that [here](https://support.google.com/mymaps/answer/3024836?co=GENIE.Platform%3DDesktop&hl=en#zippy=%2Cstep-prepare-your-info%2Cstep-import-info-into-the-map). + +You can style the ranges differently based on the values, so you can have the pins be darker the if the SNR or RSSI (if that gets added) is higher. + # Known Problems * If turned on, using mesh network will become unwieldly because messages are sent over the same channel as the other messages. See TODO below. From 0ce7a3f0ec17eb38bc7bc6bb84e814fa0eac5f04 Mon Sep 17 00:00:00 2001 From: Jm Date: Fri, 19 Mar 2021 23:43:06 -0700 Subject: [PATCH 08/15] Update to how S&F reserves space on PSRAM --- src/plugins/esp32/StoreForwardPlugin.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index 1726a0b27..e5694caa3 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -231,6 +231,10 @@ bool StoreForwardPlugin::handleReceived(const MeshPacket &mp) DEBUG_MSG("Packet came from - PortNum_POSITION_APP\n"); } else if (mp.decoded.portnum == PortNum_NODEINFO_APP) { DEBUG_MSG("Packet came from - PortNum_NODEINFO_APP\n"); + } else if (mp.decoded.portnum == PortNum_ROUTING_APP) { + DEBUG_MSG("Packet came from - PortNum_ROUTING_APP\n"); + } else if (mp.decoded.portnum == PortNum_ADMIN_APP) { + DEBUG_MSG("Packet came from - PortNum_ADMIN_APP\n"); } else if (mp.decoded.portnum == PortNum_REPLY_APP) { DEBUG_MSG("Packet came from - PortNum_REPLY_APP\n"); } else if (mp.decoded.portnum == PortNum_IP_TUNNEL_APP) { @@ -276,40 +280,34 @@ StoreForwardPlugin::StoreForwardPlugin() Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. + */ radioConfig.preferences.store_forward_plugin_enabled = 1; radioConfig.preferences.is_router = 1; - */ if (radioConfig.preferences.store_forward_plugin_enabled) { + + // Router if (radioConfig.preferences.is_router) { DEBUG_MSG("Initializing Store & Forward Plugin - Enabled as Router\n"); - // Router if (ESP.getPsramSize()) { - if (ESP.getFreePsram() >= 2048 * 1024) { + if (ESP.getFreePsram() >= 1024 * 1024) { + // Do the startup here this->populatePSRAM(); - - // packetHistory[0].bytes; - // return (10 * 1000); - } else { - DEBUG_MSG("Device has less than 2M of PSRAM free. Aborting startup.\n"); + DEBUG_MSG("Device has less than 1M of PSRAM free. Aborting startup.\n"); DEBUG_MSG("Store & Forward Plugin - Aborting Startup.\n"); - - // return (INT32_MAX); } } else { DEBUG_MSG("Device doesn't have PSRAM.\n"); DEBUG_MSG("Store & Forward Plugin - Aborting Startup.\n"); - - // return (INT32_MAX); } + // Client } else { DEBUG_MSG("Initializing Store & Forward Plugin - Enabled as Client\n"); - // return (5 * 1000); } } #endif From baeb0022458bd0e5372c6b32a79f2eb5c5200679 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 20 Mar 2021 00:38:53 -0700 Subject: [PATCH 09/15] Fix small bug in range test plugin. packetSequence was an unsigned int but i was using %d. oops --- proto | 2 +- src/plugins/esp32/RangeTestPlugin.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proto b/proto index b8c0499f2..94bd0aae4 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit b8c0499f28f9673d1df17d04da562e30703f01cb +Subproject commit 94bd0aae44e2c16c7776289225c804100c856cd4 diff --git a/src/plugins/esp32/RangeTestPlugin.cpp b/src/plugins/esp32/RangeTestPlugin.cpp index 2332b687a..35d39714e 100644 --- a/src/plugins/esp32/RangeTestPlugin.cpp +++ b/src/plugins/esp32/RangeTestPlugin.cpp @@ -35,9 +35,9 @@ int32_t RangeTestPlugin::runOnce() without having to configure it from the PythonAPI or WebUI. */ - //radioConfig.preferences.range_test_plugin_enabled = 1; - //radioConfig.preferences.range_test_plugin_sender = 45; - //radioConfig.preferences.range_test_plugin_save = 1; + // radioConfig.preferences.range_test_plugin_enabled = 1; + // radioConfig.preferences.range_test_plugin_sender = 45; + // radioConfig.preferences.range_test_plugin_save = 1; // Fixed position is useful when testing indoors. // radioConfig.preferences.fixed_position = 1; @@ -112,7 +112,7 @@ void RangeTestPluginRadio::sendPayload(NodeNum dest, bool wantReplies) packetSequence++; static char heartbeatString[20]; - snprintf(heartbeatString, sizeof(heartbeatString), "seq %d", packetSequence); + snprintf(heartbeatString, sizeof(heartbeatString), "seq %u", packetSequence); p->decoded.payload.size = strlen(heartbeatString); // You must specify how many bytes are in the reply memcpy(p->decoded.payload.bytes, heartbeatString, p->decoded.payload.size); @@ -290,7 +290,7 @@ bool RangeTestPluginRadio::appendFile(const MeshPacket &mp) fileToAppend.printf("??:??:??,"); // Time } - fileToAppend.printf("%d,", getFrom(&mp)); // From + fileToAppend.printf("%d,", getFrom(&mp)); // From fileToAppend.printf("%s,", n->user.long_name); // Long Name fileToAppend.printf("%f,", n->position.latitude_i * 1e-7); // Sender Lat fileToAppend.printf("%f,", n->position.longitude_i * 1e-7); // Sender Long From 103ffde025f7d4faf7cfddab581fcac7b883595f Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 20 Mar 2021 20:47:48 -0700 Subject: [PATCH 10/15] Fixes for build of tlora_v1_3 --- platformio.ini | 7 +++++++ src/configuration.h | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index f2142b8e4..519da9c31 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,6 +13,7 @@ default_envs = tbeam ;default_envs = tbeam0.7 ;default_envs = heltec ;default_envs = tlora-v1 +;default_envs = tlora_v1_3 ;default_envs = tlora-v2 ;default_envs = lora-relay-v1 # nrf board ;default_envs = eink @@ -158,6 +159,12 @@ build_flags = ${esp32_base.build_flags} -D TLORA_V1 ; note: the platformio definition for lora32-v2 seems stale, it is missing a pins_arduino.h file, therefore I don't think it works +[env:tlora_v1_3] +extends = esp32_base +board = ttgo-lora32-v1 +build_flags = + ${esp32_base.build_flags} -D TLORA_V1_3 + [env:tlora-v2] extends = esp32_base board = ttgo-lora32-v1 diff --git a/src/configuration.h b/src/configuration.h index 3d4fb652d..0299b8fed 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -311,7 +311,7 @@ along with this program. If not, see . #elif defined(TLORA_V1_3) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR HardwareModel_TLORA_V1p3 +#define HW_VENDOR HardwareModel_TLORA_V1_1p3 #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -459,8 +459,6 @@ along with this program. If not, see . #define DEBUG_PORT console // Serial debug port - - // What platforms should use SEGGER? #ifdef NRF52_SERIES From e9faf657dfa907bc67721cc1306fcdee5fdfe060 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 21 Mar 2021 18:58:43 +0800 Subject: [PATCH 11/15] move GPS_RX_PIN for the TLORA_V2_1_16 from 36 to 15 --- src/configuration.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 3d4fb652d..5fc9adf48 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -342,7 +342,7 @@ along with this program. If not, see . #undef GPS_RX_PIN #undef GPS_TX_PIN -#define GPS_RX_PIN 36 +#define GPS_RX_PIN 15 // per @der_bear on the forum, 36 is incorrect for this board type and 15 is a better pick #define GPS_TX_PIN 13 #define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage @@ -459,8 +459,6 @@ along with this program. If not, see . #define DEBUG_PORT console // Serial debug port - - // What platforms should use SEGGER? #ifdef NRF52_SERIES From da732c291f85be4c32cd020304eae8e32d601cbd Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 21 Mar 2021 07:43:55 -0700 Subject: [PATCH 12/15] Update build-all for tlora_v1_3 --- bin/build-all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 1e2f159bb..3f52db901 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -4,7 +4,7 @@ set -e VERSION=`bin/buildinfo.py` -BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7" +BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec tbeam0.7" #BOARDS_ESP32=tbeam # FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine From a74384f3f56bcf6967c8e40bec588a3579090803 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 21 Mar 2021 07:44:08 -0700 Subject: [PATCH 13/15] Update airtime.h to add override --- src/airtime.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/airtime.h b/src/airtime.h index d78db86a4..134bad47d 100644 --- a/src/airtime.h +++ b/src/airtime.h @@ -47,8 +47,7 @@ class AirTime : private concurrency::OSThread void logAirtime(reportTypes reportType, uint32_t airtime_ms); protected: - - virtual int32_t runOnce(); + virtual int32_t runOnce() override; }; extern AirTime *airTime; \ No newline at end of file From 4ebc07b691c8575f20398fac25b7ba955a7a7747 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 21 Mar 2021 09:42:55 -0700 Subject: [PATCH 14/15] Update nightly build to use the same release build archive for the nightly --- bin/build-nightly.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/build-nightly.sh b/bin/build-nightly.sh index cd545c7fb..de31c6ed1 100755 --- a/bin/build-nightly.sh +++ b/bin/build-nightly.sh @@ -28,7 +28,8 @@ date_stamp=$(date +'%Y-%m-%d') cd .. # TODO: Archive the same binaries used by the build-all script. -zip -r meshtastic_device_nightly_${date_stamp} Meshtastic-device/release/latest/bins +#zip -r meshtastic_device_nightly_${date_stamp} Meshtastic-device/release/latest/bins +cp Meshtastic-device/release/archive/`ls -t ./Meshtastic-device/release/archive/| head -1` meshtastic_device_nightly_${date_stamp}.zip # Copy the file to the webserver scp meshtastic_device_nightly_${date_stamp}.zip jm@10.11.12.20:/volume1/web/meshtastic/nightly_builds/ From 13889124c1d5655c30f46d3bea6fc9c2e0588eeb Mon Sep 17 00:00:00 2001 From: Tim Gunter Date: Sun, 21 Mar 2021 18:29:20 -0700 Subject: [PATCH 15/15] Add option to set python interpreter used for device-install.sh and device-update.sh --- bin/device-install.sh | 19 ++++++++++++------- bin/device-update.sh | 15 ++++++++++----- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/bin/device-install.sh b/bin/device-install.sh index 3d5f27af8..0adfc575d 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -1,21 +1,24 @@ #!/bin/sh +PYTHON=${PYTHON:-python} + set -e # Usage info show_help() { cat << EOF -Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-f FILENAME] +Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] Flash image file to device, but first erasing and writing system information" -h Display this help and exit -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). - -f FILENAME The .bin file to flash. Custom to your device type and region. + -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON") + -f FILENAME The .bin file to flash. Custom to your device type and region. EOF } -while getopts ":h:p:f:" opt; do +while getopts ":hp:P:f:" opt; do case "${opt}" in h) show_help @@ -23,6 +26,8 @@ while getopts ":h:p:f:" opt; do ;; p) export ESPTOOL_PORT=${OPTARG} ;; + P) PYTHON=${OPTARG} + ;; f) FILENAME=${OPTARG} ;; *) @@ -36,10 +41,10 @@ shift "$((OPTIND-1))" if [ -f "${FILENAME}" ]; then echo "Trying to flash ${FILENAME}, but first erasing and writing system information" - esptool.py --baud 921600 erase_flash - esptool.py --baud 921600 write_flash 0x1000 system-info.bin - esptool.py --baud 921600 write_flash 0x00390000 spiffs-*.bin - esptool.py --baud 921600 write_flash 0x10000 ${FILENAME} + $PYTHON -m esptool --baud 921600 erase_flash + $PYTHON -m esptool --baud 921600 write_flash 0x1000 system-info.bin + $PYTHON -m esptool --baud 921600 write_flash 0x00390000 spiffs-*.bin + $PYTHON -m esptool --baud 921600 write_flash 0x10000 ${FILENAME} else echo "Invalid file: ${FILENAME}" show_help diff --git a/bin/device-update.sh b/bin/device-update.sh index 894230364..ec0e839d7 100755 --- a/bin/device-update.sh +++ b/bin/device-update.sh @@ -1,19 +1,22 @@ #!/bin/sh +PYTHON=${PYTHON:-python} + # Usage info show_help() { cat << EOF -Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] -f FILENAME +Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-P PYTHON] -f FILENAME Flash image file to device, leave existing system intact." -h Display this help and exit -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). - -f FILENAME The .bin file to flash. Custom to your device type and region. + -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON") + -f FILENAME The .bin file to flash. Custom to your device type and region. EOF } -while getopts ":h:p:f:" opt; do +while getopts ":hp:P:f:" opt; do case "${opt}" in h) show_help @@ -21,6 +24,8 @@ while getopts ":h:p:f:" opt; do ;; p) export ESPTOOL_PORT=${OPTARG} ;; + P) PYTHON=${OPTARG} + ;; f) FILENAME=${OPTARG} ;; *) @@ -34,9 +39,9 @@ shift "$((OPTIND-1))" if [ -f "${FILENAME}" ]; then echo "Trying to flash update ${FILENAME}." - esptool.py --baud 921600 write_flash 0x10000 ${FILENAME} + $PYTHON -m esptool --baud 921600 write_flash 0x10000 ${FILENAME} echo "Erasing the otadata partition, which will turn off flash flippy-flop and force the first image to be used" - esptool.py --baud 921600 erase_region 0xe000 0x2000 + $PYTHON -m esptool --baud 921600 erase_region 0xe000 0x2000 else echo "Invalid file: ${FILENAME}" show_help