diff --git a/README.md b/README.md index 279613d03..edfdb0a3c 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,73 @@ This project is currently pre-alpha, but if you have questions please join our c 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. -## Meshtastic Android app -The source code for the (optional) Meshtastic Android app is [here](https://github.com/geeksville/Meshtastic-Android). -Soon our first alpha release of will be released here: -[![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) - ## Supported hardware We currently support two brands of radios. The [TTGO T-Beam](https://www.aliexpress.com/item/4000119152086.html) 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. -We don't yet distribute prebuilt binaries. But soon (by Feb 22) we will have a file that you can fairly easily install on your radio via USB. Once our software is installed, all future software updates happen over bluetooth from your phone. +We don't yet distribute prebuilt binaries. But soon (by Feb 22) we will have a file that you can fairly easily install on your radio via USB. For a nice 3D printable case see this [design](https://www.thingiverse.com/thing:3773717) by [bsiege](https://www.thingiverse.com/bsiege). +## Installing the firmware +Prebuilt binaries for the supported radios is available in our [releases](https://github.com/geeksville/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, 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/). +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". You should see something like: +``` +mydir$ esptool.py chip_id +esptool.py v2.6 +Found 2 serial ports +Serial port /dev/ttyUSB0 +Connecting.... +Detecting chip type... ESP32 +Chip is ESP32D0WDQ6 (revision 1) +Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None +MAC: 24:6f:28:b5:36:71 +Uploading stub... +Running stub... +Stub running... +Warning: ESP32 has no Chip ID. Reading MAC instead. +MAC: 24:6f:28:b5:36:71 +Hard resetting via RTS pin... +``` +6. Install the correct firmware for your board with "esptool.py write_flash 0x10000 firmware-_board_-_country_.bin". For instance "esptool.py write_flash 0x10000 release/firmware-HELTEC-US-0.0.3.bin". You should see something like this: +``` +~/development/meshtastic/meshtastic-esp32$ esptool.py write_flash 0x10000 release/firmware-HELTEC-US-0.0.3.bin +esptool.py v2.6 +Found 2 serial ports +Serial port /dev/ttyUSB0 +Connecting...... +Detecting chip type... ESP32 +Chip is ESP32D0WDQ6 (revision 1) +Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None +MAC: 24:6f:28:b5:36:71 +Uploading stub... +Running stub... +Stub running... +Configuring flash size... +Auto-detected Flash size: 8MB +Compressed 1184800 bytes to 652635... +Wrote 1184800 bytes (652635 compressed) at 0x00010000 in 57.6 seconds (effective 164.5 kbit/s)... +Hash of data verified. + +Leaving... +Hard resetting via RTS pin... +``` +7. The board will boot and show the Meshtastic logo. +8. 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/geeksville/Meshtastic-Android). +Soon our first alpha release of will be released here: +[![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 The following sections are probably only interesting if you want to join us in developing the software. diff --git a/TODO.md b/TODO.md index e2f3e6c72..3c26b3658 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,6 @@ # High priority Items to complete before the first alpha release. -* rx signal measurements -3 marginal, -9 bad, 10 great -* only send 10% of phone gps positions on the network * post sample video to signal forum * support non US frequencies * make an install script to let novices install software on their boards @@ -17,6 +15,7 @@ Items to complete before the first alpha release. # Medium priority Items to complete before the first beta release. +* rx signal measurements -3 marginal, -9 bad, 10 great, -10 means almost unusable. So scale this into % signal strength. preferably as a graph, with an X indicating loss of comms. * assign every "channel" a random shared 8 bit sync word (per 4.2.13.6 of datasheet) - use that word to filter packets before even checking CRC. This will ensure our CPU will only wake for packets on our "channel" * Note: we do not do address filtering at the chip level, because we might need to route for the mesh * Use the Periodic class for both position and user periodic broadcasts @@ -39,6 +38,7 @@ Items to complete before the first beta release. # Low power consumption tasks General ideas to hit the power draws our spreadsheet predicts. Do the easy ones before beta, the last 15% can be done after 1.0. +* don't even power on the gps until someone else wants our position, just stay in lora deep sleep until press or rxpacket (except for once an hour updates) * (possibly bad idea - better to have lora radio always listen - check spreadsheet) have every node wake at the same tick and do their position syncs then go back to deep sleep * lower BT announce interval to save battery * change to use RXcontinuous mode and config to drop packets with bad CRC (see section 6.4 of datasheet) - I think this is already the case @@ -75,6 +75,12 @@ FIXME - instead look for standard solutions. this approach seems really subopti * given that the max number of nodes in this mesh will be like 20 (for normal cases), I bet globally updating this db of "nodenums and who has the best rssi for packets from that node" would be useful * once the global DB is shared, when a node wants to broadcast, it just sends out its broadcast . the first level receivers then make a decision "am I the best to rebroadcast to someone who likely missed this packet?" if so, rebroadcast +# approach 3 +* when a node X wants to know other nodes positions, it broadcasts its position with want_replies=true. Then each of the nodes that received that request broadcast their replies (possibly by using special timeslots?) +* all nodes constantly update their local db based on replies they witnessed. +* after 10s (or whatever) if node Y notices that it didn't hear a reply from node Z (that Y has heard from recently ) to that initial request, that means Z never heard the request from X. Node Y will reply to X on Z's behalf. +* could this work for more than one hop? Is more than one hop needed? Could it work for sending messages (i.e. for a msg sent to Z with want-reply set). + # Pre-beta priority During the beta timeframe the following improvements 'would be nice' (and yeah - I guess some of these items count as features, but it is a hobby project ;-) ) diff --git a/bin/build-all.sh b/bin/build-all.sh index c439f41fb..a7bc84867 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -1,15 +1,33 @@ +#!/bin/bash + set -e VERSION=0.0.3 -COUNTRY=US +COUNTRIES="US EU CN JP" -rm .pio/build/esp32/firmware.bin -export PLATFORMIO_BUILD_FLAGS="-DT_BEAM_V10 -DAPP_VERSION=$VERSION" -pio run # -v -cp .pio/build/esp32/firmware.bin release/firmware-TBEAM-$COUNTRY.bin +SRCMAP=.pio/build/esp32/output.map +SRCBIN=.pio/build/esp32/firmware.bin -rm .pio/build/esp32/firmware.bin -export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 -DAPP_VERSION=$VERSION" -pio run # -v -cp .pio/build/esp32/firmware.bin release/firmware-HELTEC-$COUNTRY.bin \ No newline at end of file +for COUNTRY in $COUNTRIES; do + + COMMONOPTS="-DAPP_VERSION=$VERSION -DHW_VERSION_$COUNTRY -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial" + + export PLATFORMIO_BUILD_FLAGS="-DT_BEAM_V10 $COMMONOPTS" + echo "Building with $PLATFORMIO_BUILD_FLAGS" + rm -f $SRCBIN $SRCMAP + pio run # -v + cp $SRCBIN release/firmware-TBEAM-$COUNTRY-$VERSION.bin + cp $SRCMAP release/firmware-TBEAM-$COUNTRY-$VERSION.map + + export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 $COMMONOPTS" + rm -f $SRCBIN $SRCMAP + pio run # -v + cp $SRCBIN release/firmware-HELTEC-$COUNTRY-$VERSION.bin + cp $SRCMAP release/firmware-HELTEC-$COUNTRY-$VERSION.map + +done + +zip release/firmware-$VERSION.zip release/firmware-*-$VERSION.bin + +echo BUILT ALL \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index a1ccf21bc..16308b3cd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,6 +16,10 @@ This software is 100% open source and developed by a group of hobbyist experimen [![Youtube video demo](desk-video-screenshot.png)](https://www.youtube.com/watch?v=WlNbMbVZlHI "Meshtastic early demo") +# Update 1 + +* 02/20/2020 - Our first alpha release of the radio software is ready for early users. If you'd like to try it, we'd love your feedback. Click [here](https://github.com/geeksville/Meshtastic-esp32/blob/master/README.md) for instructions. + ## Meshtastic Android app The source code for the Meshtastic Android app is [here](https://github.com/geeksville/Meshtastic-Android). Soon our first alpha release of will be released here: diff --git a/release/.gitignore b/release/.gitignore index f3ac583d0..9688c673a 100644 --- a/release/.gitignore +++ b/release/.gitignore @@ -1 +1,3 @@ -*.bin \ No newline at end of file +*.bin +*.map +*.zip \ No newline at end of file diff --git a/src/MeshRadio.h b/src/MeshRadio.h index 71c0c5a7c..4221d23f7 100644 --- a/src/MeshRadio.h +++ b/src/MeshRadio.h @@ -19,12 +19,12 @@ #define NUM_CHANNELS_EU 10 // CN channel settings -#define CH0_CN 470f // MHz +#define CH0_CN 470.0f // MHz #define CH_SPACING_CN 2.0f // MHz FIXME, this is just a guess for 470-510 #define NUM_CHANNELS_CN 20 // CN channel settings -#define CH0_JP 920f // MHz +#define CH0_JP 920.0f // MHz #define CH_SPACING_JP 0.5f // MHz FIXME, this is just a guess for 920-925 #define NUM_CHANNELS_JP 10 diff --git a/src/main.ino b/src/main.ino index 7070d01ea..647665616 100644 --- a/src/main.ino +++ b/src/main.ino @@ -53,6 +53,9 @@ bool packetSent, packetQueued; RTC_DATA_ATTR int bootCount = 0; esp_sleep_source_t wakeCause; // the reason we booted this time + #define xstr(s) str(s) + #define str(s) #s + // ----------------------------------------------------------------------------- // Application // ----------------------------------------------------------------------------- @@ -382,7 +385,7 @@ void setup() #endif // Hello - DEBUG_MSG(APP_NAME " " APP_VERSION "\n"); + DEBUG_MSG("%s %s\n", xstr(APP_NAME), str(APP_VERSION)); // Don't init display if we don't have one or we are waking headless due to a timer event if (wakeCause == ESP_SLEEP_WAKEUP_TIMER) @@ -402,7 +405,7 @@ void setup() if (useBluetooth) { DEBUG_MSG("Starting bluetooth\n"); - BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION); // FIXME, use a real name based on the macaddr + BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, str(APP_VERSION)); // FIXME, use a real name based on the macaddr createMeshBluetoothService(serve); // Start advertising - this must be done _after_ creating all services