This commit is contained in:
richonguzman 2023-07-16 09:54:59 -04:00
parent f3c223b9af
commit 72d3b9a3ac
7 changed files with 29 additions and 22 deletions

View File

@ -57,7 +57,8 @@
"power": 20
},
"other": {
"showSymbolOnDisplay": true,
"showSymbolCharacter": true,
"showCustomCharacter": true,
"sendCommentAfterXBeacons": 10,
"displayEcoMode": false,
"displayTimeout": 4,

View File

@ -37,7 +37,7 @@ int myBeaconsIndex = 0;
int myBeaconsSize = Config.beacons.size();
Beacon *currentBeacon = &Config.beacons[myBeaconsIndex];
int menuDisplay = 0;
int menuDisplay = 100;
int messagesIterator = 0;
std::vector<String> loadedAPRSMessages;
@ -94,6 +94,7 @@ void setup() {
powerManagement.lowerCpuFrequency();
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", utils::getSmartBeaconState());
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Setup Done!");
menuDisplay = 0;
}
void loop() {

View File

@ -50,7 +50,8 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
loramodule.power = data["lora"]["power"].as<int>();
showSymbolOnDisplay = data["other"]["showSymbolOnDisplay"].as<bool>();
showSymbolCharacter = data["other"]["showSymbolCharacter"].as<bool>();
showCustomCharacter = data["other"]["showCustomCharacter"].as<bool>();
sendCommentAfterXBeacons = data["other"]["sendCommentAfterXBeacons"].as<int>();
displayEcoMode = data["other"]["displayEcoMode"].as<bool>();
displayTimeout = data["other"]["displayTimeout"].as<int>();

View File

@ -36,7 +36,8 @@ public:
std::vector<Beacon> beacons;
LoraModule loramodule;
bool showSymbolOnDisplay;
bool showSymbolCharacter;
bool showCustomCharacter;
int sendCommentAfterXBeacons;
bool displayEcoMode;
int displayTimeout;

View File

@ -6,10 +6,14 @@
#include "pins_config.h"
#include "display.h"
#include "configuration.h"
#include "custom_characters.h"
#define SYM_HEIGHT 14
#define SYM_WIDTH 16
extern Beacon *currentBeacon;
extern int menuDisplay;
const uint8_t *symbolsAPRS[]={runnerSymbol, carSymbol, bikeSymbol};
// T-Beams bought with soldered OLED Screen comes with only 4 pins (VCC, GND, SDA, SCL)
@ -21,7 +25,6 @@ extern logging::Logger logger;
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
// cppcheck-suppress unusedFunction
void setup_display() {
delay(500);
@ -45,21 +48,9 @@ void setup_display() {
display.setCursor(0, 0);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
//display.drawBitmap(0, 0, runnerSymbol, 8, 14, WHITE);
display.display();
}
void drawAPRSSymbol(int i) {
display.drawBitmap(
(display.width() - SYM_WIDTH), 0, symbolsAPRS[i], SYM_WIDTH, SYM_HEIGHT, 1);
display.display();
}
// cppcheck-suppress unusedFunction
void display_toggle(bool toggle) {
if (toggle) {
@ -178,6 +169,19 @@ void show_display(String header, String line1, String line2, String line3, Strin
display.println(line5);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
if (menuDisplay==0) {
int symbol;
if(currentBeacon->symbol == "[") {
symbol = 0;
} else if(currentBeacon->symbol == ">") {
symbol = 1;
} else {
symbol = 2;
}
display.drawBitmap((display.width() - SYM_WIDTH), 0, symbolsAPRS[symbol], SYM_WIDTH, SYM_HEIGHT, 1);
}
display.display();
delay(wait);
}

View File

@ -3,7 +3,6 @@
#define DISPLAY_H_
void setup_display();
void drawAPRSSymbol(int i);
void display_toggle(bool toggle);
void show_display(String header, int wait = 0);

View File

@ -56,11 +56,11 @@ void showOnScreen() {
String hdopState, firstRowMainMenu, secondRowMainMenu, thirdRowMainMenu, fourthRowMainMenu, fifthRowMainMenu, sixthRowMainMenu;
firstRowMainMenu = currentBeacon->callsign;
if (Config.showSymbolOnDisplay) {
if (Config.showSymbolCharacter && !Config.showCustomCharacter) {
for (int j=firstRowMainMenu.length();j<9;j++) {
firstRowMainMenu += " ";
}
//firstRowMainMenu += currentBeacon->symbol;
firstRowMainMenu += currentBeacon->symbol;
}
secondRowMainMenu = utils::createDateString(now()) + " " + utils::createTimeString(now());
@ -139,8 +139,8 @@ void showOnScreen() {
String(fourthRowMainMenu),
String(fifthRowMainMenu),
String(sixthRowMainMenu));
if(currentBeacon->symbol == "[") drawAPRSSymbol(0);
if(currentBeacon->symbol == ">") drawAPRSSymbol(1);
//if(currentBeacon->symbol == "[") drawAPRSSymbol(0);
//if(currentBeacon->symbol == ">") drawAPRSSymbol(1);
break;
}
}