Skip to content

Commit

Permalink
add support for LoPy4, fixes #42
Browse files Browse the repository at this point in the history
  • Loading branch information
paidforby committed May 14, 2020
1 parent 7f60265 commit 6f6cc8b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
2 changes: 2 additions & 0 deletions firmware/esp32/client/OLEDClient.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "OLEDClient.h"

#ifdef OLED_SDA
#define LINE_HEIGHT 10

void OLEDClient::loop()
Expand Down Expand Up @@ -42,3 +43,4 @@ void OLEDClient::receive(struct Datagram datagram, size_t len)
needs_display = true;
}
}
#endif
2 changes: 2 additions & 0 deletions firmware/esp32/client/OLEDClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "../DisasterServer.h"
#include "../config.h"

#ifdef OLED_SDA
#include "SSD1306Wire.h"
#include <list>

Expand All @@ -30,3 +31,4 @@ class OLEDClient : public DisasterClient
};

#endif
#endif
6 changes: 6 additions & 0 deletions firmware/esp32/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,10 @@
#define OLED_HEIGHT 128
#endif

#ifdef LOPY4
// all necessary pins are defined in the arduino-esp32 variants
// https://github.com/espressif/arduino-esp32/blob/master/variants/lopy4/pins_arduino.h
// any additional board specifc settings should be added here
#endif

#endif
3 changes: 3 additions & 0 deletions firmware/esp32/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ void setupLoRa()
#ifdef LORA_CS
Serial.println("* Initializing LoRa...");

#ifdef LOPY4
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
#endif
Layer1.setPins(LORA_CS, LORA_RST, LORA_IRQ);
Layer1.setLoRaFrequency(LORA_FREQ);
LL2.setLocalAddress(nodeAddress);
Expand Down
35 changes: 10 additions & 25 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
src_dir = firmware/esp32
data_dir = web/static
default_envs=
;ttgo-lora32-v1
ttgo-lora32-v2
;ttgo-lora32-tbeam
;heltec-v2
;sparkfun-lora
;ttgo-lora32-v1
ttgo-lora32-v2
;ttgo-lora32-tbeam
;heltec-v2
;sparkfun-lora
;lopy4

[env]
;platform = espressif32
platform = https://github.com/platformio/platform-espressif32.git
framework = arduino
upload_port = /dev/ttyUSB0
Expand All @@ -33,7 +33,7 @@ lib_deps =
AsyncTCP
ESP Async WebServer@1.2.3
LoRa@0.6.1
https://github.com/sudomesh/LoRaLayer2#e8b5c4b8b8e675d9781c7673f25f49a1e653a4be
https://github.com/sudomesh/LoRaLayer2#5e505cf05610dd771bb8a4f03730b6ee64fc9278
https://github.com/paidforby/AsyncSDServer#13375c6be978cb34180378ecf4042a3a4a1f5eab
ESP8266 and ESP32 OLED driver for SSD1306 displays
TinyGPSPlus@1.0.2
Expand All @@ -42,41 +42,26 @@ lib_deps =
[env:ttgo-lora32-v1]
board = ttgo-lora32-v1
build_flags = -DTTGO_LORA_V1
;-DUSE_BLE

[env:ttgo-lora32-v2]
board = ttgo-lora32-v1
build_flags = -DTTGO_LORA_V2
;-DUSE_BLE

[env:ttgo-lora32-tbeam]
board = ttgo-lora32-v1
build_flags = -DTTGO_TBEAM
;-DUSE_BLE

[env:heltec-v2]
board = heltec_wifi_lora_32_V2
build_flags = -DHELTEC
;-DUSE_BLE

; When using BLE set compiler flag #define USE_BLE
; BLE is using more program space, required to set custom partition with larger app partition and OTA disabled
[env:sparkfun-lora]
board = sparkfun_lora_gateway_1-channel
;upload_port = COM17
build_flags =
-DSPARKFUN
;-DUSE_BLE
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

; TODO: esp8266 versions?

; for portable (wemos d1 mini) use these settings:
;BOARD = d1_mini
;FLASH_DEF = 4M1M
;UPLOAD_RESET = nodemcu

; for solar node use these settings:
;BOARD = generic
;FLASH_DEF = 1M512
;UPLOAD_RESET = none
[env:lopy4]
board = lopy4
build_flags = -DLOPY4

0 comments on commit 6f6cc8b

Please sign in to comment.