Clean up debug prints for PR

This commit is contained in:
Kevin Brosius 2024-03-11 12:35:29 -04:00
parent 36ab438625
commit 5c1e0f25ee
5 changed files with 13 additions and 78 deletions

View File

@ -261,14 +261,13 @@
#define IS_ESP32S3 true #define IS_ESP32S3 true
#define HAS_DISPLAY true #define HAS_DISPLAY true
//ESP32-S3 no bluetooth classic //ESP32-S3 no bluetooth classic
//#define HAS_BLUETOOTH true
#define HAS_BLUETOOTH false #define HAS_BLUETOOTH false
//#define HAS_BLE true
// TODO BLE // TODO BLE
#define HAS_BLE false #define HAS_BLE false
// Cannot run wifi and BLE at same time? // Cannot run wifi and BLE at same time?
#define HAS_CONSOLE false #define HAS_CONSOLE false
#define HAS_EEPROM true #define HAS_EEPROM true
// Only one LED on pin 35
#if defined(EXTERNAL_LEDS) #if defined(EXTERNAL_LEDS)
const int pin_led_rx = 35; const int pin_led_rx = 35;
const int pin_led_tx = 2; const int pin_led_tx = 2;
@ -278,11 +277,12 @@
#endif #endif
#define MODEM SX1262 #define MODEM SX1262
// TODO TCXO?
//#define HAS_TCXO true //#define HAS_TCXO true
#define HAS_TCXO false #define HAS_TCXO false
const int pin_tcxo_enable = -1;
#define HAS_BUSY true #define HAS_BUSY true
#define DIO2_AS_RF_SWITCH true #define DIO2_AS_RF_SWITCH true
const int pin_tcxo_enable = -1;
// following pins are for the sx1262 // following pins are for the sx1262
const int pin_cs = 8; const int pin_cs = 8;

View File

