displayEcoMode1
This commit is contained in:
parent
b0385dcbde
commit
2b90dc8368
|
|
@ -10,6 +10,7 @@ ____________________________________________________
|
|||
- Saving, Reading and Deleting Messages.
|
||||
- Asking Weather Report
|
||||
- Listening to other Trackers arround.
|
||||
- Changing Display Eco Mode (turn off after 4 seg).
|
||||
- Processor from 240Mhz to 80MHz to save almost 20% power consumption (from ~ 100mA to almost ~80mA) (Thanks Mane76).
|
||||
- All GPS beacons/packet are encoded for less time on RF/LoRa Tx.
|
||||
- 4th line of the OLED SCREEN shows Altitude+Speed+Course or Number of New Messages Received.
|
||||
|
|
@ -38,6 +39,11 @@ on the Menu 1:
|
|||
on the Menu 2:
|
||||
- 1 short press/push = Ask for Weather Report (WX report will arrive in seconds).
|
||||
- 1 long press/push = Listen to other Trackers and show distance and course to them.
|
||||
- 2 short press/pushes = Menu 3 (where you cand change Display Eco Mode and more).
|
||||
|
||||
on the Menu 3:
|
||||
- 1 short press/push = NOTHING YET... (any ideas?).
|
||||
- 1 long press/push = Change Display Eco Mode (Turn off after 4 seg).
|
||||
- 2 short press/pushes = Menu 0 (back to the Tracker Screen).
|
||||
|
||||
____________________________________________________
|
||||
|
|
@ -48,7 +54,7 @@ Timeline (Versions):
|
|||
- 2023.05.21 Adding Last-Heard LoRa Stations/Trackers
|
||||
- 2023.05.27 Adding Altitude + Speed or Course + Speed in the encoded GPS info.
|
||||
- 2023.05.29 New Config file for adding more new ideas to the Tracker.
|
||||
- 2023.06.01 Adding Turn Slope calculations for Smart Beacon
|
||||
- 2023.06.01 Adding Turn Slope calculations for Smart Beacon and Display Eco Mode
|
||||
____________________________________________________
|
||||
This code was based on the work by OE5BPA LoRa Tracker, Serge Y. Stroobandt, ON4AA in the byte-saving part of the APRS 434 firmware and Manfred DC2MH (Mane76) with the mods for multiple Callsigns and processor speed.
|
||||
- https://github.com/aprs434/lora.tracker
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@
|
|||
"power": 20
|
||||
},
|
||||
"other": {
|
||||
"displayEcoMode": false,
|
||||
"displayTimeout": 4,
|
||||
"destination": "APLR01",
|
||||
"path": "WIDE1-1",
|
||||
"overlay": "/",
|
||||
|
|
|
|||
|
|
@ -22,16 +22,13 @@ logging::Logger logger;
|
|||
|
||||
String configurationFilePath = "/tracker_config.json";
|
||||
Configuration Config(configurationFilePath);
|
||||
|
||||
static int myBeaconsIndex = 0;
|
||||
int myBeaconsSize = Config.beacons.size();
|
||||
Beacon *currentBeacon = &Config.beacons[myBeaconsIndex];
|
||||
|
||||
static int myBeaconsIndex = 0;
|
||||
int myBeaconsSize = Config.beacons.size();
|
||||
Beacon *currentBeacon = &Config.beacons[myBeaconsIndex];
|
||||
PowerManagement powerManagement;
|
||||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||
|
||||
HardwareSerial neo6m_gps(1);
|
||||
TinyGPSPlus gps;
|
||||
HardwareSerial neo6m_gps(1);
|
||||
TinyGPSPlus gps;
|
||||
|
||||
void validateConfigFile();
|
||||
void setup_lora();
|
||||
|
|
@ -43,22 +40,25 @@ String createTimeString(time_t t);
|
|||
String getSmartBeaconState();
|
||||
String padding(unsigned int number, unsigned int width);
|
||||
|
||||
static int menuDisplay = 0;
|
||||
static bool send_update = true;
|
||||
static String lastHeardTracker = "NONE";
|
||||
static int numAPRSMessages = 0;
|
||||
static int messagesIterator = 0;
|
||||
static String lastMessageAPRS = "";
|
||||
static bool noMessageWarning = false;
|
||||
static bool statusAfterBootState = true;
|
||||
static int menuDisplay = 0;
|
||||
static bool displayEcoMode = Config.displayEcoMode;
|
||||
static bool displayState = true;
|
||||
static uint32_t displayTime = millis();
|
||||
static bool send_update = true;
|
||||
static String lastHeardTracker = "NONE";
|
||||
static int numAPRSMessages = 0;
|
||||
static int messagesIterator = 0;
|
||||
static String lastMessageAPRS = "";
|
||||
static bool noMessageWarning = false;
|
||||
static bool statusAfterBootState = true;
|
||||
|
||||
String firstNearTracker = "";
|
||||
String secondNearTracker = "";
|
||||
String thirdNearTracker = "";
|
||||
String fourthNearTracker = "";
|
||||
|
||||
std::vector<String> loadedAPRSMessages;
|
||||
|
||||
String firstNearTracker = "";
|
||||
String secondNearTracker = "";
|
||||
String thirdNearTracker = "";
|
||||
String fourthNearTracker = "";
|
||||
|
||||
static uint32_t lastDeleteListenedTracker = millis();
|
||||
|
||||
void loadNumMessages() {
|
||||
|
|
@ -172,7 +172,12 @@ void sendMessage(String station, String textMessage) {
|
|||
|
||||
static void ButtonSinglePress() {
|
||||
if (menuDisplay == 0) {
|
||||
send_update = true;
|
||||
if (!displayState) {
|
||||
display_toggle(true);
|
||||
displayTime = millis();
|
||||
} else {
|
||||
send_update = true;
|
||||
}
|
||||
} else if (menuDisplay == 1) {
|
||||
loadMessagesFromMemory();
|
||||
if (noMessageWarning) {
|
||||
|
|
@ -193,6 +198,8 @@ static void ButtonSinglePress() {
|
|||
}
|
||||
} else if (menuDisplay == 20) {
|
||||
menuDisplay = 2;
|
||||
} else if (menuDisplay == 3) {
|
||||
show_display("__INFO____", "", "NOTHING YET ...", 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,6 +211,8 @@ static void ButtonLongPress() {
|
|||
myBeaconsIndex++;
|
||||
}
|
||||
statusAfterBootState = true;
|
||||
display_toggle(true);
|
||||
displayTime = millis();
|
||||
show_display("__INFO____", "", "CHANGING CALLSIGN ...", 1000);
|
||||
} else if (menuDisplay == 1) {
|
||||
deleteFile();
|
||||
|
|
@ -211,20 +220,30 @@ static void ButtonLongPress() {
|
|||
loadNumMessages();
|
||||
} else if (menuDisplay == 2) {
|
||||
menuDisplay = 20;
|
||||
} else if (menuDisplay == 3) {
|
||||
if (!displayEcoMode) {
|
||||
displayEcoMode = true;
|
||||
show_display("__DISPLAY_", "", " ECO MODE -> True", 1000);
|
||||
} else {
|
||||
displayEcoMode = false;
|
||||
show_display("__DISPLAY_", "", " ECO MODE -> False", 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ButtonDoublePress() {
|
||||
display_toggle(true);
|
||||
if (menuDisplay == 0) {
|
||||
menuDisplay = 1;
|
||||
} else if (menuDisplay == 1) {
|
||||
menuDisplay = 2;
|
||||
messagesIterator = 0;
|
||||
} else if (menuDisplay == 2) {
|
||||
menuDisplay = 3;
|
||||
} else if (menuDisplay == 3 || menuDisplay == 20) {
|
||||
menuDisplay = 0;
|
||||
} else if (menuDisplay == 20) {
|
||||
menuDisplay = 0;
|
||||
}
|
||||
displayTime = millis();
|
||||
}
|
||||
}
|
||||
|
||||
void startingStatus() {
|
||||
|
|
@ -724,11 +743,19 @@ void setup() {
|
|||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void loop() {
|
||||
uint32_t lastDisplayTime = millis() - displayTime;
|
||||
if (displayEcoMode) {
|
||||
if (menuDisplay == 0 && lastDisplayTime >= Config.displayTimeout*1000) {
|
||||
display_toggle(false);
|
||||
displayState = false;
|
||||
}
|
||||
}
|
||||
|
||||
currentBeacon = &Config.beacons[myBeaconsIndex];
|
||||
|
||||
userButton.tick();
|
||||
|
||||
while (neo6m_gps.available() > 0) {
|
||||
while (neo6m_gps.available() > 0) {
|
||||
gps.encode(neo6m_gps.read());
|
||||
}
|
||||
|
||||
|
|
@ -936,7 +963,10 @@ void loop() {
|
|||
show_display("__MENU_1__", "", "1P -> Read Msg (" + String(numAPRSMessages) + ")", "LP -> Delete Msg", "2P -> Menu 2");
|
||||
break;
|
||||
case 2:
|
||||
show_display("__MENU_2__", "", "1P -> Weather Report", "LP -> Listen Trackers", "2P -> (Back) Tracking");
|
||||
show_display("__MENU_2__", "", "1P -> Weather Report", "LP -> Listen Trackers", "2P -> Menu 3");
|
||||
break;
|
||||
case 3:
|
||||
show_display("__MENU_3__", "", "1P -> Nothing Yet", "LP -> Display EcoMode", "2P -> (Back) Tracking");
|
||||
break;
|
||||
|
||||
case 10: // Display Received/Saved APRS Messages
|
||||
|
|
@ -1046,7 +1076,7 @@ void loop() {
|
|||
void validateConfigFile() {
|
||||
if (currentBeacon->callsign == "NOCALL-7") {
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Config", "Change your settings in 'data/tracker_config.json' and upload it via 'Upload File System image'");
|
||||
show_display("ERROR", "Change your settings", "in 'data' folder", "'tracker_config.json'", "upload it via", "'Upload File System image'");
|
||||
show_display("ERROR", "Change your settings", "'tracker_config.json'", "upload it via --> ", "'Upload File System image'");
|
||||
while (true) {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public:
|
|||
std::vector<Beacon> beacons;
|
||||
LoraModule loramodule;
|
||||
|
||||
bool displayEcoMode;
|
||||
int displayTimeout;
|
||||
String destination;
|
||||
String path;
|
||||
String overlay;
|
||||
|
|
@ -93,13 +95,15 @@ private:
|
|||
|
||||
beacons.push_back(bcn);
|
||||
}
|
||||
|
||||
|
||||
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
||||
loramodule.power = data["lora"]["power"].as<int>();
|
||||
|
||||
displayEcoMode = data["other"]["displayEcoMode"].as<bool>();
|
||||
displayTimeout = data["other"]["displayTimeout"].as<int>();
|
||||
destination = data["other"]["destination"].as<String>();
|
||||
path = data["other"]["path"].as<String>();
|
||||
overlay = data["other"]["overlay"].as<String>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue