#define IS_ESP32S3 true
#define HAS_DISPLAY true
//ESP32-S3 no bluetooth classic
- //#define HAS_BLUETOOTH true
#define HAS_BLUETOOTH false
- //#define HAS_BLE true
// TODO BLE
#define HAS_BLE false
// Cannot run wifi and BLE at same time?
#define HAS_CONSOLE false
#define HAS_EEPROM true
+ // Only one LED on pin 35
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 35;
const int pin_led_tx = 2;
#endif
#define MODEM SX1262
+ // TODO TCXO?
//#define HAS_TCXO true
#define HAS_TCXO false
+ const int pin_tcxo_enable = -1;
#define HAS_BUSY true
#define DIO2_AS_RF_SWITCH true
- const int pin_tcxo_enable = -1;
// following pins are for the sx1262
const int pin_cs = 8;
#define SDA_OLED 4
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
#define DISP_RST 21
- //#define DISP_RST -1
#define DISP_ADDR 0x3C
#define SCL_OLED 18
#define SDA_OLED 17
#elif BOARD_MODEL == BOARD_HELTEC32_V2
Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
- Serial.println("display - 1 ");
- // vext
+ // enable vext / pin 36
pinMode(Vext, OUTPUT);
- //digitalWrite(36, LOW);
digitalWrite(Vext, LOW);
- delay(500);
- Serial.println("display - 2 ");
- //Serial.print("vext ");
- //Serial.println(Vext);
+ delay(50);
int pin_display_en = 21;
- //digitalWrite(pin_display_en, HIGH);
- //delay(50);
pinMode(pin_display_en, OUTPUT);
digitalWrite(pin_display_en, LOW);
delay(50);
digitalWrite(pin_display_en, HIGH);
delay(50);
Wire.begin(SDA_OLED, SCL_OLED);
- // ble debug
- //Serial.println("Setup display pins LORA32 V3");
- Serial.println("vext ");
- Serial.println(Vext);
#elif BOARD_MODEL == BOARD_LORA32_V1_0
int pin_display_en = 16;
digitalWrite(pin_display_en, LOW);
display.setRotation(1);
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
disp_mode = DISP_MODE_PORTRAIT;
+ // Antenna conx up
display.setRotation(1);
+ // USB-C up
//display.setRotation(3);
#else
disp_mode = DISP_MODE_PORTRAIT;
disp_area.cp437(true);
display.cp437(true);
- Serial.print("(1)display int= ");
- Serial.println(display_intensity);
display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
- Serial.print("(2)display int= ");
- Serial.println(display_intensity);
- display_intensity = 100;
- Serial.print("(2)display int= ");
- Serial.println(display_intensity);
return true;
}
}
void update_disp_area() {
- // ble debug
- Serial.println("...update disp area...");
draw_disp_area();
display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
if (disp_mode == DISP_MODE_LANDSCAPE) {
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
firmware-heltec32_v3:
- arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\""
+ arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3a\""
firmware-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
}
disp_ready = display_init();
- // ble debug
- Serial.print("disp ready = ");
- Serial.println(disp_ready);
update_display();
#endif
}
void update_radio_lock() {
- // ble debug
- //static char lock[40];
- //sprintf(lock, "lock chk %d %d %x %d", lora_freq, lora_bw, lora_txp, lora_sf);
- //Serial.println(lock);
if (lora_freq != 0 && lora_bw != 0 && lora_txp != 0xFF && lora_sf != 0) {
radio_locked = false;
} else {
lora_freq = freq;
if (op_mode == MODE_HOST) setFrequency();
kiss_indicate_frequency();
- // ble debug
- //Serial.print("freq ");
- //Serial.println(lora_freq);
}
}
} else if (command == CMD_BANDWIDTH) {
} else if (sbyte == 0x01) {
startRadio();
kiss_indicate_radiostate();
- // ble debug
- //Serial.println("start radio");
}
} else if (command == CMD_ST_ALOCK) {
if (sbyte == FESC) {
uint8_t F_WDR = 0x01;
#endif
- // ble debug
- Serial.print("hw_ready ");
- Serial.print(hw_ready);
- Serial.print(" device init done ");
- Serial.println(device_init_done);
if (hw_ready || device_init_done) {
hw_ready = false;
Serial.write("Error, invalid hardware check state\r\n");
}
if (boot_vector == START_FROM_BOOTLOADER || boot_vector == START_FROM_POWERON) {
- //if (eeprom_lock_set()) {
- if (1) {
+ if (eeprom_lock_set()) {
if (eeprom_product_valid() && eeprom_model_valid() && eeprom_hwrev_valid()) {
if (eeprom_checksum_valid()) {
eeprom_ok = true;
if (modem_installed) {
#if PLATFORM == PLATFORM_ESP32
if (device_init()) {
- // ble debug
- Serial.println("hw ready 1");
hw_ready = true;
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 1");
}
#else
hw_ready = true;
- // ble debug
- Serial.println("hw ready 2");
#endif
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 3");
- Serial.write("No valid radio module found\r\n");
#if HAS_DISPLAY
if (disp_ready) {
device_init_done = true;
eeprom_conf_load();
op_mode = MODE_TNC;
startRadio();
- // ble debug
- Serial.println("hw ready - start radio");
-
}
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 4");
#if HAS_DISPLAY
if (disp_ready) {
device_init_done = true;
}
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 5 - override - TODO");
-
- // override eeprom flags - ble debug
- hw_ready = true;
- //
-
#if HAS_DISPLAY
if (disp_ready) {
device_init_done = true;
update_display();
- // ble debug
- Serial.println("update display called");
}
#endif
}
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 6");
#if HAS_DISPLAY
if (disp_ready) {
device_init_done = true;
}
} else {
hw_ready = false;
- // ble debug
- Serial.println("hw ! ready 7 - bad boot vector");
- Serial.write("Error, incorrect boot vector\r\n");
#if HAS_DISPLAY
if (disp_ready) {
device_init_done = true;
#include "Device.h"
#endif
#if MCU_VARIANT == MCU_ESP32
- //#if BOARD_MODEL != BOARD_RNODE_NG_22 && BOARD_MODEL != BOARD_HELTEC_LORA32_V3
- // #include "soc/rtc_wdt.h"
- //#else
+ #if BOARD_MODEL == BOARD_HELTEC_LORA32_V3
//https://github.com/espressif/esp-idf/issues/8855
#include "hal/wdt_hal.h"
- //#endif
+ #elif BOARD_MODEL != BOARD_RNODE_NG_22
+ #include "soc/rtc_wdt.h"
+ #endif
#define ISR_VECT IRAM_ATTR
#else
#define ISR_VECT