@ -34,7 +34,6 @@
#define SDA_OLED 4 #define SDA_OLED 4
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
#define DISP_RST 21 #define DISP_RST 21
//#define DISP_RST -1
#define DISP_ADDR 0x3C #define DISP_ADDR 0x3C
#define SCL_OLED 18 #define SCL_OLED 18
#define SDA_OLED 17 #define SDA_OLED 17
@ -115,28 +114,17 @@ bool display_init() {
#elif BOARD_MODEL == BOARD_HELTEC32_V2 #elif BOARD_MODEL == BOARD_HELTEC32_V2
Wire.begin(SDA_OLED, SCL_OLED); Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
Serial.println("display - 1 "); // enable vext / pin 36
// vext
pinMode(Vext, OUTPUT); pinMode(Vext, OUTPUT);
//digitalWrite(36, LOW);
digitalWrite(Vext, LOW); digitalWrite(Vext, LOW);
delay(500); delay(50);
Serial.println("display - 2 ");
//Serial.print("vext ");
//Serial.println(Vext);
int pin_display_en = 21; int pin_display_en = 21;
//digitalWrite(pin_display_en, HIGH);
//delay(50);
pinMode(pin_display_en, OUTPUT); pinMode(pin_display_en, OUTPUT);
digitalWrite(pin_display_en, LOW); digitalWrite(pin_display_en, LOW);
delay(50); delay(50);
digitalWrite(pin_display_en, HIGH); digitalWrite(pin_display_en, HIGH);
delay(50); delay(50);
Wire.begin(SDA_OLED, SCL_OLED); 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 #elif BOARD_MODEL == BOARD_LORA32_V1_0
int pin_display_en = 16; int pin_display_en = 16;
digitalWrite(pin_display_en, LOW); digitalWrite(pin_display_en, LOW);
@ -180,7 +168,9 @@ bool display_init() {
display.setRotation(1); display.setRotation(1);
#elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3 #elif BOARD_MODEL == BOARD_HELTEC_LORA32_V3
disp_mode = DISP_MODE_PORTRAIT; disp_mode = DISP_MODE_PORTRAIT;
// Antenna conx up
display.setRotation(1); display.setRotation(1);
// USB-C up
//display.setRotation(3); //display.setRotation(3);
#else #else
disp_mode = DISP_MODE_PORTRAIT; disp_mode = DISP_MODE_PORTRAIT;
@ -198,14 +188,7 @@ bool display_init() {
disp_area.cp437(true); disp_area.cp437(true);
display.cp437(true); display.cp437(true);
Serial.print("(1)display int= ");
Serial.println(display_intensity);
display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT)); 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; return true;
} }
@ -566,8 +549,6 @@ void draw_disp_area() {
} }
void update_disp_area() { void update_disp_area() {
// ble debug
Serial.println("...update disp area...");
draw_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); 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) { if (disp_mode == DISP_MODE_LANDSCAPE) {

View File

@ -94,7 +94,7 @@ firmware-heltec32_v2_extled:
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\"" 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: 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: 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\"" 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\""

View File

@ -143,9 +143,6 @@ void setup() {
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF); eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
} }
disp_ready = display_init(); disp_ready = display_init();
// ble debug
Serial.print("disp ready = ");
Serial.println(disp_ready);
update_display(); update_display();
#endif #endif
@ -383,10 +380,6 @@ void stopRadio() {
} }
void update_radio_lock() { 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) { if (lora_freq != 0 && lora_bw != 0 && lora_txp != 0xFF && lora_sf != 0) {
radio_locked = false; radio_locked = false;
} else { } else {
@ -612,9 +605,6 @@ void serialCallback(uint8_t sbyte) {
lora_freq = freq; lora_freq = freq;
if (op_mode == MODE_HOST) setFrequency(); if (op_mode == MODE_HOST) setFrequency();
kiss_indicate_frequency(); kiss_indicate_frequency();
// ble debug
//Serial.print("freq ");
//Serial.println(lora_freq);
} }
} }
} else if (command == CMD_BANDWIDTH) { } else if (command == CMD_BANDWIDTH) {
@ -700,8 +690,6 @@ void serialCallback(uint8_t sbyte) {
} else if (sbyte == 0x01) { } else if (sbyte == 0x01) {
startRadio(); startRadio();
kiss_indicate_radiostate(); kiss_indicate_radiostate();
// ble debug
//Serial.println("start radio");
} }
} else if (command == CMD_ST_ALOCK) { } else if (command == CMD_ST_ALOCK) {
if (sbyte == FESC) { if (sbyte == FESC) {
@ -1075,11 +1063,6 @@ void validate_status() {
uint8_t F_WDR = 0x01; uint8_t F_WDR = 0x01;
#endif #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) { if (hw_ready || device_init_done) {
hw_ready = false; hw_ready = false;
Serial.write("Error, invalid hardware check state\r\n"); Serial.write("Error, invalid hardware check state\r\n");
@ -1110,32 +1093,22 @@ void validate_status() {
} }
if (boot_vector == START_FROM_BOOTLOADER || boot_vector == START_FROM_POWERON) { if (boot_vector == START_FROM_BOOTLOADER || boot_vector == START_FROM_POWERON) {
//if (eeprom_lock_set()) { if (eeprom_lock_set()) {
if (1) {
if (eeprom_product_valid() && eeprom_model_valid() && eeprom_hwrev_valid()) { if (eeprom_product_valid() && eeprom_model_valid() && eeprom_hwrev_valid()) {
if (eeprom_checksum_valid()) { if (eeprom_checksum_valid()) {
eeprom_ok = true; eeprom_ok = true;
if (modem_installed) { if (modem_installed) {
#if PLATFORM == PLATFORM_ESP32 #if PLATFORM == PLATFORM_ESP32
if (device_init()) { if (device_init()) {
// ble debug
Serial.println("hw ready 1");
hw_ready = true; hw_ready = true;
} else { } else {
hw_ready = false; hw_ready = false;
// ble debug
Serial.println("hw ! ready 1");
} }
#else #else
hw_ready = true; hw_ready = true;
// ble debug
Serial.println("hw ready 2");
#endif #endif
} else { } else {
hw_ready = false; hw_ready = false;
// ble debug
Serial.println("hw ! ready 3");
Serial.write("No valid radio module found\r\n");
#if HAS_DISPLAY #if HAS_DISPLAY
if (disp_ready) { if (disp_ready) {
device_init_done = true; device_init_done = true;
@ -1148,14 +1121,9 @@ void validate_status() {
eeprom_conf_load(); eeprom_conf_load();
op_mode = MODE_TNC; op_mode = MODE_TNC;
startRadio(); startRadio();
// ble debug
Serial.println("hw ready - start radio");
} }
} else { } else {
hw_ready = false; hw_ready = false;
// ble debug
Serial.println("hw ! ready 4");
#if HAS_DISPLAY #if HAS_DISPLAY
if (disp_ready) { if (disp_ready) {
device_init_done = true; device_init_done = true;
@ -1165,26 +1133,6 @@ void validate_status() {
} }
} else { } else {
hw_ready = false; 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 HAS_DISPLAY
if (disp_ready) { if (disp_ready) {
device_init_done = true; device_init_done = true;
@ -1194,9 +1142,15 @@ void validate_status() {
} }
} else { } else {
hw_ready = false; hw_ready = false;
// ble debug #if HAS_DISPLAY
Serial.println("hw ! ready 7 - bad boot vector"); if (disp_ready) {
Serial.write("Error, incorrect boot vector\r\n"); device_init_done = true;
update_display();
}
#endif
}
} else {
hw_ready = false;
#if HAS_DISPLAY #if HAS_DISPLAY
if (disp_ready) { if (disp_ready) {
device_init_done = true; device_init_done = true;

View File

@ -60,12 +60,12 @@ sx128x *LoRa = &sx128x_modem;
#include "Device.h" #include "Device.h"
#endif #endif
#if MCU_VARIANT == MCU_ESP32 #if MCU_VARIANT == MCU_ESP32
//#if BOARD_MODEL != BOARD_RNODE_NG_22 && BOARD_MODEL != BOARD_HELTEC_LORA32_V3 #if BOARD_MODEL == BOARD_HELTEC_LORA32_V3
// #include "soc/rtc_wdt.h"
//#else
//https://github.com/espressif/esp-idf/issues/8855 //https://github.com/espressif/esp-idf/issues/8855
#include "hal/wdt_hal.h" #include "hal/wdt_hal.h"
//#endif #elif BOARD_MODEL != BOARD_RNODE_NG_22
#include "soc/rtc_wdt.h"
#endif
#define ISR_VECT IRAM_ATTR #define ISR_VECT IRAM_ATTR
#else #else
#define ISR_VECT #define ISR_VECT