display obj updated

This commit is contained in:
richonguzman 2024-01-22 14:06:05 -03:00
parent 31aeea27e3
commit 39e61a70b1
7 changed files with 97 additions and 74 deletions

View File

@ -1,7 +1,7 @@
{
"beacons": [
{
"callsign": "NOCALL-7",
"callsign": "CA2RXU-7",
"symbol": "[",
"overlay": "/",
"micE": "",
@ -19,7 +19,7 @@
}
},
{
"callsign": "NOCALL-7",
"callsign": "CA2RXU-7",
"symbol": ">",
"overlay": "/",
"micE": "",
@ -37,7 +37,7 @@
}
},
{
"callsign": "NOCALL-7",
"callsign": "CA2RXU-7",
"symbol": "b",
"overlay": "/",
"micE": "",
@ -55,19 +55,15 @@
}
}
],
"lora": {
"frequency": 433775000,
"spreadingFactor": 12,
"signalBandwidth": 125000,
"codingRate4": 5,
"power": 20
},
"display": {
"showSymbol": true,
"ecoMode": true,
"timeout": 4,
"turn180" : false
},
"other": {
"simplifiedTrackerMode": false,
"showSymbolOnScreen": true,
"sendCommentAfterXBeacons": 10,
"displayEcoMode": false,
"displayTimeout": 4,
"path": "WIDE1-1",
"nonSmartBeaconRate": 15,
"rememberStationTime": 30,
@ -75,36 +71,46 @@
"standingUpdateTime": 15,
"sendAltitude": true,
"sendBatteryInfo": false,
"bluetoothType": 1,
"bluetoothType": 0,
"bluetoothActive": true,
"disableGPS": false
},
"winlink": {
"password": "ABCDEF"
},
"bme": {
"active": true,
"sendTelemetry": false,
"heightCorrection": 0
},
"notification": {
"ledTx": true,
"ledTxPin": 25,
"ledMessage": true,
"ledMessagePin": 13,
"ledFlashlight": true,
"ledFlashlightPin": 14,
"buzzerActive": true,
"buzzerPinTone": 4,
"buzzerPinVcc": 2,
"bootUpBeep": true,
"txBeep": false,
"messageRxBeep": true,
"stationBeep": true,
"lowBatteryBeep": false
},
"lora": {
"frequency": 433775000,
"spreadingFactor": 12,
"signalBandwidth": 125000,
"codingRate4": 5,
"power": 20
},
"pttTrigger": {
"active": false,
"io_pin": 4,
"preDelay": 0,
"postDelay": 0,
"reverse": false
},
"bme": {
"active": false,
"sendTelemetry": false,
"heightCorrection": 0
},
"notification": {
"ledTx": false,
"ledTxPin": 13,
"ledMessage": false,
"ledMessagePin": 2,
"ledFlashlight": false,
"ledFlashlightPin": 14,
"buzzerActive": false,
"buzzerPinTone": 33,
"buzzerPinVcc": 25,
"bootUpBeep": false,
"txBeep": false,
"messageRxBeep": false,
"stationBeep": false,
"lowBatteryBeep": false
}
}

View File

@ -34,7 +34,7 @@ BluetoothSerial SerialBT;
OneButton userButton = OneButton(BUTTON_PIN, true, true);
#endif
String versionDate = "2024.01.18";
String versionDate = "2024.01.22";
int myBeaconsIndex = 0;
int myBeaconsSize = Config.beacons.size();
@ -45,7 +45,7 @@ int menuDisplay = 100;
int messagesIterator = 0;
std::vector<String> loadedAPRSMessages;
bool displayEcoMode = Config.displayEcoMode;
bool displayEcoMode = Config.display.ecoMode;
bool displayState = true;
uint32_t displayTime = millis();
uint32_t refreshDisplayTime = millis();

View File

