Skip to content

Commit

Permalink
minor updates for laser display
Browse files Browse the repository at this point in the history
  • Loading branch information
kennygarreau committed Jun 4, 2024
1 parent f357900 commit e113668
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
41 changes: 22 additions & 19 deletions src/v1_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ void PacketDecoder::decodeAlertData(const alertsVector& alerts) {
if (priority) {
arrowColor = TFT_RED;
}

// paint the directional arrow(s) - this should work for the prio alert now, so we may want to move this block
if (directionValue == "FRONT")
{ displayController.drawUpArrow(selectedConstants.ARROW_FRONT_X, selectedConstants.ARROW_FRONT_Y, selectedConstants.ARROW_FRONT_WIDTH, arrowColor);}
else if (directionValue == "SIDE")
{ displayController.drawSideArrows(selectedConstants.ARROW_SIDE_X, selectedConstants.ARROW_SIDE_Y, selectedConstants.ARROW_SIDE_WIDTH, selectedConstants.ARROW_SIDE_HEIGHT, arrowColor); }
else if (directionValue == "REAR")
{ displayController.drawDownArrow(selectedConstants.ARROW_REAR_X, selectedConstants.ARROW_REAR_Y, selectedConstants.ARROW_REAR_WIDTH, arrowColor); }

// paint the small directional arrow of the alert
if (bandValue == "X") {
Expand Down Expand Up @@ -255,29 +263,24 @@ void PacketDecoder::decodeAlertData(const alertsVector& alerts) {
sprite.fillScreen(TFT_RED);
displayController.displayText(bandValue.c_str(), selectedConstants.MHZ_DISP_X, selectedConstants.MHZ_DISP_Y, TFT_WHITE);
arrowColor = TFT_YELLOW;
sprite.pushSprite(0,0);
delay(1500);
}

// paint the directional arrow(s) - this should work for the prio alert now, so we may want to move this block
if (directionValue == "FRONT")
{ displayController.drawUpArrow(selectedConstants.ARROW_FRONT_X, selectedConstants.ARROW_FRONT_Y, selectedConstants.ARROW_FRONT_WIDTH, arrowColor);}
else if (directionValue == "SIDE")
{ displayController.drawSideArrows(selectedConstants.ARROW_SIDE_X, selectedConstants.ARROW_SIDE_Y, selectedConstants.ARROW_SIDE_WIDTH, selectedConstants.ARROW_SIDE_HEIGHT, arrowColor); }
else if (directionValue == "REAR")
{ displayController.drawDownArrow(selectedConstants.ARROW_REAR_X, selectedConstants.ARROW_REAR_Y, selectedConstants.ARROW_REAR_WIDTH, arrowColor); }
if (bandValue != "LASER") {
// paint the main signal bar
if (rearStrengthVal > frontStrengthVal) {
displayController.drawSignalBars(rearStrengthVal, UI_COLOR);
displayController.drawHorizontalBars(selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i) - 10, rearStrengthVal, UI_COLOR);
}
else {
displayController.drawSignalBars(frontStrengthVal, UI_COLOR);
displayController.drawHorizontalBars(selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i) - 10, frontStrengthVal, UI_COLOR);
}

// paint the main signal bar
if (rearStrengthVal > frontStrengthVal) {
displayController.drawSignalBars(rearStrengthVal, UI_COLOR);
displayController.drawHorizontalBars(selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i) - 10, rearStrengthVal, UI_COLOR);
}
else {
displayController.drawSignalBars(frontStrengthVal, UI_COLOR);
displayController.drawHorizontalBars(selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i) - 10, frontStrengthVal, UI_COLOR);
// paint the frequency of the alert
displayController.displayFreq(freqGhz, selectedConstants.MHZ_DISP_X, selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i), TFT_WHITE);
}

// paint the frequency of the alert
displayController.displayFreq(freqGhz, selectedConstants.MHZ_DISP_X, selectedConstants.MHZ_DISP_Y + (selectedConstants.MHZ_DISP_Y_OFFSET * i), TFT_WHITE);

// enable below for debugging
std::string decodedPayload = "INDX:" + std::to_string(alertIndexValue) +
//" FREQ:" + std::to_string(freqMhz) +
Expand Down
7 changes: 4 additions & 3 deletions src/v1server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void setup()

tft.setRotation(settings.displayOrientation);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(settings.textColor);
//tft.setTextColor(settings.textColor);
//tft.loadFont(nunitoFont);

int rssiSpriteWidth = 30;
Expand Down Expand Up @@ -427,8 +427,9 @@ void loop() {
unsigned long currentMillis = millis();

if (currentMillis - lastMillis >= 1000) {
Serial.print("Loops executed: ");
Serial.println(loopCounter);
// uncomment below for debugging
//Serial.print("Loops executed: ");
//Serial.println(loopCounter);

updateSignalStrengthDisplay();
signalStrengthDisplay.pushSprite(tft.width() - signalStrengthDisplay.width(), tft.height() - signalStrengthDisplay.height());
Expand Down

0 comments on commit e113668

Please sign in to comment.