Compare commits

...

56 Commits

Author SHA1 Message Date
Ben Meadors
09fe616ac5 This number is a joke 2022-11-13 18:16:40 -06:00
Ben Meadors
2d7ff39ecc Merge pull request #1942 from meshtastic/develop
Develop to Master
2022-11-13 15:42:41 -06:00
Ben Meadors
6e856efd0e Merge branch 'master' into develop 2022-11-13 14:45:48 -06:00
Ben Meadors
c3c899bc85 Upstream protos for resolving conflicts 2022-11-13 14:45:26 -06:00
Ben Meadors
916f3cac41 Sync protos 2022-11-13 14:40:18 -06:00
Ben Meadors
9b5f358823 Add new heltec targets 2022-11-13 14:30:32 -06:00
Ben Meadors
22119c272d Merge pull request #1941 from meshtastic/add-heltec-wsl
Add Heltec Wireless Stick Lite V3 support
2022-11-13 14:09:50 -06:00
Ben Meadors
8d4c526d16 Add Heltec Wireless Stick Lite V3 support 2022-11-13 13:28:02 -06:00
Ben Meadors
83aebb7a00 Merge pull request #1940 from meshtastic/add-heltec-v3
Added support for Heltec V3
2022-11-13 10:31:37 -06:00
Ben Meadors
33cd5ce6c1 Cleanup 2022-11-13 09:48:38 -06:00
Ben Meadors
f22c2e768e Reorder 2022-11-13 09:47:55 -06:00
Ben Meadors
3d7dea0606 Added support for Heltec V3 2022-11-13 09:45:16 -06:00
Thomas Göttgens
263a421c4a fix pico build 2022-11-13 15:35:18 +01:00
Thomas Göttgens
401b92bdbb reverted too much 2022-11-13 15:28:43 +01:00
Thomas Göttgens
6a696af8f6 Revert "remember which devices were scanned on which bus and set them accordingly." - this is not working at all. 2022-11-13 14:56:52 +01:00
Thomas Göttgens
037d6c253b fix portduino 2022-11-13 11:58:02 +01:00
Thomas Göttgens
b6de79b21a fix build for RP2040 which actually has 2 TwoWire interfaces. 2022-11-12 17:50:33 +01:00
Thomas Göttgens
52cf530356 missing 2 sensor changes 2022-11-12 17:18:17 +01:00
Thomas Göttgens
861ded37db remember which devices were scanned on which bus and set them accordingly. 2022-11-12 17:12:40 +01:00
Thomas Göttgens
7a67388a97 Merge branch 'master' of github.com:meshtastic/firmware into develop 2022-11-12 14:34:51 +01:00
Thomas Göttgens
4f60fad3f6 Merge pull request #1936 from lewisxhe/master
Update tbeam-s3 variant
2022-11-12 14:12:11 +01:00
lewis he
67efd8172a Merge branch 'master' into master 2022-11-12 20:11:52 +08:00
lewis
60fdf9fcb2 Place PMU initialization before scanI2Cdevice 2022-11-12 20:09:25 +08:00
Thomas Göttgens
a606e9b7b5 Merge pull request #1935 from puzzled-pancake/patch-1
Update NZ_865 to 36dBm
2022-11-12 11:55:37 +01:00
Thomas Göttgens
65197a8e48 - Add new Compass Sensor
- speed up I2C Scanning
- make adding sensors less error prone
2022-11-12 11:03:29 +01:00
lewishe
43f769ebac Resolve compilation conflicts 2022-11-12 16:01:30 +08:00
lewishe
dff6eeb90e Merge branch 'master' of https://github.com/lewisxhe/Meshtastic-device 2022-11-12 15:16:54 +08:00
lewishe
61ebdb3367 Add SD card initialization 2022-11-12 15:14:13 +08:00
lewishe
cd95d0865f Repair the sharing of Wire1 between RTC and PMU in tbeams3 2022-11-12 15:12:53 +08:00
lewishe
b68a026627 Update tbeam-s3 variant mapping 2022-11-12 14:39:42 +08:00
lewishe
68ccebafbf Add low-speed crystal initialization for ESP32S3 2022-11-12 14:38:48 +08:00
puzzled-pancake
3737252d39 Update NZ_865 to 36dBm
Updated NZ_865 to 36dBm as per:
https://rrf.rsm.govt.nz/smart-web/smart/page/-smart/domain/licence/LicenceSummary.wdk?id=219752

