new startupScreen

This commit is contained in:
richonguzman 2024-05-07 11:19:48 -04:00
parent e0373dbc15
commit 3e73e89d08
5 changed files with 69 additions and 30 deletions

View File

@ -149,40 +149,13 @@ void setup() {
#endif
POWER_Utils::setup();
setup_display();
if (Config.notification.buzzerActive) {
pinMode(Config.notification.buzzerPinTone, OUTPUT);
pinMode(Config.notification.buzzerPinVcc, OUTPUT);
if (Config.notification.bootUpBeep) NOTIFICATION_Utils::start();
}
if (Config.notification.ledTx) pinMode(Config.notification.ledTxPin, OUTPUT);
if (Config.notification.ledMessage) pinMode(Config.notification.ledMessagePin, OUTPUT);
if (Config.notification.ledFlashlight) pinMode(Config.notification.ledFlashlightPin, OUTPUT);
POWER_Utils::externalPinSetup();
STATION_Utils::loadIndex(0);
STATION_Utils::loadIndex(1);
String workingFreq = " LoRa Freq [";
if (loraIndex == 0) {
workingFreq += "Eu]";
} else if (loraIndex == 1) {
workingFreq += "PL]";
} else if (loraIndex == 2) {
workingFreq += "UK]";
}
startupScreen(loraIndex, versionDate);
show_display(" LoRa APRS", " (TRACKER)", workingFreq, "", "Richonguzman / CA2RXU", " " + versionDate, 4000);
#ifdef HAS_TFT
cleanTFT();
#endif
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "RichonGuzman (CA2RXU) --> LoRa APRS Tracker/Station");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Version: %s", versionDate);
if (Config.ptt.active) {
pinMode(Config.ptt.io_pin, OUTPUT);
digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? HIGH : LOW);
}
MSG_Utils::loadNumMessages();
GPS_Utils::setup();
currentLoRaType = &Config.loraTypes[loraIndex];

View File

@ -435,3 +435,20 @@ void show_display(String header, String line1, String line2, String line3, Strin
#endif
delay(wait);
}
void startupScreen(uint8_t index, String version) {
String workingFreq = " LoRa Freq [";
if (index == 0) {
workingFreq += "Eu]";
} else if (index == 1) {
workingFreq += "PL]";
} else if (index == 2) {
workingFreq += "UK]";
}
show_display(" LoRa APRS", " (TRACKER)", workingFreq, "", "Richonguzman / CA2RXU", " " + version, 4000);
#ifdef HAS_TFT
cleanTFT();
#endif
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "RichonGuzman (CA2RXU) --> LoRa APRS Tracker/Station");
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Version: %s", version);
}

View File

@ -12,4 +12,6 @@ void show_display(String header, String line1, String line2, String line3, int w
void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0);
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0);
void startupScreen(uint8_t index, String version);
#endif

View File

@ -232,6 +232,46 @@ namespace POWER_Utils {
#endif
}
void externalPinSetup() {
if (Config.notification.buzzerActive && Config.notification.buzzerPinTone >= 0 && Config.notification.buzzerPinVcc >= 0) {
pinMode(Config.notification.buzzerPinTone, OUTPUT);
pinMode(Config.notification.buzzerPinVcc, OUTPUT);
if (Config.notification.bootUpBeep) NOTIFICATION_Utils::start();
} else if (Config.notification.buzzerActive && (Config.notification.buzzerPinTone < 0 || Config.notification.buzzerPinVcc < 0)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "PINOUT", "Buzzer Pins bad/not defined");
while (1);
}
if (Config.notification.ledTx && Config.notification.ledTxPin >= 0) {
pinMode(Config.notification.ledTxPin, OUTPUT);
} else if (Config.notification.ledTx && Config.notification.ledTxPin < 0) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "PINOUT", "Led Tx Pin bad/not defined");
while (1);
}
if (Config.notification.ledMessage && Config.notification.ledMessagePin >= 0) {
pinMode(Config.notification.ledMessagePin, OUTPUT);
} else if (Config.notification.ledMessage && Config.notification.ledMessagePin < 0) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "PINOUT", "Led Message Pin bad/not defined");
while (1);
}
if (Config.notification.ledFlashlight && Config.notification.ledFlashlightPin >= 0) {
pinMode(Config.notification.ledFlashlightPin, OUTPUT);
} else if (Config.notification.ledFlashlight && Config.notification.ledFlashlightPin < 0) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "PINOUT", "Led Flashlight Pin bad/not defined");
while (1);
}
if (Config.ptt.active && Config.ptt.io_pin >= 0) {
pinMode(Config.ptt.io_pin, OUTPUT);
digitalWrite(Config.ptt.io_pin, Config.ptt.reverse ? HIGH : LOW);
} else if (Config.ptt.active && Config.ptt.io_pin < 0) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "PINOUT", "PTT Pin bad/not defined");
while (1);
}
}
bool begin(TwoWire &port) {
#if defined(TTGO_T_Beam_V0_7) || defined(ESP32_DIY_LoRa_GPS) || defined(TTGO_T_LORA32_V2_1_GPS) || defined(TTGO_T_LORA32_V2_1_TNC) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(HELTEC_V3_GPS) || defined(OE5HWN_MeshCom) || defined(ESP32_C3_DIY_LoRa_GPS) || defined(HELTEC_WIRELESS_TRACKER) || defined(TTGO_T_DECK_GPS)
return true; // no powerManagment chip for this boards (only a few measure battery voltage).
@ -404,6 +444,11 @@ namespace POWER_Utils {
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
if (Config.notification.shutDownBeep) NOTIFICATION_Utils::shutDownBeep();
PMU.shutdown();
//#endif
#else
esp_sleep_enable_timer_wakeup(10 * 1000000); // 10 seconds
esp_deep_sleep_start();
#endif
}

View File

@ -33,6 +33,8 @@ namespace POWER_Utils {
void activateLoRa();
void deactivateLoRa();
void externalPinSetup();
bool begin(TwoWire &port);
void setup();