Skip to content

Commit

Permalink
Merge pull request #3 from meshtastic/master
Browse files Browse the repository at this point in the history
Merge master
  • Loading branch information
linagee authored Jan 4, 2022
2 parents 432854c + da5bc9d commit cb0073f
Show file tree
Hide file tree
Showing 14 changed files with 285 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bin/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
VERSION=`bin/buildinfo.py long`
SHORT_VERSION=`bin/buildinfo.py short`

BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1"
BOARDS_ESP32="tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1"
#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
Expand Down
12 changes: 12 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
default_envs = tbeam
;default_envs = tbeam0.7
;default_envs = heltec-v2.0
;default_envs = heltec-v1
;default_envs = tlora-v1
;default_envs = tlora-v1
;default_envs = tlora_v1_3
;default_envs = tlora-v2
Expand Down Expand Up @@ -114,6 +116,9 @@ lib_deps =
paulstoffregen/OneWire@^2.3.5
robtillaart/DS18B20@^0.1.11
h2zero/[email protected]
tobozo/ESP32-targz@^1.1.4
arduino-libraries/NTPClient#531eff39d9fbc831f3d03f706a161739203fbe2a

# Hmm - this doesn't work yet
# board_build.ldscript = linker/esp32.extram.bss.ld
lib_ignore =
Expand Down Expand Up @@ -158,6 +163,13 @@ board = ttgo-t-beam
build_flags =
${esp32_base.build_flags} -D TBEAM_V07

[env:heltec-v1]
;build_type = debug ; to make it possible to step through our jtag debugger
extends = esp32_base
board = heltec_wifi_lora_32
build_flags =
${esp32_base.build_flags} -D HELTEC_V1

[env:heltec-v2.0]
;build_type = debug ; to make it possible to step through our jtag debugger
extends = esp32_base
Expand Down
2 changes: 1 addition & 1 deletion proto
Submodule proto updated from 4a6408 to 7b80bd
35 changes: 35 additions & 0 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#endif

#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)

// the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine.
// Tested on Neo6m module.
#undef GPS_RX_PIN
#undef GPS_TX_PIN
#define GPS_RX_PIN 36
#define GPS_TX_PIN 37

#ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag
#define I2C_SDA 4 // I2C pins for this board
#define I2C_SCL 15
#endif

#define RESET_OLED 16 // If defined, this pin will be used to reset the display controller

#define LED_PIN 25 // If defined we will blink this LED
#define BUTTON_PIN 0 // If defined, this will be used for user button presses

#define USE_RF95
#define LORA_DIO0 26 // a No connect on the SX1262 module
#ifndef USE_JTAG
#define LORA_RESET 14
#endif
#define LORA_DIO1 33 // Not really used
#define LORA_DIO2 32 // Not really used

// ratio of voltage divider = 3.20 (R1=100k, R2=220k)
#define ADC_MULTIPLIER 3.2

// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_HELTEC_V1

#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage

#elif defined(TLORA_V1)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR HardwareModel_TLORA_V1
Expand Down
5 changes: 4 additions & 1 deletion src/gps/RTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ enum RTCQuality {
/// Some other node gave us a time we can use
RTCQualityFromNet = 1,

/// Our time is based on NTP
RTCQualityNTP= 2,

/// Our time is based on our own GPS
RTCQualityGPS = 2
RTCQualityGPS = 3
};

RTCQuality getRTCQuality();
Expand Down
13 changes: 8 additions & 5 deletions src/mesh/MeshPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
assert(!pi.myReply); // If it is !null it means we have a bug, because it should have been sent the previous time

if (wantsPacket) {
DEBUG_MSG("Plugin %s wantsPacket=%d\n", pi.name, wantsPacket);
DEBUG_MSG("Plugin '%s' wantsPacket=%d\n", pi.name, wantsPacket);

pluginFound = true;

Expand All @@ -109,7 +109,10 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
/// Also: if a packet comes in on the local PC interface, we don't check for bound channels, because it is TRUSTED and it needs to
/// to be able to fetch the initial admin packets without yet knowing any channels.

bool rxChannelOk = !pi.boundChannel || (mp.from == 0) || (ch && (strcmp(ch->settings.name, pi.boundChannel) == 0));
bool rxChannelOk = !pi.boundChannel || (mp.from == 0) ||
!ch ||
strlen(ch->settings.name) > 0 ||
strcmp(ch->settings.name, pi.boundChannel);

if (!rxChannelOk) {
// no one should have already replied!
Expand All @@ -134,9 +137,9 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
// any other node.
if (mp.decoded.want_response && toUs && (getFrom(&mp) != ourNodeNum || mp.to == ourNodeNum) && !currentReply) {
pi.sendResponse(mp);
DEBUG_MSG("Plugin %s sent a response\n", pi.name);
DEBUG_MSG("Plugin '%s' sent a response\n", pi.name);
} else {
DEBUG_MSG("Plugin %s considered\n", pi.name);
DEBUG_MSG("Plugin '%s' considered\n", pi.name);
}

// If the requester didn't ask for a response we might need to discard unused replies to prevent memory leaks
Expand All @@ -147,7 +150,7 @@ void MeshPlugin::callPlugins(const MeshPacket &mp, RxSource src)
}

if (handled == ProcessMessage::STOP) {
DEBUG_MSG("Plugin %s handled and skipped other processing\n", pi.name);
DEBUG_MSG("Plugin '%s' handled and skipped other processing\n", pi.name);
break;
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/mesh/RadioLibInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
// Sometimes when testing it is useful to be able to never turn on the xmitter
#ifndef LORA_DISABLE_SENDING
printPacket("enqueuing for send", p);
uint32_t xmitMsec = getPacketTime(p);

DEBUG_MSG("txGood=%d,rxGood=%d,rxBad=%d\n", txGood, rxGood, rxBad);
ErrorCode res = txQueue.enqueue(p) ? ERRNO_OK : ERRNO_UNKNOWN;
Expand All @@ -111,10 +110,6 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
return res;
}

// Count the packet toward our TX airtime utilization.
// We only count it if it can be added to the TX queue.
airTime->logAirtime(TX_LOG, xmitMsec);

// We want all sending/receiving to be done by our daemon thread, We use a delay here because this packet might have been sent
// in response to a packet we just received. So we want to make sure the other side has had a chance to reconfigure its radio
startTransmitTimer(true);
Expand Down Expand Up @@ -188,6 +183,10 @@ void RadioLibInterface::onNotify(uint32_t notification)
MeshPacket *txp = txQueue.dequeue();
assert(txp);
startSend(txp);

// Packet has been sent, count it toward our TX airtime utilization.
uint32_t xmitMsec = getPacketTime(txp);
airTime->logAirtime(TX_LOG, xmitMsec);
}
} else {
// DEBUG_MSG("done with txqueue\n");
Expand Down
1 change: 1 addition & 0 deletions src/mesh/RadioLibInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
#endif

#define RADIOLIB_EXCLUDE_HTTP
#include <RadioLib.h>

// ESP32 has special rules about ISR code
Expand Down
1 change: 1 addition & 0 deletions src/mesh/generated/mesh.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef enum _HardwareModel {
HardwareModel_TLORA_V1_1p3 = 8,
HardwareModel_RAK4631 = 9,
HardwareModel_HELTEC_V2_1 = 10,
HardwareModel_HELTEC_V1 = 11,
HardwareModel_LORA_RELAY_V1 = 32,
HardwareModel_NRF52840DK = 33,
HardwareModel_PPR = 34,
Expand Down
Loading

0 comments on commit cb0073f

Please sign in to comment.