6dBW = 36dBm/4watt
2022-11-12 17:55:28 +13:00
lewis he
888a8d05c4 Merge branch 'meshtastic:master' into master 2022-11-12 09:56:18 +08:00
Thomas Göttgens
f25f902c20 max power for the 1280 is +13dBm 2022-11-11 08:59:16 +01:00
Thomas Göttgens
a6ea5496b4 Fixed DIO Pin mapping. SX1280 is working 2022-11-10 23:26:31 +01:00
Thomas Göttgens
222424a80c no excuses, this was a SNAFU 2022-11-10 23:06:37 +01:00
Thomas Göttgens
74f31d7d68 Fix SX1280 init 2022-11-10 23:00:01 +01:00
Thomas Göttgens
5c59c8d701 GPS Update 2022-11-10 22:21:07 +01:00
Ben Meadors
30a87e3145 Switch to a smaller sample of devices for cppcheck 2022-11-10 07:26:28 -06:00
Thomas Göttgens
87f7a60f71 fix #1931 coordinates inserted into NMES stream 2022-11-10 13:51:22 +01:00
Thomas Göttgens
f7d8885257 update coordinates for DMS display too 2022-11-10 13:50:38 +01:00
Thomas Göttgens
77410dc3c3 Merge pull request #1932 from meshtastic/master
Master Merge
2022-11-10 11:02:38 +01:00
Thomas Göttgens
d1acf02ee8 Master Merge 2022-11-10 11:01:36 +01:00
Thomas Göttgens
de0954f307 switch to upstream Ethernet lib 2022-11-10 09:35:56 +01:00
Ben Meadors
7da1e5c3e8 Merge pull request #1930 from meshtastic/bug-1928
fix #1928 valid NMEA sentences
2022-11-09 18:06:01 -06:00
Thomas Göttgens
3c11e87197 Merge pull request #1927 from meshtastic/create-pull-request/patch
Changes by create-pull-request action
2022-11-09 23:43:35 +01:00
Thomas Göttgens
b004706eff fix #1928 valid NMEA sentences 2022-11-09 23:42:52 +01:00
thebentern
2247e71a52 [create-pull-request] automated change 2022-11-09 21:39:27 +00:00
Thomas Göttgens
30b6cca366 Merge pull request #1925 from meshtastic/bug-1914
fix #1914 and clean up rangetest a bit
2022-11-09 15:14:47 +01:00
Thomas Göttgens
4dd140a887 fix #1914 and clean up rangetest a bit 2022-11-09 15:12:57 +01:00
Ben Meadors
87c555bde3 Changed retention policy 2022-11-09 14:48:53 +01:00
Ben Meadors
c4951b1236 Build cleanup and update deprecated platformio cmd 2022-11-09 14:48:53 +01:00
thebentern
0249eb1307 [create-pull-request] automated change 2022-11-09 14:48:53 +01:00
Thomas Göttgens
803858ab0a change default pins for codec2 to work on TLORA 2.1-1.8 2022-11-09 11:50:13 +01:00
lewis he
da2279c295 Merge branch 'meshtastic:master' into master 2022-10-22 18:22:12 +08:00
lewishe
13e635b74e Add judgment on t-beam-s3-core to scanI2Cdevice in main.cpp 2022-10-10 11:50:18 +08:00
30 changed files with 369 additions and 137 deletions

View File

@@ -23,26 +23,17 @@ jobs:
matrix:
include:
- board: rak11200
- board: tlora-v2
- board: tlora-v1
- board: tlora_v1_3
- board: tlora-v2-1-1.6
- board: tbeam
- board: heltec-v1
- board: heltec-v2.0
- board: heltec-v2.1
- board: tbeam0.7
- board: meshtastic-diy-v1
- board: meshtastic-dr-dev
- board: rak4631
- board: rak4631_eink
- board: t-echo
- board: nano-g1
- board: station-g1
- board: m5stack-core
- board: m5stack-coreink
- board: tbeam-s3-core
- board: feather_diy
# - board: pico
runs-on: ubuntu-latest
@@ -96,6 +87,8 @@ jobs:
- board: heltec-v1
- board: heltec-v2.0
- board: heltec-v2.1
- board: heltec-v3
- board: heltec-wsl-v3
- board: tbeam0.7
- board: meshtastic-diy-v1
- board: meshtastic-dr-dev

View File

@@ -5,7 +5,7 @@ services:
build: .
deploy:
mode: replicated
replicas: 80
replicas: 4
networks:
- mesh

View File

@@ -50,7 +50,7 @@ lib_deps =
https://github.com/meshtastic/esp8266-oled-ssd1306.git#53580644255b48ebb7a737343c6b4e71c7e11cf2 ; ESP8266_SSD1306
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
https://github.com/meshtastic/TinyGPSPlus.git#2f0d0528d737000043e949f4c3bdfb623cf0b902
https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4
https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3
nanopb/Nanopb@^0.4.6
erriez/ErriezCRC32@^1.0.1
@@ -69,6 +69,7 @@ lib_deps =
${env.lib_deps}
; Portduino is using meshtastic fork for now
jgromes/RadioLib@5.4.1
mprograms/QMC5883LCompass@^1.1.1
https://github.com/meshtastic/SparkFun_ATECCX08a_Arduino_Library.git#52b5282639d08a8cbd4b748363089eed6102dc76
build_flags = ${env.build_flags} -Os

View File

