Initial T-Echo support
parent
13266c96db
commit
2d2d90847a
64
Boards.h
64
Boards.h
|
@ -95,6 +95,11 @@
|
|||
#define MODEL_C6 0xC6 // Heltec Mesh Node T114, 470-510 MHz
|
||||
#define MODEL_C7 0xC7 // Heltec Mesh Node T114, 863-928 MHz
|
||||
|
||||
#define PRODUCT_TECHO 0x15 // LilyGO T-Echo devices
|
||||
#define BOARD_TECHO 0x44
|
||||
#define MODEL_16 0x16 // T-Echo 433 MHz
|
||||
#define MODEL_17 0x17 // T-Echo 868/915 MHz
|
||||
|
||||
#define PRODUCT_RAK4631 0x10
|
||||
#define BOARD_RAK4631 0x51
|
||||
#define MODEL_11 0x11 // RAK4631, 433 Mhz
|
||||
|
@ -631,6 +636,58 @@
|
|||
const int pin_led_tx = LED_GREEN;
|
||||
const int pin_tcxo_enable = -1;
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
#define _PINNUM(port, pin) ((port) * 32 + (pin))
|
||||
#define MODEM SX1262
|
||||
#define HAS_EEPROM false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_PMU false
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_TCXO true
|
||||
#define HAS_BUSY true
|
||||
#define HAS_INPUT true
|
||||
#define HAS_SLEEP true
|
||||
#define BLE_MANUFACTURER "LilyGO"
|
||||
#define BLE_MODEL "T-Echo"
|
||||
|
||||
#define HAS_INPUT true
|
||||
#define EEPROM_SIZE 296
|
||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 32768
|
||||
#define CONFIG_QUEUE_SIZE 6144
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||
|
||||
#define HAS_DISPLAY true
|
||||
#define HAS_BACKLIGHT true
|
||||
#define DISPLAY_SCALE 1
|
||||
#define PIN_VEXT_EN _PINNUM(0, 12)
|
||||
const int pin_disp_cs = 30;
|
||||
const int pin_disp_dc = 28;
|
||||
const int pin_disp_reset = 2;
|
||||
const int pin_disp_busy = 3;
|
||||
const int pin_disp_en = -1;
|
||||
const int pin_disp_sck = 31;
|
||||
const int pin_disp_mosi = 29;
|
||||
const int pin_disp_miso = -1;
|
||||
const int pin_backlight = 43;
|
||||
|
||||
const int pin_btn_usr1 = 42;
|
||||
|
||||
const int pin_reset = 25;
|
||||
const int pin_cs = 24;
|
||||
const int pin_sclk = 19;
|
||||
const int pin_mosi = 22;
|
||||
const int pin_miso = 23;
|
||||
const int pin_busy = 17;
|
||||
const int pin_dio = 20;
|
||||
const int pin_tcxo_enable = 21;
|
||||
const int pin_led_rx = 14;
|
||||
const int pin_led_tx = 14;
|
||||
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#define MODEM SX1262
|
||||
#define HAS_EEPROM false
|
||||
|
@ -652,13 +709,10 @@
|
|||
#define EEPROM_SIZE 296
|
||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||
#define BLE_MANUFACTURER "Heltec"
|
||||
#define BLE_MODEL "HT-n5262"
|
||||
#define BLE_MODEL "T114"
|
||||
|
||||
// ADC
|
||||
#define PIN_T114_ADC_EN 6
|
||||
|
||||
// External sensors
|
||||
#define PIN_T114_VEXT_EN 21
|
||||
#define PIN_VEXT_EN 21
|
||||
|
||||
// LED
|
||||
#define LED_T114_GREEN 3
|
||||
|
|
1
Config.h
1
Config.h
|
@ -207,6 +207,7 @@
|
|||
uint8_t battery_state = 0x00;
|
||||
uint8_t display_intensity = 0xFF;
|
||||
uint8_t display_addr = 0xFF;
|
||||
volatile bool display_updating = false;
|
||||
bool display_blanking_enabled = false;
|
||||
bool display_diagnostics = true;
|
||||
bool device_init_done = false;
|
||||
|
|
150
Display.h
150
Display.h
|
@ -16,21 +16,33 @@
|
|||
#include "Graphics.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
|
||||
#if BOARD_MODEL == BOARD_TDECK
|
||||
#include <Adafruit_ST7789.h>
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#include "ST7789.h"
|
||||
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
#include <Adafruit_SH110X.h>
|
||||
#if BOARD_MODEL != BOARD_TECHO
|
||||
#if BOARD_MODEL == BOARD_TDECK
|
||||
#include <Adafruit_ST7789.h>
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#include "ST7789.h"
|
||||
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
#include <Adafruit_SH110X.h>
|
||||
#else
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
void (*display_callback)();
|
||||
void display_add_callback(void (*callback)()) { display_callback = callback; }
|
||||
void busyCallback(const void* p) { display_callback(); }
|
||||
#define SSD1306_BLACK GxEPD_BLACK
|
||||
#define SSD1306_WHITE GxEPD_WHITE
|
||||
#include <GxEPD2_BW.h>
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#include "Fonts/Org_01.h"
|
||||
#define DISP_W 128
|
||||
#define DISP_H 64
|
||||
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_MODEL == BOARD_LORA32_V2_0
|
||||
#define DISP_RST -1
|
||||
#define DISP_ADDR 0x3C
|
||||
|
@ -62,6 +74,11 @@
|
|||
#define DISP_ADDR 0x3C
|
||||
#define SCL_OLED 17
|
||||
#define SDA_OLED 18
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
SPIClass displaySPI = SPIClass(NRF_SPIM0, pin_disp_miso, pin_disp_sck, pin_disp_mosi);
|
||||
#define DISP_W 128
|
||||
#define DISP_H 64
|
||||
#define DISP_ADDR -1
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
#define DISP_RST -1
|
||||
#define DISP_ADDR 0x3C
|
||||
|
@ -88,10 +105,18 @@
|
|||
Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &Wire, -1);
|
||||
#define SSD1306_WHITE SH110X_WHITE
|
||||
#define SSD1306_BLACK SH110X_BLACK
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
|
||||
uint32_t last_epd_refresh = 0;
|
||||
uint32_t last_epd_full_refresh = 0;
|
||||
#define REFRESH_PERIOD 300000
|
||||
#else
|
||||
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
|
||||
#endif
|
||||
|
||||
float disp_target_fps = 7;
|
||||
float epd_update_fps = 0.5;
|
||||
|
||||
#define DISP_MODE_UNKNOWN 0x00
|
||||
#define DISP_MODE_LANDSCAPE 0x01
|
||||
#define DISP_MODE_PORTRAIT 0x02
|
||||
|
@ -107,8 +132,8 @@ uint8_t display_unblank_intensity = display_intensity;
|
|||
bool display_blanked = false;
|
||||
bool display_tx = false;
|
||||
bool recondition_display = false;
|
||||
uint8_t disp_target_fps = 7;
|
||||
int disp_update_interval = 1000/disp_target_fps;
|
||||
int epd_update_interval = 1000/disp_target_fps;
|
||||
uint32_t last_page_flip = 0;
|
||||
int page_interval = 4000;
|
||||
bool device_signatures_ok();
|
||||
|
@ -129,19 +154,7 @@ GFXcanvas1 disp_area(64, 64);
|
|||
void fillRect(int16_t x, int16_t y, int16_t width, int16_t height, uint16_t colour);
|
||||
|
||||
void update_area_positions() {
|
||||
#if BOARD_MODEL != BOARD_HELTEC_T114
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
p_ad_x = 0 * DISPLAY_SCALE;
|
||||
p_ad_y = 0 * DISPLAY_SCALE;
|
||||
p_as_x = 0 * DISPLAY_SCALE;
|
||||
p_as_y = 64 * DISPLAY_SCALE;
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
p_ad_x = 0 * DISPLAY_SCALE;
|
||||
p_ad_y = 0 * DISPLAY_SCALE;
|
||||
p_as_x = 64 * DISPLAY_SCALE;
|
||||
p_as_y = 0 * DISPLAY_SCALE;
|
||||
}
|
||||
#else
|
||||
#if BOARD_MODEL == BOARD_HELTEC_T114
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
p_ad_x = 16;
|
||||
p_ad_y = 64;
|
||||
|
@ -153,6 +166,30 @@ void update_area_positions() {
|
|||
p_as_x = 126;
|
||||
p_as_y = p_ad_y;
|
||||
}
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
p_ad_x = 61;
|
||||
p_ad_y = 36;
|
||||
p_as_x = 64;
|
||||
p_as_y = 64+36;
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
p_ad_x = 0;
|
||||
p_ad_y = 0;
|
||||
p_as_x = 64;
|
||||
p_as_y = 0;
|
||||
}
|
||||
#else
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
p_ad_x = 0 * DISPLAY_SCALE;
|
||||
p_ad_y = 0 * DISPLAY_SCALE;
|
||||
p_as_x = 0 * DISPLAY_SCALE;
|
||||
p_as_y = 64 * DISPLAY_SCALE;
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
p_ad_x = 0 * DISPLAY_SCALE;
|
||||
p_ad_y = 0 * DISPLAY_SCALE;
|
||||
p_as_x = 64 * DISPLAY_SCALE;
|
||||
p_as_y = 0 * DISPLAY_SCALE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -161,8 +198,9 @@ uint8_t display_contrast = 0x00;
|
|||
void set_contrast(Adafruit_SH1106G *display, uint8_t value) {
|
||||
}
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
void set_contrast(ST7789Spi *display, uint8_t value) {
|
||||
}
|
||||
void set_contrast(ST7789Spi *display, uint8_t value) { }
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
void set_contrast(uint8_t value) { }
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
void set_contrast(Adafruit_ST7789 *display, uint8_t value) {
|
||||
static uint8_t level = 0;
|
||||
|
@ -227,6 +265,13 @@ bool display_init() {
|
|||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
pinMode(PIN_T114_TFT_EN, OUTPUT);
|
||||
digitalWrite(PIN_T114_TFT_EN, LOW);
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
display.init(0, true, 10, false, displaySPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||
display.epd2.setBusyCallback(busyCallback);
|
||||
#if HAS_BACKLIGHT
|
||||
pinMode(pin_backlight, INPUT_PULLUP);
|
||||
digitalWrite(pin_backlight, HIGH);
|
||||
#endif
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
Wire.begin(SDA_OLED, SCL_OLED);
|
||||
#endif
|
||||
|
@ -261,7 +306,10 @@ bool display_init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_TDECK
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
// Don't check if display is actually connected
|
||||
if(false) {
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
display.init(240, 320);
|
||||
display.setSPISpeed(80e6);
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
|
@ -276,7 +324,9 @@ bool display_init() {
|
|||
#endif
|
||||
return false;
|
||||
} else {
|
||||
set_contrast(&display, display_contrast);
|
||||
#if BOARD_MODEL != BOARD_TECHO
|
||||
set_contrast(&display, display_contrast);
|
||||
#endif
|
||||
if (display_rotation != 0xFF) {
|
||||
if (display_rotation == 0 || display_rotation == 2) {
|
||||
disp_mode = DISP_MODE_LANDSCAPE;
|
||||
|
@ -321,6 +371,9 @@ bool display_init() {
|
|||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
disp_mode = DISP_MODE_PORTRAIT;
|
||||
display.setRotation(3);
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
disp_mode = DISP_MODE_PORTRAIT;
|
||||
display.setRotation(3);
|
||||
#else
|
||||
disp_mode = DISP_MODE_PORTRAIT;
|
||||
display.setRotation(3);
|
||||
|
@ -328,9 +381,11 @@ bool display_init() {
|
|||
}
|
||||
|
||||
update_area_positions();
|
||||
for (int i = 0; i < WATERFALL_SIZE; i++) {
|
||||
waterfall[i] = 0;
|
||||
}
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
display.setPartialWindow(p_ad_x, p_ad_y, 64, 128);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < WATERFALL_SIZE; i++) { waterfall[i] = 0; }
|
||||
|
||||
last_page_flip = millis();
|
||||
|
||||
|
@ -835,6 +890,7 @@ void display_recondition() {
|
|||
}
|
||||
|
||||
void update_display(bool blank = false) {
|
||||
display_updating = true;
|
||||
if (blank == true) {
|
||||
last_disp_update = millis()-disp_update_interval-1;
|
||||
} else {
|
||||
|
@ -858,13 +914,20 @@ void update_display(bool blank = false) {
|
|||
if (millis()-last_disp_update >= disp_update_interval) {
|
||||
if (display_contrast != display_intensity) {
|
||||
display_contrast = display_intensity;
|
||||
set_contrast(&display, display_contrast);
|
||||
#if BOARD_MODEL != BOARD_TECHO
|
||||
set_contrast(&display, display_contrast);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
display.setFullWindow();
|
||||
display.fillScreen(SSD1306_WHITE);
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_HELTEC_T114
|
||||
display.clear();
|
||||
display.display();
|
||||
#elif BOARD_MODEL != BOARD_TDECK
|
||||
#elif BOARD_MODEL != BOARD_TDECK && BOARD_MODEL != BOARD_TECHO
|
||||
display.clearDisplay();
|
||||
display.display();
|
||||
#else
|
||||
|
@ -873,16 +936,20 @@ void update_display(bool blank = false) {
|
|||
|
||||
last_disp_update = millis();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (millis()-last_disp_update >= disp_update_interval) {
|
||||
uint32_t current = millis();
|
||||
if (display_contrast != display_intensity) {
|
||||
display_contrast = display_intensity;
|
||||
set_contrast(&display, display_contrast);
|
||||
#if BOARD_MODEL != BOARD_TECHO
|
||||
set_contrast(&display, display_contrast);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BOARD_MODEL == BOARD_HELTEC_T114
|
||||
display.clear();
|
||||
#elif BOARD_MODEL != BOARD_TDECK
|
||||
#elif BOARD_MODEL != BOARD_TDECK && BOARD_MODEL != BOARD_TECHO
|
||||
display.clearDisplay();
|
||||
#endif
|
||||
|
||||
|
@ -891,16 +958,29 @@ void update_display(bool blank = false) {
|
|||
disp_update_interval = 1000/disp_target_fps;
|
||||
display_recondition();
|
||||
} else {
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
display.setPartialWindow(p_ad_x, p_ad_y, 64, 128);
|
||||
display.fillScreen(SSD1306_WHITE);
|
||||
#endif
|
||||
|
||||
update_stat_area();
|
||||
update_disp_area();
|
||||
}
|
||||
|
||||
#if BOARD_MODEL != BOARD_TDECK
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
if (current-last_epd_refresh >= epd_update_interval) {
|
||||
if (current-last_epd_full_refresh >= REFRESH_PERIOD) { display.display(false); last_epd_full_refresh = millis(); }
|
||||
else { display.display(true); }
|
||||
last_epd_refresh = millis();
|
||||
}
|
||||
#elif BOARD_MODEL != BOARD_TDECK
|
||||
display.display();
|
||||
#endif
|
||||
|
||||
last_disp_update = millis();
|
||||
}
|
||||
}
|
||||
display_updating = false;
|
||||
}
|
||||
|
||||
void display_unblank() {
|
||||
|
|
10
Makefile
10
Makefile
|
@ -47,6 +47,8 @@ prep-nrf:
|
|||
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||
arduino-cli core install rakwireless:nrf52 --config-file arduino-cli.yaml
|
||||
arduino-cli core install Heltec_nRF52:Heltec_nRF52 --config-file arduino-cli.yaml
|
||||
arduino-cli core install adafruit:nrf52 --config-file arduino-cli.yaml
|
||||
arduino-cli lib install "GxEPD2"
|
||||
arduino-cli config set library.enable_unsafe_install true
|
||||
arduino-cli lib install --git-url https://github.com/liamcottle/esp8266-oled-ssd1306#e16cee124fe26490cb14880c679321ad8ac89c95
|
||||
pip install adafruit-nrfutil --upgrade
|
||||
|
@ -138,6 +140,9 @@ firmware-rak4631:
|
|||
firmware-heltec_t114:
|
||||
arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\""
|
||||
|
||||
firmware-techo:
|
||||
arduino-cli compile --log --fqbn adafruit:nrf52:pca10056 -e --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x44\""
|
||||
|
||||
upload:
|
||||
arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode
|
||||
|
||||
|
@ -245,6 +250,11 @@ upload-heltec_t114:
|
|||
@sleep 1
|
||||
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0)
|
||||
|
||||
upload-techo:
|
||||
arduino-cli upload -p /dev/ttyACM0 --fqbn adafruit:nrf52:pca10056
|
||||
@sleep 6
|
||||
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0)
|
||||
|
||||
release: release-all
|
||||
|
||||
release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v3 release-heltec32_v2_extled release-heltec_t114 release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-t3s3_sx127x release-t3s3_sx1280_pa release-tdeck release-tbeam_supreme release-rak4631 release-hashes
|
||||
|
|
20
Power.h
20
Power.h
|
@ -128,6 +128,22 @@
|
|||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
float bat_state_change_v = 0;
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
#define BAT_V_MIN 3.15
|
||||
#define BAT_V_MAX 4.2
|
||||
#define BAT_V_CHG 4.48
|
||||
#define BAT_V_FLOAT 4.33
|
||||
#define BAT_SAMPLES 7
|
||||
const uint8_t pin_vbat = 4;
|
||||
float bat_p_samples[BAT_SAMPLES];
|
||||
float bat_v_samples[BAT_SAMPLES];
|
||||
uint8_t bat_samples_count = 0;
|
||||
int bat_discharging_samples = 0;
|
||||
int bat_charging_samples = 0;
|
||||
int bat_charged_samples = 0;
|
||||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
float bat_state_change_v = 0;
|
||||
#endif
|
||||
|
||||
uint32_t last_pmu_update = 0;
|
||||
|
@ -138,7 +154,7 @@ uint8_t pmu_rc = 0;
|
|||
void kiss_indicate_battery();
|
||||
|
||||
void measure_battery() {
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC_T114
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC_T114 || BOARD_MODEL == BOARD_TECHO
|
||||
battery_installed = true;
|
||||
battery_indeterminate = true;
|
||||
|
||||
|
@ -148,6 +164,8 @@ void measure_battery() {
|
|||
float battery_measurement = (float)(analogRead(pin_vbat)) / 4095.0*6.7828;
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
float battery_measurement = (float)(analogRead(pin_vbat)) * 0.017165;
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
float battery_measurement = (float)(analogRead(pin_vbat)) * 0.017165;
|
||||
#else
|
||||
float battery_measurement = (float)(analogRead(pin_vbat)) / 4095.0*7.26;
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,16 @@ char sbuf[128];
|
|||
#endif
|
||||
|
||||
void setup() {
|
||||
|
||||
pinMode(pin_led_rx, OUTPUT);
|
||||
pinMode(pin_led_tx, OUTPUT);
|
||||
while (true) {
|
||||
delay(300);
|
||||
led_rx_on();
|
||||
delay(300);
|
||||
led_rx_off();
|
||||
}
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
boot_seq();
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
|
@ -75,6 +85,12 @@ void setup() {
|
|||
|
||||
pinMode(DISPLAY_BL_PIN, OUTPUT);
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
pinMode(PIN_VEXT_EN, OUTPUT);
|
||||
digitalWrite(PIN_VEXT_EN, HIGH);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_NRF52
|
||||
|
@ -105,11 +121,11 @@ void setup() {
|
|||
led_init();
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1
|
||||
// Some boards need to wait until the hardware UART is set up before booting
|
||||
// the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait
|
||||
// until a serial connection is actually established with a master. Thus, it
|
||||
// is disabled on this platform.
|
||||
#if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_TECHO && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1
|
||||
// Some boards need to wait until the hardware UART is set up before booting
|
||||
// the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait
|
||||
// until a serial connection is actually established with a master. Thus, it
|
||||
// is disabled on this platform.
|
||||
while (!Serial);
|
||||
#endif
|
||||
|
||||
|
@ -211,6 +227,10 @@ void setup() {
|
|||
eeprom_update(eeprom_addr(ADDR_CONF_DSET), CONF_OK_BYTE);
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
|
||||
}
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
display_add_callback(work_while_waiting);
|
||||
#endif
|
||||
|
||||
display_unblank();
|
||||
disp_ready = display_init();
|
||||
update_display();
|
||||
|
@ -1491,6 +1511,8 @@ void tx_queue_handler() {
|
|||
}
|
||||
}
|
||||
|
||||
void work_while_waiting() { loop(); }
|
||||
|
||||
void loop() {
|
||||
if (radio_online) {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
|
@ -1562,7 +1584,7 @@ void loop() {
|
|||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) update_display();
|
||||
if (disp_ready && !display_updating) update_display();
|
||||
#endif
|
||||
|
||||
#if HAS_PMU
|
||||
|
@ -1612,9 +1634,12 @@ void sleep_now() {
|
|||
#elif PLATFORM == PLATFORM_NRF52
|
||||
#if BOARD_MODEL == BOARD_HELTEC_T114
|
||||
npset(0,0,0);
|
||||
digitalWrite(PIN_T114_VEXT_EN, LOW);
|
||||
digitalWrite(PIN_VEXT_EN, LOW);
|
||||
digitalWrite(PIN_T114_TFT_BLGT, HIGH);
|
||||
digitalWrite(PIN_T114_TFT_EN, HIGH);
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
digitalWrite(PIN_VEXT_EN, LOW);
|
||||
digitalWrite(pin_backlight, LOW);
|
||||
#endif
|
||||
sd_power_gpregret_set(0, 0x6d);
|
||||
nrf_gpio_cfg_sense_input(pin_btn_usr1, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
|
||||
|
|
Binary file not shown.
19
Utilities.h
19
Utilities.h
|
@ -121,8 +121,8 @@ uint8_t boot_vector = 0x00;
|
|||
void led_init() {
|
||||
#if BOARD_MODEL == BOARD_HELTEC_T114
|
||||
// Enable vext power supply to neopixel
|
||||
pinMode(PIN_T114_VEXT_EN, OUTPUT);
|
||||
digitalWrite(PIN_T114_VEXT_EN, HIGH);
|
||||
pinMode(PIN_VEXT_EN, OUTPUT);
|
||||
digitalWrite(PIN_VEXT_EN, HIGH);
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_NRF52
|
||||
|
@ -323,7 +323,14 @@ uint8_t boot_vector = 0x00;
|
|||
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
||||
void led_id_on() { }
|
||||
void led_id_off() { }
|
||||
#endif
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
void led_rx_on() { digitalWrite(pin_led_rx, LOW); }
|
||||
void led_rx_off() { digitalWrite(pin_led_rx, HIGH); }
|
||||
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
|
||||
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
||||
void led_id_on() { }
|
||||
void led_id_off() { }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void hard_reset(void) {
|
||||
|
@ -1287,7 +1294,7 @@ void promisc_disable() {
|
|||
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
|
||||
bool eeprom_begin() {
|
||||
InternalFS.begin();
|
||||
|
||||
|
||||
file.open(EEPROM_FILE, FILE_O_READ);
|
||||
if (!file) {
|
||||
if (file.open(EEPROM_FILE, FILE_O_WRITE)) {
|
||||
|
@ -1454,7 +1461,7 @@ bool eeprom_product_valid() {
|
|||
#elif PLATFORM == PLATFORM_ESP32
|
||||
if (rval == PRODUCT_RNODE || rval == BOARD_RNODE_NG_20 || rval == BOARD_RNODE_NG_21 || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_10 || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21 || rval == PRODUCT_H32_V2 || rval == PRODUCT_H32_V3 || rval == PRODUCT_TDECK_V1 || rval == PRODUCT_TBEAM_S_V1) {
|
||||
#elif PLATFORM == PLATFORM_NRF52
|
||||
if (rval == PRODUCT_RAK4631 || rval == PRODUCT_HELTEC_T114 || rval == PRODUCT_HMBRW) {
|
||||
if (rval == PRODUCT_RAK4631 || rval == PRODUCT_HELTEC_T114 || rval == PRODUCT_TECHO || rval == PRODUCT_HMBRW) {
|
||||
#else
|
||||
if (false) {
|
||||
#endif
|
||||
|
@ -1484,6 +1491,8 @@ bool eeprom_model_valid() {
|
|||
if (model == MODEL_E4 || model == MODEL_E9 || model == MODEL_E3 || model == MODEL_E8) {
|
||||
#elif BOARD_MODEL == BOARD_TDECK
|
||||
if (model == MODEL_D4 || model == MODEL_D9) {
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
if (model == MODEL_16 || model == MODEL_17) {
|
||||
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
|
||||
if (model == MODEL_DB || model == MODEL_DC) {
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||
|
|
|
@ -3,4 +3,5 @@ board_manager:
|
|||
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
||||
- https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json
|
||||
- https://github.com/HelTecAutomation/Heltec_nRF52/releases/download/1.7.0/package_heltec_nrf_index.json
|
||||
- https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
|
||||
- http://unsigned.io/arduino/package_unsignedio_UnsignedBoards_index.json
|
||||
|
|
11
sx126x.cpp
11
sx126x.cpp
|
@ -87,7 +87,11 @@
|
|||
#define FREQ_DIV_6X (double)pow(2.0, 25.0)
|
||||
#define FREQ_STEP_6X (double)(XTAL_FREQ_6X / FREQ_DIV_6X)
|
||||
|
||||
#if defined(NRF52840_XXAA)
|
||||
#if BOARD_MODEL == BOARD_TECHO
|
||||
SPIClass spim3 = SPIClass(NRF_SPIM3, pin_miso, pin_sclk, pin_mosi) ;
|
||||
#define SPI spim3
|
||||
|
||||
#elif defined(NRF52840_XXAA)
|
||||
extern SPIClass spiModem;
|
||||
#define SPI spiModem
|
||||
#endif
|
||||
|
@ -123,6 +127,9 @@ bool sx126x::preInit() {
|
|||
|
||||
#if BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK
|
||||
SPI.begin(pin_sclk, pin_miso, pin_mosi, pin_cs);
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
SPI.setPins(pin_miso, pin_sclk, pin_mosi);
|
||||
SPI.begin();
|
||||
#else
|
||||
SPI.begin();
|
||||
#endif
|
||||
|
@ -569,6 +576,8 @@ void sx126x::enableTCXO() {
|
|||
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
|
||||
#elif BOARD_MODEL == BOARD_HELTEC_T114
|
||||
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
|
||||
#elif BOARD_MODEL == BOARD_TECHO
|
||||
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
|
||||
#endif
|
||||
executeOpcode(OP_DIO3_TCXO_CTRL_6X, buf, 4);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue