diff --git a/README.md b/README.md index 8224afeb..671c1791 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,43 @@ # Meshtastic-esp32 -This is the device side code for the [meshtastic.org](https://www.meshtastic.org) project. + +This is the device side code for the [meshtastic.org](https://www.meshtastic.org) project. ![Continuous Integration](https://github.com/meshtastic/Meshtastic-esp32/workflows/Continuous%20Integration/badge.svg) Meshtastic is a project that lets you use -inexpensive GPS mesh radios as an extensible, super long battery life mesh GPS communicator. These radios are great for hiking, skiing, paragliding - -essentially any hobby where you don't have reliable internet access. Each member of your private mesh can always see the location and distance of all other +inexpensive GPS mesh radios as an extensible, super long battery life mesh GPS communicator. These radios are great for hiking, skiing, paragliding - +essentially any hobby where you don't have reliable internet access. Each member of your private mesh can always see the location and distance of all other members and any text messages sent to your group chat. -The radios automatically create a mesh to forward packets as needed, so everyone in the group can receive messages from even the furthest member. The radios +The radios automatically create a mesh to forward packets as needed, so everyone in the group can receive messages from even the furthest member. The radios will optionally work with your phone, but no phone is required. Typical time between recharging the radios should be about eight days. This project is currently early-alpha, but if you have questions please [join our discussion forum](https://meshtastic.discourse.group/). -This software is 100% open source and developed by a group of hobbyist experimenters. No warranty is provided, if you'd like to improve it - we'd love your help. Please post in the chat. +This software is 100% open source and developed by a group of hobbyist experimenters. No warranty is provided, if you'd like to improve it - we'd love your help. Please post in the chat. ## Supported hardware -We currently support three models of radios. The [TTGO T-Beam](https://www.aliexpress.com/item/4000119152086.html), [TTGO LORA32](https://www.banggood.com/LILYGO-TTGO-LORA32-868Mhz-SX1276-ESP32-Oled-Display-bluetooth-WIFI-Lora-Development-Module-Board-p-1248652.html?cur_warehouse=UK) and the [Heltec LoRa 32](https://heltec.org/project/wifi-lora-32/). Most users should buy the T-Beam and a 18650 battery (total cost less than $35). Make -sure to buy the frequency range which is legal for your country. For the USA, you should buy the 915MHz version. Getting a version that include a screen + +We currently support three models of radios. The [TTGO T-Beam](https://www.aliexpress.com/item/4000119152086.html), [TTGO LORA32](https://www.banggood.com/LILYGO-TTGO-LORA32-868Mhz-SX1276-ESP32-Oled-Display-bluetooth-WIFI-Lora-Development-Module-Board-p-1248652.html?cur_warehouse=UK) and the [Heltec LoRa 32](https://heltec.org/project/wifi-lora-32/). Most users should buy the T-Beam and a 18650 battery (total cost less than \$35). Make +sure to buy the frequency range which is legal for your country. For the USA, you should buy the 915MHz version. Getting a version that include a screen is optional, but highly recommended. See (meshtastic.org) for 3D printable cases. ## Installing the firmware -Prebuilt binaries for the supported radios is available in our [releases](https://github.com/meshtastic/Meshtastic-esp32/releases). Your initial installation has to happen over USB from your Mac, Windows or Linux PC. Once our software is installed, all future software updates happen over bluetooth from your phone. -The instructions currently require a few commmand lines, but it should be pretty straightforward. Please post comments on our group chat if you have problems or successes. Steps to install: +Prebuilt binaries for the supported radios is available in our [releases](https://github.com/meshtastic/Meshtastic-esp32/releases). Your initial installation has to happen over USB from your Mac, Windows or Linux PC. Once our software is installed, all future software updates happen over bluetooth from your phone. + +The instructions currently require a few commmand lines, but it should be pretty straightforward. Please post comments on our group chat if you have problems or successes. Steps to install: 1. Purchase a radio (see above) with the correct frequencies for your country (915MHz for US or JP, 470MHz for CN, 433MHz and 870MHz for EU). -2. Install "pip". Pip is the python package manager we use to get the esptool installer app. Instructions [here](https://www.makeuseof.com/tag/install-pip-for-python/). +2. Install "pip". Pip is the python package manager we use to get the esptool installer app. Instructions [here](https://www.makeuseof.com/tag/install-pip-for-python/). 3. Run "pip install --upgrade esptool" to get esptool installed on your machine 4. Connect your radio to your USB port -5. Confirm that your device is talking to your PC by running "esptool.py chip_id". The Heltec build also works on the TTGO LORA32 radio. You should see something like: +5. Confirm that your device is talking to your PC by running "esptool.py chip_id". The Heltec build also works on the TTGO LORA32 radio. You should see something like: + ``` mydir$ esptool.py chip_id esptool.py v2.6 @@ -51,14 +55,16 @@ Warning: ESP32 has no Chip ID. Reading MAC instead. MAC: 24:6f:28:b5:36:71 Hard resetting via RTS pin... ``` -6. cd into the directory where the release zip file was expanded. -7. Install the correct firmware for your board with "device-install.sh firmware-_board_-_country_.bin". For instance "./device-install.sh firmware-HELTEC-US-0.0.3.bin". -Note: If you have previously installed meshtastic, you don't need to run this full script instead just run "esptool.py --baud 921600 write_flash 0x10000 firmware-_board_-_country_.bin". This will be faster, also all of your current preferences will be preserved. +6. cd into the directory where the release zip file was expanded. +7. Install the correct firmware for your board with "device-install.sh firmware-_board_-_country_.bin". For instance "./device-install.sh firmware-HELTEC-US-0.0.3.bin". + +Note: If you have previously installed meshtastic, you don't need to run this full script instead just run "esptool.py --baud 921600 write*flash 0x10000 firmware-\_board*-_country_.bin". This will be faster, also all of your current preferences will be preserved. You should see something like this: + ``` -kevinh@kevin-server:~/development/meshtastic/meshtastic-esp32/release/latest$ ./device-install.sh firmware-TBEAM-US-0.1.8.bin +kevinh@kevin-server:~/development/meshtastic/meshtastic-esp32/release/latest$ ./device-install.sh firmware-TBEAM-US-0.1.8.bin Trying to flash firmware-TBEAM-US-0.1.8.bin, but first erasing and writing system information esptool.py v2.6 Found 2 serial ports @@ -120,29 +126,32 @@ Hash of data verified. Leaving... Hard resetting via RTS pin... ``` + 8. The board will boot and show the Meshtastic logo. -9. Please post a comment on our chat so we know if these instructions worked for you ;-). If you find bugs/have-questions post there also - we will be rapidly iterating over the next few weeks. +9. Please post a comment on our chat so we know if these instructions worked for you ;-). If you find bugs/have-questions post there also - we will be rapidly iterating over the next few weeks. ## Meshtastic Android app -The source code for the (optional) Meshtastic Android app is [here](https://github.com/meshtastic/Meshtastic-Android). -Alpha test builds are current available by opting into our alpha test group. See (www.meshtastic.org) for instructions. +The source code for the (optional) Meshtastic Android app is [here](https://github.com/meshtastic/Meshtastic-Android). + +Alpha test builds are current available by opting into our alpha test group. See (www.meshtastic.org) for instructions. After our rate of change slows a bit, we will make beta builds available here (without needing to join the alphatest group): [![Download at https://play.google.com/store/apps/details?id=com.geeksville.mesh](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub%26utm_medium%3Desp32-readme%26utm_campaign%3Dmeshtastic-esp32%2520readme%26anid%3Dadmob&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1) # Development -We'd love to have you join us on this merry little project. Please see our [development documents](./docs/software/sw-design.md) and [join us in our discussion forum](https://meshtastic.discourse.group/). +We'd love to have you join us on this merry little project. Please see our [development documents](./docs/software/sw-design.md) and [join us in our discussion forum](https://meshtastic.discourse.group/). # Credits -This project is run by volunteers. Past contributors include: +This project is run by volunteers. Past contributors include: -* @astro-arphid: Added support for 433MHz radios in europe. -* @claesg: Various documentation fixes and 3D print enclosures -* @girtsf: So far our CI system, but soon lots of device improvements +- @astro-arphid: Added support for 433MHz radios in europe. +- @claesg: Various documentation fixes and 3D print enclosures +- @girtsf: Lots of improvements +- @spattinson: Fixed interrupt handling for the AXP192 part # IMPORTANT DISCLAIMERS AND FAQ -For a listing of currently missing features and a FAQ click [here](docs/faq.md). \ No newline at end of file +For a listing of currently missing features and a FAQ click [here](docs/faq.md). diff --git a/src/screen.cpp b/src/screen.cpp index 8f81fbb6..b552e1b1 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -401,10 +401,7 @@ void _screen_header() } #endif -Screen::Screen(uint8_t address, uint8_t sda, uint8_t scl) - : cmdQueue(32), useDisplay(sda || scl), dispdev(address, sda, scl), ui(&dispdev) -{ -} +Screen::Screen(uint8_t address, uint8_t sda, uint8_t scl) : cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev) {} void Screen::handleSetOn(bool on) { @@ -425,8 +422,9 @@ void Screen::handleSetOn(bool on) void Screen::setup() { - if (!useDisplay) - return; + // We don't set useDisplay until setup() is called, because some boards have a declaration of this object but the device + // is never found when probing i2c and therefore we don't call setup and never want to do (invalid) accesses to this device. + useDisplay = true; dispdev.resetOrientation(); diff --git a/src/screen.h b/src/screen.h index 05ab5333..6d088b1f 100644 --- a/src/screen.h +++ b/src/screen.h @@ -40,7 +40,7 @@ class DebugInfo /// Sets battery/charging/etc status. // - void setPowerStatus(const PowerStatus& status) + void setPowerStatus(const PowerStatus &status) { LockGuard guard(&lock); powerStatus = status; @@ -169,9 +169,13 @@ class Screen : public PeriodicTask /// Enques given command item to be processed by main loop(). bool enqueueCmd(const CmdItem &cmd) { - bool success = cmdQueue.enqueue(cmd, 0); - setPeriod(1); // handle ASAP - return success; + if (!useDisplay) + return true; // claim success if our display is not in use + else { + bool success = cmdQueue.enqueue(cmd, 0); + setPeriod(1); // handle ASAP + return success; + } } // Implementations of various commands, called from doTask().