@@ -1,6 +1,18 @@
#include "configuration.h"
#include "FSCommon.h"
#ifdef HAS_SDCARD
#include <SPI.h>
#include <SD.h>
#ifdef SDCARD_USE_SPI1
SPIClass SPI1(HSPI);
#define SDHandler SPI1
#endif
#endif //HAS_SDCARD
bool copyFile(const char* from, const char* to)
{
@@ -169,3 +181,39 @@ void fsInit()
listDir("/", 10);
#endif
}
void setupSDCard()
{
#ifdef HAS_SDCARD
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
if (!SD.begin(SDCARD_CS, SDHandler)) {
DEBUG_MSG("No SD_MMC card detected\n");
return ;
}
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
DEBUG_MSG("No SD_MMC card attached\n");
return ;
}
DEBUG_MSG("SD_MMC Card Type: ");
if (cardType == CARD_MMC) {
DEBUG_MSG("MMC\n");
} else if (cardType == CARD_SD) {
DEBUG_MSG("SDSC\n");
} else if (cardType == CARD_SDHC) {
DEBUG_MSG("SDHC\n");
} else {
DEBUG_MSG("UNKNOWN\n");
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
DEBUG_MSG("SD Card Size: %lluMB\n", cardSize);
DEBUG_MSG("Total space: %llu MB\n", SD.totalBytes() / (1024 * 1024));
DEBUG_MSG("Used space: %llu MB\n", SD.usedBytes() / (1024 * 1024));
#endif
}

View File

@@ -44,3 +44,4 @@ bool copyFile(const char* from, const char* to);
bool renameFile(const char* pathFrom, const char* pathTo);
void listDir(const char * dirname, uint8_t levels, boolean del);
void rmDir(const char * dirname);
void setupSDCard();

View File

@@ -110,6 +110,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define INA_ADDR_ALTERNATE 0x41
#define QMC6310_ADDR 0x1C
#define QMI8658_ADDR 0x6B
#define QMC5883L_ADDR 0x1E
#define SHTC3_ADDR 0x70
#define LPS22HB_ADDR 0x5C
#define LPS22HB_ADDR_ALT 0x5D

View File