@ -32,7 +32,6 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
bcn.overlay = BeaconsArray[i]["overlay"].as<String>();
bcn.micE = BeaconsArray[i]["micE"].as<String>();
bcn.comment = BeaconsArray[i]["comment"].as<String>();
bcn.smartBeaconState = BeaconsArray[i]["smartBeacon"]["active"].as<bool>();
bcn.slowRate = BeaconsArray[i]["smartBeacon"]["slowRate"].as<int>();
bcn.slowSpeed = BeaconsArray[i]["smartBeacon"]["slowSpeed"].as<int>();
@ -41,22 +40,17 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
bcn.minTxDist = BeaconsArray[i]["smartBeacon"]["minTxDist"].as<int>();
bcn.minDeltaBeacon = BeaconsArray[i]["smartBeacon"]["minDeltaBeacon"].as<int>();
bcn.turnMinDeg = BeaconsArray[i]["smartBeacon"]["turnMinDeg"].as<int>();
bcn.turnSlope = BeaconsArray[i]["smartBeacon"]["turnSlope"].as<int>();
bcn.turnSlope = BeaconsArray[i]["smartBeacon"]["turnSlope"].as<int>();
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>();
display.showSymbol = data["display"]["showSymbol"].as<bool>();
display.ecoMode = data["display"]["ecoMode"].as<bool>();
display.timeout = data["display"]["timeout"].as<int>();
display.turn180 = data["display"]["turn180"].as<bool>();
ptt.active = data["pttTrigger"]["active"].as<bool>();
ptt.io_pin = data["pttTrigger"]["io_pin"].as<int>();
ptt.preDelay = data["pttTrigger"]["preDelay"].as<int>();
ptt.postDelay = data["pttTrigger"]["postDelay"].as<int>();
ptt.reverse = data["pttTrigger"]["reverse"].as<bool>();
winlink.password = data["winlink"]["password"].as<String>();
bme.active = data["bme"]["active"].as<bool>();
bme.sendTelemetry = data["bme"]["sendTelemetry"].as<bool>();
@ -77,11 +71,20 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
notification.stationBeep = data["notification"]["stationBeep"].as<bool>();
notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as<bool>();
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>();
ptt.active = data["pttTrigger"]["active"].as<bool>();
ptt.io_pin = data["pttTrigger"]["io_pin"].as<int>();
ptt.preDelay = data["pttTrigger"]["preDelay"].as<int>();
ptt.postDelay = data["pttTrigger"]["postDelay"].as<int>();
ptt.reverse = data["pttTrigger"]["reverse"].as<bool>();
simplifiedTrackerMode = data["other"]["simplifiedTrackerMode"].as<bool>();
showSymbolOnScreen = data["other"]["showSymbolOnScreen"].as<bool>();
sendCommentAfterXBeacons = data["other"]["sendCommentAfterXBeacons"].as<int>();
displayEcoMode = data["other"]["displayEcoMode"].as<bool>();
displayTimeout = data["other"]["displayTimeout"].as<int>();
path = data["other"]["path"].as<String>();
nonSmartBeaconRate = data["other"]["nonSmartBeaconRate"].as<int>();
rememberStationTime = data["other"]["rememberStationTime"].as<int>();

View File

@ -23,22 +23,17 @@ public:
int turnSlope;
};
class LoraModule {
class Display {
public:
long frequency;
int spreadingFactor;
long signalBandwidth;
int codingRate4;
int power;
bool showSymbol;
bool ecoMode;
int timeout;
bool turn180;
};
class Ptt {
class Winlink {
public:
bool active;
int io_pin;
int preDelay;
int postDelay;
bool reverse;
String password;
};
class BME {
@ -66,21 +61,37 @@ public:
bool lowBatteryBeep;
};
class LoraModule {
public:
long frequency;
int spreadingFactor;
long signalBandwidth;
int codingRate4;
int power;
};
class Ptt {
public:
bool active;
int io_pin;
int preDelay;
int postDelay;
bool reverse;
};
class Configuration {
public:
std::vector<Beacon> beacons;
LoraModule loramodule;
Ptt ptt;
Display display;
Winlink winlink;
BME bme;
Notification notification;
LoraModule loramodule;
Ptt ptt;
bool simplifiedTrackerMode;
bool showSymbolOnScreen;
int sendCommentAfterXBeacons;
bool displayEcoMode;
int displayTimeout;
String path;
int nonSmartBeaconRate;
int rememberStationTime;

View File

@ -67,6 +67,9 @@ void setup_display() {
while (true) {
}
}
if (Config.display.turn180) {
display.setRotation(2);
}
#else
if (!display.begin(0x3c, true)) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "SH1106", "allocation failed!");
@ -248,7 +251,7 @@ void show_display(String header, String line1, String line2, String line3, Strin
display.ssd1306_command(screenBrightness);
#endif
if (menuDisplay==0 && Config.showSymbolOnScreen) {
if (menuDisplay==0 && Config.display.showSymbol) {
int symbol = 100;
for (int i=0; i<symbolArraySize; i++) {
if (currentBeacon->symbol == symbolArray[i]) {

View File

@ -318,7 +318,7 @@ namespace MENU_Utils {
String hdopState, firstRowMainMenu, secondRowMainMenu, thirdRowMainMenu, fourthRowMainMenu, fifthRowMainMenu, sixthRowMainMenu;
firstRowMainMenu = currentBeacon->callsign;
if (Config.showSymbolOnScreen) {
if (Config.display.showSymbol) {
for (int j=firstRowMainMenu.length();j<9;j++) {
firstRowMainMenu += " ";
}

View File

@ -86,7 +86,7 @@ namespace Utils {
void checkDisplayEcoMode() {
uint32_t lastDisplayTime = millis() - displayTime;
if (displayEcoMode && menuDisplay==0 && millis()>10*1000 && lastDisplayTime >= Config.displayTimeout*1000) {
if (displayEcoMode && menuDisplay==0 && millis()>10*1000 && lastDisplayTime >= Config.display.timeout*1000) {
display_toggle(false);
displayState = false;
}