diff --git a/bin/version.sh b/bin/version.sh index 388402b64..02a3c9d62 100644 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,3 +1,3 @@ -export VERSION=0.9.5 \ No newline at end of file +export VERSION=1.0.0 \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 270d89633..f2fd6b578 100644 --- a/docs/README.md +++ b/docs/README.md @@ -43,7 +43,8 @@ For an detailed walk-through aimed at beginners, we recommend [meshtastic.letsta Note: Updates are happening almost daily, only major updates are listed below. For more details see our forum. -- 06/24/2020 - 0.7.x Now with over 1000 android users, over 600 people using the radios and translated into 13 languages. Fairly stable and we are working through bugs to get to 1.0. +- 09/14/2020 - 1.0.0 Now with over 1700 android users, over 2000 nodes and translated into 15 languages. This project will always be a "beta" experiment, but now quite usable. We are currently selecting 1.1 features in our discussion forum. +- 06/24/2020 - 0.7.x Now with over 1000 android users, over 600 people using the radios and translated into 22 languages. Fairly stable and we are working through bugs to get to 1.0. - 06/04/2020 - 0.6.7 Beta releases of both the application and the device code are released. Features are fairly solid now with a sizable number of users. - 04/28/2020 - 0.6.0 [Python API](https://pypi.org/project/meshtastic/) released. Makes it easy to use meshtastic devices as "zero config / just works" mesh transport adapters for other projects. - 04/20/2020 - 0.4.3 Pretty solid now both for the android app and the device code. Many people have donated translations and code. Probably going to call it a beta soon. @@ -77,13 +78,14 @@ Make sure to buy the frequency range which is legal for your country. For the US Instructions for installing prebuilt firmware can be found [here](https://github.com/meshtastic/Meshtastic-esp32/blob/master/README.md). For a nice looking cases: - - 3D printable cases - 1. TTGO T-Beam V0 see this [design](https://www.thingiverse.com/thing:3773717) by [bsiege](https://www.thingiverse.com/bsiege). - 2. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:3830711) by [rwanrooy](https://www.thingiverse.com/rwanrooy) or this [remix](https://www.thingiverse.com/thing:3949330) by [8ung](https://www.thingiverse.com/8ung) - 3. TTGO T_Beam V1 (IPEX) see this [design](https://www.thingiverse.com/thing:4587297) by [drewsed](https://www.thingiverse.com/drewsed) - 4. Heltec Lora32 see this [design](https://www.thingiverse.com/thing:3125854) by [ornotermes](https://www.thingiverse.com/ornotermes). - - Laser-cut cases - 1. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:4552771) by [jefish](https://www.thingiverse.com/jefish) + +- 3D printable cases + 1. TTGO T-Beam V0 see this [design](https://www.thingiverse.com/thing:3773717) by [bsiege](https://www.thingiverse.com/bsiege). + 2. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:3830711) by [rwanrooy](https://www.thingiverse.com/rwanrooy) or this [remix](https://www.thingiverse.com/thing:3949330) by [8ung](https://www.thingiverse.com/8ung) + 3. TTGO T_Beam V1 (IPEX) see this [design](https://www.thingiverse.com/thing:4587297) by [drewsed](https://www.thingiverse.com/drewsed) + 4. Heltec Lora32 see this [design](https://www.thingiverse.com/thing:3125854) by [ornotermes](https://www.thingiverse.com/ornotermes). +- Laser-cut cases + 1. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:4552771) by [jefish](https://www.thingiverse.com/jefish) # IMPORTANT DISCLAIMERS AND FAQ diff --git a/platformio.ini b/platformio.ini index d805427f2..6ef76e7d1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -92,7 +92,7 @@ build_flags = # board_build.ldscript = linker/esp32.extram.bss.ld lib_ignore = segger_rtt platform_packages = - framework-arduinoespressif32 @ https://github.com/meshtastic/arduino-esp32.git#1adba3f11ca8406ac0a704d151697b572058b53d + framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#2814f110aa618429bdd9a0a2d6a93c55f29f87a6 ; customize the partition table ; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables @@ -105,7 +105,7 @@ board_build.partitions = partition-table.csv ; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -; The 1.0 release of the TBEAM board +; The 1.0 release of the TBEAM board [env:tbeam] extends = esp32_base board = ttgo-t-beam diff --git a/proto b/proto index 3caee2e5b..ce422b7c4 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 3caee2e5b92d4429c6cf47a4c88d4615001f300b +Subproject commit ce422b7c448906c6fee3eef64bbd41adfbc990f0 diff --git a/src/configuration.h b/src/configuration.h index b8f35c0e4..55464d6cd 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -258,6 +258,7 @@ along with this program. If not, see . // #define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost #define LED_PIN 2 // If defined we will blink this LED #define BUTTON_PIN 0 // If defined, this will be used for user button presses +#define BUTTON_NEED_PULLUP #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module @@ -284,6 +285,7 @@ along with this program. If not, see . #define BUTTON_PIN \ 0 // If defined, this will be used for user button presses, if your board doesn't have a physical switch, you can wire one // between this pin and ground +#define BUTTON_NEED_PULLUP #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index 80d7064bb..624ab77b8 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -46,8 +46,9 @@ bool UBloxGPS::setup() // ublox.enableDebugging(Serial); // try a second time, the ublox lib serial parsing is buggy? - if (!tryConnect()) - tryConnect(); + // see https://github.com/meshtastic/Meshtastic-device/issues/376 + for (int i = 0; (i < 3) && !tryConnect(); i++) + delay(500); if (isConnected) { DEBUG_MSG("Connected to UBLOX GPS successfully\n"); @@ -81,8 +82,11 @@ bool UBloxGPS::setUBXMode() // assert(ok); // ok = ublox.setDynamicModel(DYN_MODEL_BIKE); // probably PEDESTRIAN but just in case assume bike speeds // assert(ok); - if (!ublox.powerSaveMode(true, 2000)) // use power save mode, the default timeout (1100ms seems a bit too tight) - return false; + + // per https://github.com/meshtastic/Meshtastic-device/issues/376 powerSaveMode might not work with the marginal + // TTGO antennas + // if (!ublox.powerSaveMode(true, 2000)) // use power save mode, the default timeout (1100ms seems a bit too tight) + // return false; if (!ublox.saveConfiguration(3000)) return false; @@ -106,8 +110,8 @@ bool UBloxGPS::factoryReset() tryConnect(); // sets isConnected // try a second time, the ublox lib serial parsing is buggy? - if (!tryConnect()) - tryConnect(); + for (int i = 0; (i < 3) && !tryConnect(); i++) + delay(500); DEBUG_MSG("GPS Factory reset success=%d\n", isConnected); if (isConnected) @@ -165,7 +169,7 @@ void UBloxGPS::doTask() latitude = ublox.getLatitude(0); longitude = ublox.getLongitude(0); - altitude = ublox.getAltitude(0) / 1000; // in mm convert to meters + altitude = ublox.getAltitudeMSL(0) / 1000; // in mm convert to meters dop = ublox.getPDOP(0); // PDOP (an accuracy metric) is reported in 10^2 units so we have to scale down when we use it heading = ublox.getHeading(0); numSatellites = ublox.getSIV(0); diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 78434ccf7..b460775a9 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -251,7 +251,7 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const displayLine = "No GPS Lock"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else { - char coordinateLine[20]; + char coordinateLine[22]; sprintf(coordinateLine, "%f %f", gps->getLatitude() * 1e-7, gps->getLongitude() * 1e-7); display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); } diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 194765821..594cec91f 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -3,9 +3,11 @@ #include "RadioLibRF95.h" #include -#define MAX_POWER 17 +#define MAX_POWER 20 // if we use 20 we are limited to 1% duty cycle or hw might overheat. For continuous operation set a limit of 17 +#define POWER_DEFAULT 17 // How much power to use if the user hasn't set a power level + RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi) : RadioLibInterface(cs, irq, rst, 0, spi) { @@ -32,9 +34,15 @@ bool RF95Interface::init() RadioLibInterface::init(); applyModemConfig(); + + if (power == 0) + power = POWER_DEFAULT; + if (power > MAX_POWER) // This chip has lower power limits than some power = MAX_POWER; + limitPower(); + iface = lora = new RadioLibRF95(&module); #ifdef RF95_TCXO diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 7629fdbe5..1a08f282e 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -106,7 +106,7 @@ bool RadioInterface::init() * djb2 by Dan Bernstein. * http://www.cse.yorku.ca/~oz/hash.html */ -unsigned long hash(char *str) +unsigned long hash(const char *str) { unsigned long hash = 5381; int c; @@ -117,8 +117,6 @@ unsigned long hash(char *str) return hash; } -#define POWER_DEFAULT 17 - /** * Pull our channel settings etc... from protobufs to the dumb interface settings */ @@ -128,8 +126,6 @@ void RadioInterface::applyModemConfig() // No Sync Words in LORA mode power = channelSettings.tx_power; - if (power == 0) - power = POWER_DEFAULT; // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name int channel_num = (channelSettings.channel_num ? channelSettings.channel_num - 1 : hash(channelSettings.name)) % NUM_CHANNELS; @@ -139,6 +135,25 @@ void RadioInterface::applyModemConfig() power); } +/** + * Some regulatory regions limit xmit power. + * This function should be called by subclasses after setting their desired power. It might lower it + */ +void RadioInterface::limitPower() +{ + uint8_t maxPower = 255; // No limit + +#ifdef HW_VERSION_JP + maxPower = 13; // See https://github.com/meshtastic/Meshtastic-device/issues/346 +#endif + if (power > maxPower) { + DEBUG_MSG("Lowering transmit power because of regulatory limits\n"); + power = maxPower; + } + + DEBUG_MSG("Set radio: final power level=%d\n", power); +} + ErrorCode SimRadio::send(MeshPacket *p) { DEBUG_MSG("SimRadio.send\n"); diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index b8cba208d..645ee5c05 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -119,6 +119,12 @@ class RadioInterface : protected concurrency::NotifiedWorkerThread virtual void loop() {} // Idle processing + /** + * Some regulatory regions limit xmit power. + * This function should be called by subclasses after setting their desired power. It might lower it + */ + void limitPower(); + /** * Convert our modemConfig enum into wf, sf, etc... * diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index f581cdb1c..130f340c3 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -37,8 +37,15 @@ bool SX1262Interface::init() bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC? applyModemConfig(); + + if (power == 0) + power = 22; + if (power > 22) // This chip has lower power limits than some power = 22; + + limitPower(); + int res = lora.begin(freq, bw, sf, cr, syncWord, power, currentLimit, preambleLength, tcxoVoltage, useRegulatorLDO); DEBUG_MSG("SX1262 init result %d\n", res); diff --git a/src/mesh/mesh.pb.h b/src/mesh/mesh.pb.h index 27ff63f9b..64b2758c3 100644 --- a/src/mesh/mesh.pb.h +++ b/src/mesh/mesh.pb.h @@ -364,7 +364,7 @@ typedef struct _ToRadio { #define DeviceState_version_tag 8 #define DeviceState_rx_text_message_tag 7 #define DeviceState_no_save_tag 9 -#define DeviceState_did_gps_reset_tag 10 +#define DeviceState_did_gps_reset_tag 11 #define FromRadio_packet_tag 2 #define FromRadio_my_info_tag 3 #define FromRadio_node_info_tag 4 @@ -519,7 +519,7 @@ X(a, STATIC, REPEATED, MESSAGE, receive_queue, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \ X(a, STATIC, SINGULAR, UINT32, version, 8) \ X(a, STATIC, SINGULAR, BOOL, no_save, 9) \ -X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 10) +X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) #define DeviceState_CALLBACK NULL #define DeviceState_DEFAULT NULL #define DeviceState_radio_MSGTYPE RadioConfig diff --git a/src/sleep.cpp b/src/sleep.cpp index a08707762..731273c9b 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -283,8 +283,10 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r assert(esp_light_sleep_start() == ESP_OK); esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); +#ifdef BUTTON_PIN if (cause == ESP_SLEEP_WAKEUP_GPIO) DEBUG_MSG("Exit light sleep gpio: btn=%d\n", !digitalRead(BUTTON_PIN)); +#endif return cause; }