@@ -90,7 +90,7 @@ uint8_t oled_probe(byte addr)
return o_probe;
}
void scanI2Cdevice(void)
void scanI2Cdevice()
{
byte err, addr;
uint16_t registerValue = 0x00;
@@ -106,16 +106,16 @@ void scanI2Cdevice(void)
if (addr == SSD1306_ADDRESS) {
screen_found = addr;
screen_model = oled_probe(addr);
if (screen_model == 1){
if (screen_model == 1) {
DEBUG_MSG("ssd1306 display found\n");
} else if (screen_model == 2){
} else if (screen_model == 2) {
DEBUG_MSG("sh1106 display found\n");
} else {
DEBUG_MSG("unknown display found\n");
}
}
#ifndef ARCH_PORTDUINO
if (addr == ATECC608B_ADDR){
if (addr == ATECC608B_ADDR) {
keystore_found = addr;
if (atecc.begin(keystore_found) == true) {
DEBUG_MSG("ATECC608B initialized\n");
@@ -163,50 +163,56 @@ void scanI2Cdevice(void)
DEBUG_MSG("axp192/axp2101 PMU found\n");
}
#endif
if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) {
registerValue = getRegisterValue(addr, 0xD0, 1); // GET_ID
if (registerValue == 0x61) {
DEBUG_MSG("BME-680 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr;
} else if (registerValue == 0x60) {
DEBUG_MSG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
} else {
DEBUG_MSG("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr;
if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) {
registerValue = getRegisterValue(addr, 0xD0, 1); // GET_ID
if (registerValue == 0x61) {
DEBUG_MSG("BME-680 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr;
} else if (registerValue == 0x60) {
DEBUG_MSG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
} else {
DEBUG_MSG("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr;
}
}
}
if (addr == INA_ADDR || addr == INA_ADDR_ALTERNATE) {
registerValue = getRegisterValue(addr, 0xFE, 2);
DEBUG_MSG("Register MFG_UID: 0x%x\n", registerValue);
if (registerValue == 0x5449) {
DEBUG_MSG("INA260 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA260] = addr;
} else { // Assume INA219 if INA260 ID is not found
DEBUG_MSG("INA219 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA219] = addr;
if (addr == INA_ADDR || addr == INA_ADDR_ALTERNATE) {
registerValue = getRegisterValue(addr, 0xFE, 2);
DEBUG_MSG("Register MFG_UID: 0x%x\n", registerValue);
if (registerValue == 0x5449) {
DEBUG_MSG("INA260 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA260] = addr;
} else { // Assume INA219 if INA260 ID is not found
DEBUG_MSG("INA219 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_INA219] = addr;
}
}
if (addr == MCP9808_ADDR) {
nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
DEBUG_MSG("MCP9808 sensor found\n");
}
if (addr == SHTC3_ADDR) {
DEBUG_MSG("SHTC3 sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_SHTC3] = addr;
}
if (addr == LPS22HB_ADDR || addr == LPS22HB_ADDR_ALT) {
DEBUG_MSG("LPS22HB sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_LPS22] = addr;
}
// High rate sensors, will be processed internally
if (addr == QMC6310_ADDR) {
DEBUG_MSG("QMC6310 Highrate 3-Axis magnetic sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr;
}
if (addr == QMI8658_ADDR) {
DEBUG_MSG("QMI8658 Highrate 6-Axis inertial measurement sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr;
}
if (addr == QMC5883L_ADDR) {
DEBUG_MSG("QMC5883L Highrate 3-Axis magnetic sensor found\n");
nodeTelemetrySensorsMap[TelemetrySensorType_QMC5883L] = addr;
}
}
if (addr == MCP9808_ADDR) {
nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
DEBUG_MSG("MCP9808 sensor found at address 0x%x\n", (uint8_t)addr);
}
if (addr == QMC6310_ADDR) {
DEBUG_MSG("QMC6310 3-Axis magnetic sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr;
}
if (addr == QMI8658_ADDR) {
DEBUG_MSG("QMI8658 6-Axis inertial measurement sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr;
}
if (addr == SHTC3_ADDR) {
DEBUG_MSG("SHTC3 sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_SHTC3] = addr;
}
if (addr == LPS22HB_ADDR || addr == LPS22HB_ADDR_ALT) {
DEBUG_MSG("LPS22HB sensor found at address 0x%x\n", (uint8_t)addr);
nodeTelemetrySensorsMap[TelemetrySensorType_LPS22] = addr;
}
} else if (err == 4) {
DEBUG_MSG("Unknow error at address 0x%x\n", addr);
}
@@ -218,5 +224,5 @@ void scanI2Cdevice(void)
DEBUG_MSG("%i I2C devices found\n",nDevices);
}
#else
void scanI2Cdevice(void) {}
void scanI2Cdevice() {}
#endif

View File

@@ -1,4 +1,5 @@
#include "NMEAWPL.h"
#include "GeoCoord.h"
/* -------------------------------------------
* 1 2 3 4 5 6
@@ -17,7 +18,15 @@
uint32_t printWPL(char *buf, const Position &pos, const char *name)
{
uint32_t len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name);
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
uint32_t len = sprintf(buf, "$GNWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s",
geoCoord.getDMSLatDeg(),
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
geoCoord.getDMSLatCP(),
geoCoord.getDMSLonDeg(),
(abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6,
geoCoord.getDMSLonCP(),
name);
uint32_t chk = 0;
for (uint32_t i = 1; i < len; i++) {
chk ^= buf[i];
@@ -52,15 +61,20 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name)
uint32_t printGGA(char *buf, const Position &pos)
{
uint32_t len = sprintf(buf, "$GNGGA,%06u.%03u,%07.2f,%c,%08.2f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d",
GeoCoord geoCoord(pos.latitude_i,pos.longitude_i,pos.altitude);
uint32_t len = sprintf(buf, "$GNGGA,%06u.%03u,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d",
pos.time / 1000,
pos.time % 1000,
pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N',
pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E',
geoCoord.getDMSLatDeg(),
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
geoCoord.getDMSLatCP(),
geoCoord.getDMSLonDeg(),
(abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6,
geoCoord.getDMSLonCP(),
pos.fix_type,
pos.sats_in_view,
pos.HDOP,
pos.altitude,
geoCoord.getAltitude(),
'M',
pos.altitude_geoidal_separation,
'M',
@@ -73,4 +87,4 @@ uint32_t printGGA(char *buf, const Position &pos)
}
len += sprintf(buf + len, "*%02X\r\n", chk);
return len;
}
}

View File

@@ -44,7 +44,11 @@ void readFromRTC()
if(rtc_found == PCF8563_RTC) {
uint32_t now = millis();
PCF8563_Class rtc;
#ifdef RTC_USE_WIRE1
rtc.begin(Wire1);
#else
rtc.begin();
#endif
auto tc = rtc.getDateTime();
tm t;
t.tm_year = tc.year - 1900;
@@ -110,7 +114,11 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
#elif defined(PCF8563_RTC)
if(rtc_found == PCF8563_RTC) {
PCF8563_Class rtc;
rtc.begin();
#ifdef RTC_USE_WIRE1
rtc.begin(Wire1);
#else
rtc.begin();
#endif
tm *t = localtime(&tv->tv_sec);
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
DEBUG_MSG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);

View File

@@ -538,9 +538,10 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine);
} else {
geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude()));
if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
char coordinateLine[22];
geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude()));
if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
sprintf(coordinateLine, "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7);
} else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator

View File

@@ -87,8 +87,6 @@ uint8_t kb_model;
// The I2C address of the RTC Module (if found)
uint8_t rtc_found;
bool rIf_wide_lora = false;
// Keystore Chips
uint8_t keystore_found;
#ifndef ARCH_PORTDUINO
@@ -102,7 +100,7 @@ uint32_t serialSinceMsec;
bool pmu_found;
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658+1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { 0 }; // one is enough, missing elements will be initialized to 0 anyway.
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
@@ -246,8 +244,32 @@ void setup()
digitalWrite(PIN_3V3_EN, 1);
#endif
// Currently only the tbeam has a PMU
// PMU initialization needs to be placed before scanI2Cdevice
power = new Power();
power->setStatusHandler(powerStatus);
powerStatus->observe(&power->newStatus);
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
#ifdef LILYGO_TBEAM_S3_CORE
// In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck
// PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus
Wire1.beginTransmission(PCF8563_RTC);
if (Wire1.endTransmission() == 0){
rtc_found = PCF8563_RTC;
DEBUG_MSG("PCF8563 RTC found\n");
}
#endif
// We need to scan here to decide if we have a screen for nodeDB.init()
scanI2Cdevice();
#ifdef HAS_SDCARD
setupSDCard();
#endif
#ifdef RAK4630
// scanEInkDevice();
#endif
@@ -281,19 +303,7 @@ void setup()
nodeDB.init();
playStartMelody();
// Currently only the tbeam has a PMU
power = new Power();
power->setStatusHandler(powerStatus);
powerStatus->observe(&power->newStatus);
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
/*
* Repeat the scanning for I2C devices after power initialization or look for 'latecomers'.
* Boards with an PMU need to be powered on to correctly scan to the device address, such as t-beam-s3-core
*/
scanI2Cdevice();
// fixed screen override?
if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO)
screen_model = config.display.oled;
@@ -385,7 +395,6 @@ void setup()
rIf = NULL;
} else {
DEBUG_MSG("SX1280 Radio init succeeded, using SX1280 radio\n");
rIf_wide_lora = true;
}
}
#endif

View File

@@ -17,7 +17,6 @@ extern uint8_t kb_model;
extern uint8_t rtc_found;
extern uint8_t keystore_found;
extern bool rIf_wide_lora;
extern bool eink_found;
extern bool pmu_found;
extern bool isCharging;
@@ -27,7 +26,7 @@ extern bool isUSBPowered;
extern ATECCX08A atecc;
#endif
extern uint8_t nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658+1];
extern uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1];
extern int TCPPort; // set by Portduino

View File

@@ -89,7 +89,7 @@ const RegionInfo regions[] = {
https://rrf.rsm.govt.nz/smart-web/smart/page/-smart/domain/licence/LicenceSummary.wdk?id=219752
https://iotalliance.org.nz/wp-content/uploads/sites/4/2019/05/IoT-Spectrum-in-NZ-Briefing-Paper.pdf
*/
RDEF(NZ_865, 864.0f, 868.0f, 100, 0, 0, true, false, false),
RDEF(NZ_865, 864.0f, 868.0f, 100, 0, 36, true, false, false),
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
@@ -365,37 +365,37 @@ void RadioInterface::applyModemConfig()
switch (loraConfig.modem_preset) {
case Config_LoRaConfig_ModemPreset_SHORT_FAST:
bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250;
bw = (myRegion->wideLora) ? 812.5 : 250;
cr = 8;
sf = 7;
break;
case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250;
bw = (myRegion->wideLora) ? 812.5 : 250;
cr = 8;
sf = 8;
break;
case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250;
bw = (myRegion->wideLora) ? 812.5 : 250;
cr = 8;
sf = 9;
break;
case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250;
bw = (myRegion->wideLora) ? 812.5 : 250;
cr = 8;
sf = 10;
break;
case Config_LoRaConfig_ModemPreset_LONG_FAST:
bw = (myRegion->wideLora && rIf_wide_lora) ? 800 : 250;
bw = (myRegion->wideLora) ? 812.5 : 250;
cr = 8;
sf = 11;
break;
case Config_LoRaConfig_ModemPreset_LONG_SLOW:
bw = (myRegion->wideLora && rIf_wide_lora) ? 400 : 125;
bw = (myRegion->wideLora) ? 406.25 : 125;
cr = 8;
sf = 12;
break;
case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
bw = (myRegion->wideLora && rIf_wide_lora) ? 200 : 31.25;
bw = (myRegion->wideLora) ? 203.125 : 31.25;
cr = 8;
sf = 12;
break;
@@ -411,6 +411,14 @@ void RadioInterface::applyModemConfig()
bw = 31.25;
if (bw == 62) // Fix for 62.5Khz bandwidth
bw = 62.5;
if (bw == 200)
bw = 203.125;
if (bw == 400)
bw = 406.25;
if (bw == 800)
bw = 812.5;
if (bw == 1600)
bw = 1625.0;
}
power = loraConfig.tx_power;
@@ -443,7 +451,7 @@ void RadioInterface::applyModemConfig()
DEBUG_MSG("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
DEBUG_MSG("Radio myRegion->freqStart / myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
DEBUG_MSG("Radio myRegion->numChannels: %d\n", numChannels);
DEBUG_MSG("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
DEBUG_MSG("Radio channel_num: %d\n", channel_num);
DEBUG_MSG("Radio frequency: %f\n", getFreq());
DEBUG_MSG("Slot time: %u msec\n", slotTimeMsec);

View File

@@ -6,7 +6,7 @@
// Particular boards might define a different max power based on what their hardware can do
#ifndef SX128X_MAX_POWER
#define SX128X_MAX_POWER 22
#define SX128X_MAX_POWER 13
#endif
template<typename T>
@@ -61,7 +61,7 @@ bool SX128xInterface<T>::init()
#endif
if (res == RADIOLIB_ERR_NONE)
res = lora.setCRC(RADIOLIB_SX128X_LORA_CRC_ON);
res = lora.setCRC(2);
if (res == RADIOLIB_ERR_NONE)
startReceive(); // start receiving

View File

@@ -78,6 +78,10 @@ typedef enum _HardwareModel {
HardwareModel_DR_DEV = 41,
/* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */
HardwareModel_M5STACK = 42,
/* New Heltec LoRA32 with ESP32-S3 CPU */
HardwareModel_HELTEC_V3 = 43,
/* New Heltec Wireless Stick Lite with ESP32-S3 CPU */
HardwareModel_HELTEC_WSL_V3 = 44,
/* Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. */
HardwareModel_PRIVATE_HW = 255
} HardwareModel;
@@ -501,7 +505,7 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
typedef struct _MeshPacket {
/* The sending node number.
Note: Our crypto implementation uses this field as well.
See [crypto](/docs/about/overview/encryption) for details.
See [crypto](/docs/overview/encryption) for details.
FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */
uint32_t from;
/* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only
@@ -529,7 +533,7 @@ typedef struct _MeshPacket {
needs to be unique for a few minutes (long enough to last for the length of
any ACK or the completion of a mesh broadcast flood).
Note: Our crypto implementation uses this id as well.
See [crypto](/docs/about/overview/encryption) for details.
See [crypto](/docs/overview/encryption) for details.
FIXME - really should be fixed32 instead, this encoding only
hurts the ble link though. */
uint32_t id;

View File

@@ -33,7 +33,9 @@ typedef enum _TelemetrySensorType {
/* 3-Axis magnetic sensor */
TelemetrySensorType_QMC6310 = 9,
/* 6-Axis inertial measurement sensor */
TelemetrySensorType_QMI8658 = 10
TelemetrySensorType_QMI8658 = 10,
/* 3-Axis magnetic sensor */
TelemetrySensorType_QMC5883L = 11
} TelemetrySensorType;
/* Struct definitions */
@@ -85,8 +87,8 @@ typedef struct _Telemetry {
/* Helper constants for enums */
#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET
#define _TelemetrySensorType_MAX TelemetrySensorType_QMI8658
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_QMI8658+1))
#define _TelemetrySensorType_MAX TelemetrySensorType_QMC5883L
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_QMC5883L+1))
#ifdef __cplusplus

View File

@@ -21,8 +21,9 @@
1) Enable the module by setting audio.codec2_enabled to 1.
2) Set the pins (audio.mic_pin / audio.amp_pin) for your preferred microphone and amplifier GPIO pins.
On tbeam, recommend to use:
audio.mic_chan 7 (GPIO 35)
audio.amp_pin 25 (GPIO 25)
audio.mic_chan 6 (GPIO 34)
audio.amp_pin 14
audio.ptt_pin 39
3) Set audio.timeout to the amount of time to wait before we consider
your voice stream as "done".
4) Set audio.bitrate to the desired codec2 rate (CODEC2_3200, CODEC2_2400, CODEC2_1600, CODEC2_1400, CODEC2_1300, CODEC2_1200, CODEC2_700, CODEC2_700B)
@@ -33,8 +34,8 @@
* Will not work on NRF and the Linux device targets.
*/
#define AMIC 7
#define AAMP 25
#define AMIC 6
#define AAMP 14
#define PTT_PIN 39
#define AUDIO_MODULE_RX_BUFFER 128

View File

@@ -12,7 +12,7 @@
//#include <assert.h>
/*
As a sender, I can send packets every n-seonds. These packets include an incramented PacketID.
As a sender, I can send packets every n seconds. These packets include an incremented PacketID.
As a receiver, I can receive packets from multiple senders. These packets can be saved to the Filesystem.
*/
@@ -36,12 +36,12 @@ int32_t RangeTestModule::runOnce()
without having to configure it from the PythonAPI or WebUI.
*/
//moduleConfig.range_test.enabled = 1;
//moduleConfig.range_test.sender = 30;
// moduleConfig.range_test.enabled = 1;
// moduleConfig.range_test.sender = 30;
// moduleConfig.range_test.save = 1;
// Fixed position is useful when testing indoors.
// radioConfig.preferences.fixed_position = 1;
// config.position.fixed_position = 1;
uint32_t senderHeartbeat = moduleConfig.range_test.sender * 1000;
@@ -57,7 +57,8 @@ int32_t RangeTestModule::runOnce()
return (5000); // Sending first message 5 seconds after initilization.
} else {
DEBUG_MSG("Initializing Range Test Module -- Receiver\n");
return (500);
return (INT32_MAX);
// This thread does not need to run as a receiver
}
} else {
@@ -70,8 +71,7 @@ int32_t RangeTestModule::runOnce()
DEBUG_MSG("gpsStatus->getLongitude() %d\n", gpsStatus->getLongitude());
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
DEBUG_MSG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
DEBUG_MSG("pref.fixed_position() %d\n", config.position.fixed_position);
DEBUG_MSG("fixed_position() %d\n", config.position.fixed_position);
// Only send packets if the channel is less than 25% utilized.
if (airTime->channelUtilizationPercent() < 25) {
@@ -82,11 +82,11 @@ int32_t RangeTestModule::runOnce()
return (senderHeartbeat);
} else {
// Otherwise, we're a receiver.
return (500);
return (INT32_MAX);
// This thread does not need to run as a receiver
}
// TBD
}
} else {
@@ -221,6 +221,8 @@ bool RangeTestModuleRadio::appendFile(const MeshPacket &mp)
return 0;
}
FSCom.mkdir("/static");
// If the file doesn't exist, write the header.
if (!FSCom.exists("/static/rangetest.csv")) {
//--------- Write to file

View File

@@ -84,6 +84,10 @@
#define HW_VENDOR HardwareModel_STATION_G1
#elif defined(DR_DEV)
#define HW_VENDOR HardwareModel_DR_DEV
#elif defined(HELTEC_V3)
#define HW_VENDOR HardwareModel_HELTEC_V3
#elif defined(HELTEC_WSL_V3)
#define HW_VENDOR HardwareModel_HELTEC_WSL_V3
#endif
//

View File

@@ -14,6 +14,7 @@
#include <driver/rtc_io.h>
#include <nvs.h>
#include <nvs_flash.h>
#include "soc/rtc.h"
NimbleBluetooth *nimbleBluetooth;
@@ -36,6 +37,44 @@ void setBluetoothEnable(bool on) {
}
}
#ifdef HAS_32768HZ
#define CALIBRATE_ONE(cali_clk) calibrate_one(cali_clk, #cali_clk)
static uint32_t calibrate_one(rtc_cal_sel_t cal_clk, const char *name)
{
const uint32_t cal_count = 1000;
// const float factor = (1 << 19) * 1000.0f; unused var?
uint32_t cali_val;
for (int i = 0; i < 5; ++i) {
cali_val = rtc_clk_cal(cal_clk, cal_count);
}
return cali_val;
}
void enableSlowCLK()
{
rtc_clk_32k_enable(true);
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
uint32_t cal_32k = CALIBRATE_ONE(RTC_CAL_32K_XTAL);
if (cal_32k == 0) {
DEBUG_MSG("32K XTAL OSC has not started up\n");
} else {
rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL);
DEBUG_MSG("Switching RTC Source to 32.768Khz succeeded, using 32K XTAL\n");
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
}
CALIBRATE_ONE(RTC_CAL_RTC_MUX);
CALIBRATE_ONE(RTC_CAL_32K_XTAL);
if (rtc_clk_slow_freq_get() != RTC_SLOW_FREQ_32K_XTAL) {
DEBUG_MSG("Warning: Failed to switch 32K XTAL RTC source to 32.768Khz !!! \n"); return;
}
}
#endif
void esp32Setup()
{
uint32_t seed = esp_random();
@@ -83,6 +122,10 @@ void esp32Setup()
res = esp_task_wdt_add(NULL);
assert(res == ESP_OK);
#ifdef HAS_32768HZ
enableSlowCLK();
#endif
}
#if 0

View File

@@ -0,0 +1,9 @@
[env:heltec-v3]
platform = https://github.com/Baptou88/platform-espressif32.git
extends = esp32_base
board = heltec_wifi_lora_32_V3
# Temporary: https://community.platformio.org/t/heltec-esp32-lora-v3-board-support/30406/2
platform_packages =
framework-arduinoespressif32@https://github.com/Baptou88/arduino-esp32.git
build_flags =
${esp32s3_base.build_flags} -D HELTEC_V3 -I variants/heltec_v3

View File

@@ -0,0 +1,32 @@
#define LED_PIN LED
#define HAS_GPS 0
#define RESET_OLED RST_OLED
#define I2C_SDA SDA_OLED // I2C pins for this board
#define I2C_SCL SCL_OLED
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
#define BUTTON_PIN 0
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_MULTIPLIER 5.22
#define USE_SX1262
#define LORA_DIO0 -1 // a No connect on the SX1262 module
#define LORA_RESET 12
#define LORA_DIO1 14 // SX1262 IRQ
#define LORA_DIO2 13 // SX1262 BUSY
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
#define RF95_SCK 9
#define RF95_MISO 11
#define RF95_MOSI 10
#define RF95_NSS 8
#define SX126X_CS RF95_NSS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_E22

View File

@@ -0,0 +1,9 @@
[env:heltec-wsl-v3]
platform = https://github.com/Baptou88/platform-espressif32.git
extends = esp32_base
board = heltec_wifi_lora_32_V3
# Temporary: https://community.platformio.org/t/heltec-esp32-lora-v3-board-support/30406/2
platform_packages =
framework-arduinoespressif32@https://github.com/Baptou88/arduino-esp32.git
build_flags =
${esp32s3_base.build_flags} -D HELTEC_WSL_V3 -I variants/heltec_wsl_v3

View File

@@ -0,0 +1,29 @@
#define LED_PIN LED
#define HAS_SCREEN 0
#define HAS_GPS 0
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
#define BUTTON_PIN 0
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_MULTIPLIER 5.22
#define USE_SX1262
#define LORA_DIO0 -1 // a No connect on the SX1262 module
#define LORA_RESET 12
#define LORA_DIO1 14 // SX1262 IRQ
#define LORA_DIO2 13 // SX1262 BUSY
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
#define RF95_SCK 9
#define RF95_MISO 11
#define RF95_MOSI 10
#define RF95_NSS 8
#define SX126X_CS RF95_NSS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_E22

View File

@@ -8,7 +8,7 @@ lib_deps =
${nrf52840_base.lib_deps}
${networking_base.lib_deps}
melopero/Melopero RV3028@^1.1.0
https://github.com/meshtastic/RAK13800-W5100S.git#b680706eb8006cd62c919ac74c8af1950eb82c81
https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@@ -17,20 +17,28 @@
static const uint8_t TX = 43;
static const uint8_t RX = 44;
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 42;
static const uint8_t SCL = 41;
// Default SPI will be mapped to Radio
static const uint8_t SS = 10;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 13;
static const uint8_t SCK = 12;
#define SDMMC_CMD (35)
#define SDMMC_CLK (36)
#define SDMMC_DATA (37)
// Another SPI bus shares SD card and QMI8653 inertial measurement sensor
#define SPI_MOSI (35)
#define SPI_SCK (36)
#define SPI_MISO (37)
#define SPI_CS (47)
#define IMU_CS (34)
#define ACCEL_INT1 (34)
#define ACCEL_INT2 (33)
#define SDCARD_CS SPI_CS
#define IMU_INT (33)
// #define PMU_IRQ (40)
#define RTC_INT (14)
#endif /* Pins_Arduino_h */

View File

@@ -1,20 +1,18 @@
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
#define I2C_SDA1 42 //Used for PMU management
#define I2C_SCL1 41 //Used for PMU management
#define I2C_SDA1 42 //Used for PMU management and PCF8563
#define I2C_SCL1 41 //Used for PMU management and PCF8563
#define I2C_SDA 17 //For sensors and screens
#define I2C_SCL 18 //For sensors and screens
#define I2C_SDA 17 //For QMC6310 sensors and screens
#define I2C_SCL 18 //For QMC6310 sensors and screens
#define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3
//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented anywhere.
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
#define BUTTON1_PIN 47 //Additional keys
#define LED_INVERTED 1
// #define LED_PIN 4 // Newer tbeams (1.1) have an extra led on GPIO4
// TTGO uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
// not found then probe for SX1262
@@ -42,8 +40,9 @@
// #define PMU_IRQ 40
#define HAS_AXP2101
// Specify the PMU as Wire1. In the t-beam-s3-core, the PMU enjoys a separate bus
// Specify the PMU as Wire1. In the t-beam-s3 core, PCF8563 and PMU share the bus
#define PMU_USE_WIRE1
#define RTC_USE_WIRE1
#define RF95_SCK 12
#define RF95_MISO 13
@@ -56,10 +55,14 @@
#define GPS_1PPS_PIN 6
#define HAS_SDCARD //Have 3-bit SDMMC interface SD card slot
#define HAS_SDCARD //Have SPI interface SD card slot
#define SDCARD_USE_SPI1
// PCF8563 RTC Module
// #define PCF8563_RTC 0x51 //Putting definitions in variant. h does not compile correctly
#define HAS_RTC 1
//has 32768 Hz crystal
#define HAS_32768HZ

View File

@@ -12,20 +12,17 @@
#define I2C_SDA 21 // I2C pins for this board
#define I2C_SCL 22
// #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller. Crashes on newer ESP-IDF and not needed per schematic
#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost
#define LED_PIN 25 // If defined we will blink this LED
#define BUTTON_PIN 12 // If defined, this will be used for user button presses,
#define BUTTON_NEED_PULLUP
#define USE_SX1280
#define LORA_DIO0 26 // a No connect on the SX1262 module
#define LORA_RESET 23
#define SX128X_CS 18 // FIXME - we really should define LORA_CS instead
#define SX128X_DIO1 33
#define SX128X_DIO1 26
#define SX128X_DIO2 33
#define SX128X_BUSY 32
#define SX128X_RESET LORA_RESET
#define SX128X_E22 // Not really an E22 but TTGO seems to be trying to clone that

View File

@@ -1,4 +1,4 @@
[VERSION]
major = 2
minor = 0
build = 2
build = 3