From 5595fb38c1464804c2efbf164755c9172190b1ea Mon Sep 17 00:00:00 2001
From: oztug <76663743+oztug@users.noreply.github.com>
Date: Tue, 29 Dec 2020 18:08:11 +0300
Subject: [PATCH 1/6] Genieblocks Lora support
---
platformio.ini | 7 +++++++
src/configuration.h | 29 +++++++++++++++++++++++++++++
src/main.cpp | 13 +++++++++++++
3 files changed, 49 insertions(+)
diff --git a/platformio.ini b/platformio.ini
index 50d381c8..d5fbc07f 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -314,3 +314,10 @@ src_filter = ${env.src_filter} - - - -
build_flags = ${arduino_base.build_flags} -O0
framework = arduino
board = linux_x86_64
+
+; The GenieBlocks LORA prototype board
+[env:genieblocks_lora]
+extends = esp32_base
+board = genieblocks_lora
+build_flags =
+ ${esp32_base.build_flags} -D GENIEBLOCKS
diff --git a/src/configuration.h b/src/configuration.h
index 6fa07ce6..fdc74871 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -336,6 +336,35 @@ along with this program. If not, see .
#define LORA_DIO1 35 // Not really used
#define LORA_DIO2 34 // Not really used
+#elif defined(GENIEBLOCKS)
+// This string must exactly match the case used in release file names or the android updater won't work
+#define HW_VENDOR "genieblocks"
+#undef GPS_RX_PIN
+#undef GPS_TX_PIN
+#define GPS_RX_PIN 5
+#define GPS_TX_PIN 18
+#define GPS_RESET_N 10
+#define GPS_EXTINT 23 // On MAX-M8 module pin name is EXTINT. On L70 module pin name is STANDBY.
+
+#define BATTERY_PIN 39 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
+#define BATTERY_EN_PIN 14 // Voltage voltage divider enable pin connected to mosfet
+
+#define I2C_SDA 4 // I2C pins for this board
+#define I2C_SCL 2
+
+#define LED_PIN 12 // If defined we will blink this LED
+//#define BUTTON_PIN 36 // If defined, this will be used for user button presses (ToDo problem on that line on debug screen --> Long press start!)
+//#define BUTTON_NEED_PULLUP //GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-ups or pull-down resistors.
+
+#define USE_RF95
+#define LORA_DIO0 38 // a No connect on the SX1262 module
+#define LORA_RESET 9
+
+#define RF95_SCK 22
+#define RF95_MISO 19
+#define RF95_MOSI 13
+#define RF95_NSS 21
+
#endif
#ifdef ARDUINO_NRF52840_PCA10056
diff --git a/src/main.cpp b/src/main.cpp
index 64851022..0f4910aa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -388,6 +388,19 @@ void setup()
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
+#ifdef GENIEBLOCKS
+ //gps setup
+ pinMode (GPS_RESET_N, OUTPUT);
+ pinMode(GPS_EXTINT, OUTPUT);
+ digitalWrite(GPS_RESET_N, HIGH);
+ digitalWrite(GPS_EXTINT, LOW);
+ //battery setup
+ // If we want to read battery level, we need to set BATTERY_EN_PIN pin to low.
+ // ToDo: For low power consumption after read battery level, set that pin to high.
+ pinMode (BATTERY_EN_PIN, OUTPUT);
+ digitalWrite(BATTERY_EN_PIN, LOW);
+#endif
+
// If we don't have bidirectional comms, we can't even try talking to UBLOX
UBloxGPS *ublox = NULL;
#ifdef GPS_TX_PIN
From 85ddf3be1bf57fca0539fed38fe1529ac88aee33 Mon Sep 17 00:00:00 2001
From: oztug <76663743+oztug@users.noreply.github.com>
Date: Wed, 30 Dec 2020 01:26:12 +0300
Subject: [PATCH 2/6] Update proto
---
proto | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proto b/proto
index ce422b7c..323b814f 160000
--- a/proto
+++ b/proto
@@ -1 +1 @@
-Subproject commit ce422b7c448906c6fee3eef64bbd41adfbc990f0
+Subproject commit 323b814f4392ae0f9c42a0f14557c6b9333efce3
From 9a3d558f61ac79e102564d186f6a1c157e476655 Mon Sep 17 00:00:00 2001
From: oztug <76663743+oztug@users.noreply.github.com>
Date: Wed, 30 Dec 2020 01:27:20 +0300
Subject: [PATCH 3/6] Revert "Update proto"
This reverts commit 85ddf3be1bf57fca0539fed38fe1529ac88aee33.
---
proto | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proto b/proto
index 323b814f..ce422b7c 160000
--- a/proto
+++ b/proto
@@ -1 +1 @@
-Subproject commit 323b814f4392ae0f9c42a0f14557c6b9333efce3
+Subproject commit ce422b7c448906c6fee3eef64bbd41adfbc990f0
From 349701ac14f1cb4547d7cc62f9dd8b5f6c176bf3 Mon Sep 17 00:00:00 2001
From: Jm
Date: Thu, 31 Dec 2020 20:17:18 -0800
Subject: [PATCH 4/6] Display AP connection usage only when in AP mode
---
platformio.ini | 4 ++--
src/graphics/Screen.cpp | 20 +++++++++++---------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/platformio.ini b/platformio.ini
index 50d381c8..14e6ddbd 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -38,8 +38,8 @@ build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/n
;upload_port = /dev/ttyUSB0
;monitor_port = /dev/ttyUSB0
-;upload_port = /dev/cu.SLAB_USBtoUART
-;monitor_port = /dev/cu.SLAB_USBtoUART
+upload_port = /dev/cu.SLAB_USBtoUART
+monitor_port = /dev/cu.SLAB_USBtoUART
; the default is esptool
; upload_protocol = esp-prog
diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp
index 6604b0d7..5e03c25f 100644
--- a/src/graphics/Screen.cpp
+++ b/src/graphics/Screen.cpp
@@ -27,6 +27,7 @@ along with this program. If not, see .
#include "NodeDB.h"
#include "Screen.h"
#include "configuration.h"
+#include "fonts.h"
#include "graphics/images.h"
#include "main.h"
#include "mesh-pb-constants.h"
@@ -34,7 +35,6 @@ along with this program. If not, see .
#include "plugins/TextMessagePlugin.h"
#include "target_specific.h"
#include "utils.h"
-#include "fonts.h"
using namespace meshtastic; /** @todo remove */
@@ -42,7 +42,7 @@ namespace graphics
{
// This means the *visible* area (sh1106 can address 132, but shows 128 for example)
-#define IDLE_FRAMERATE 1 // in fps
+#define IDLE_FRAMERATE 1 // in fps
#define COMPASS_DIAM 44
// DEBUG
@@ -177,7 +177,6 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
display->drawString(0 + x, FONT_HEIGHT_MEDIUM + y, "For help, please post on\nmeshtastic.discourse.group");
}
-
/// Draw the last text message we received
static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
@@ -924,20 +923,21 @@ void Screen::handleStartBluetoothPinScreen(uint32_t pin)
setFastFramerate();
}
-void Screen::blink() {
+void Screen::blink()
+{
setFastFramerate();
uint8_t count = 10;
dispdev.setBrightness(254);
- while(count>0) {
+ while (count > 0) {
dispdev.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
dispdev.display();
delay(50);
dispdev.clear();
dispdev.display();
delay(50);
- count = count -1;
+ count = count - 1;
}
- dispdev.setBrightness(brightness);
+ dispdev.setBrightness(brightness);
}
void Screen::handlePrint(const char *text)
@@ -1060,11 +1060,13 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || radioConfig.preferences.wifi_ap_mode) {
if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
+
+ // Number of connections to the AP. Default mmax for the esp32 is 4
+ display->drawString(x + SCREEN_WIDTH - display->getStringWidth("(" + String(WiFi.softAPgetStationNum()) + "/4)"),
+ y + FONT_HEIGHT_SMALL * 1, "(" + String(WiFi.softAPgetStationNum()) + "/4)");
} else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str()));
}
- display->drawString(x + SCREEN_WIDTH - display->getStringWidth("(" + String(WiFi.softAPgetStationNum()) + "/4)"),
- y + FONT_HEIGHT_SMALL * 1, "(" + String(WiFi.softAPgetStationNum()) + "/4)");
} else if (WiFi.status() == WL_NO_SSID_AVAIL) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found");
From d71c7b512f73add5cbe0b8faecd511d9948bb01e Mon Sep 17 00:00:00 2001
From: Jm
Date: Thu, 31 Dec 2020 20:44:53 -0800
Subject: [PATCH 5/6] Cleanup some compile time warnings that were driving me
crazy.
---
src/graphics/Screen.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp
index 5e03c25f..92e38337 100644
--- a/src/graphics/Screen.cpp
+++ b/src/graphics/Screen.cpp
@@ -315,7 +315,7 @@ static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus
display->drawFastImage(x + 24, y, 8, 8, imgSatellite);
// Draw the number of satellites
- sprintf(satsString, "%lu", gps->getNumSatellites());
+ sprintf(satsString, "%u", gps->getNumSatellites());
display->drawString(x + 34, y - 2, satsString);
}
}
@@ -568,11 +568,11 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
uint32_t agoSecs = sinceLastSeen(node);
static char lastStr[20];
if (agoSecs < 120) // last 2 mins?
- snprintf(lastStr, sizeof(lastStr), "%lu seconds ago", agoSecs);
+ snprintf(lastStr, sizeof(lastStr), "%u seconds ago", agoSecs);
else if (agoSecs < 120 * 60) // last 2 hrs
- snprintf(lastStr, sizeof(lastStr), "%lu minutes ago", agoSecs / 60);
+ snprintf(lastStr, sizeof(lastStr), "%u minutes ago", agoSecs / 60);
else
- snprintf(lastStr, sizeof(lastStr), "%lu hours ago", agoSecs / 60 / 60);
+ snprintf(lastStr, sizeof(lastStr), "%u hours ago", agoSecs / 60 / 60);
static char distStr[20];
strcpy(distStr, "? km"); // might not have location data
From 6ec368bf023dc82fa97eebe93f09e8dd16133ae4 Mon Sep 17 00:00:00 2001
From: Jm
Date: Thu, 31 Dec 2020 20:50:11 -0800
Subject: [PATCH 6/6] Commenting out upload ports
---
platformio.ini | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/platformio.ini b/platformio.ini
index 14e6ddbd..50d381c8 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -38,8 +38,8 @@ build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/n
;upload_port = /dev/ttyUSB0
;monitor_port = /dev/ttyUSB0
-upload_port = /dev/cu.SLAB_USBtoUART
-monitor_port = /dev/cu.SLAB_USBtoUART
+;upload_port = /dev/cu.SLAB_USBtoUART
+;monitor_port = /dev/cu.SLAB_USBtoUART
; the default is esptool
; upload_protocol = esp-prog