Skip to content

Commit

Permalink
v0.82
Browse files Browse the repository at this point in the history
- 🔋 Allows to set the battery messurement scale via dev.json
- 🪞 Allows to mirror the screen for streaming etc.
- Better handling of disabled transistion after Notifications.
  • Loading branch information
Blueforcer committed Aug 29, 2023
1 parent 3a801d5 commit 621d515
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The JSON object has the following properties:
| `color_correction` | array of int | Sets the colorcorrection of the matrix | `[255,255,255]` |
| `color_temperature` | array of int | Sets the colortemperature of the matrix | `[255,255,255]` |
| `rotate_screen` | boolean | Rotates the screen upside down | `false` |
| `mirror_screen` | boolean | Mirrors the screen | `false` |
| `temp_dec_places` | integer | Number of decimal places for temperature measurements | `0` |
| `sensor_reading` | boolean | Enables or disables the reading of the Temp&Hum sensor | `true` |
| `temp_offset` | float | Sets the offset for the internal temperature messurement | `-9` |
Expand Down
16 changes: 8 additions & 8 deletions src/Apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState
callEffect(matrix, x, y, ca->effect);
}


CURRENT_APP = ca->name;
currentCustomApp = name;

Expand Down Expand Up @@ -600,7 +599,8 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState
{
DisplayManager.setAutoTransition(true);
ca->currentRepeat = 0;
DisplayManager.nextApp();
if (AUTO_TRANSITION)
DisplayManager.nextApp();
ca->scrollDelay = 0;
ca->scrollposition = 9 + ca->textOffset;
return;
Expand Down Expand Up @@ -745,8 +745,6 @@ void NotifyOverlay(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, GifPl
notifyFlag = true;
}



if (notifications[0].wakeup && MATRIX_OFF)
{
DisplayManager.setBrightness(BRIGHTNESS);
Expand All @@ -764,7 +762,7 @@ void NotifyOverlay(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, GifPl
}
notifications[0].icon.close();
notifications.erase(notifications.begin());

if (notifications[0].wakeup && MATRIX_OFF)
{
DisplayManager.setBrightness(0);
Expand All @@ -773,12 +771,14 @@ void NotifyOverlay(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, GifPl
if (notifications.empty())
{
notifyFlag = false;
if (AUTO_TRANSITION)
DisplayManager.nextApp();
}
DisplayManager.nextApp();

return;
}

// Set current app name
// Set current app name
CURRENT_APP = F("Notification");

// Check if notification has an icon
Expand Down Expand Up @@ -983,7 +983,7 @@ void NotifyOverlay(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, GifPl
else
{
matrix->setTextColor(TextEffect(notifications[0].color, notifications[0].fade, notifications[0].blink));

DisplayManager.printText(textX + notifications[0].textOffset, 6, notifications[0].text.c_str(), false, notifications[0].textCase);
}
}
Expand Down
18 changes: 13 additions & 5 deletions src/DisplayManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1487,20 +1487,16 @@ String DisplayManager_::getStats()
#else
doc[F("type")] = 1;
#endif

doc[LuxKey] = static_cast<int>(CURRENT_LUX);
doc[LDRRawKey] = LDR_RAW;

uint32_t freeHeap = ESP.getFreeHeap();
doc[RamKey] = freeHeap;
doc[BrightnessKey] = BRIGHTNESS;

if (SENSOR_READING)
{
doc[TempKey] = static_cast<uint8_t>(CURRENT_TEMP);
doc[HumKey] = static_cast<uint8_t>(CURRENT_HUM);
}

doc[UpTimeKey] = PeripheryManager.readUptime();
doc[SignalStrengthKey] = WiFi.RSSI();
doc[MessagesKey] = RECEIVED_MESSAGES;
Expand All @@ -1509,7 +1505,6 @@ String DisplayManager_::getStats()
doc[F("indicator2")] = ui->indicator2State;
doc[F("indicator3")] = ui->indicator3State;
doc[F("app")] = CURRENT_APP;
// doc[F("freeFlash")] = LittleFS.totalBytes() - LittleFS.usedBytes();
String jsonString;
serializeJson(doc, jsonString);
return jsonString;
Expand Down Expand Up @@ -1808,6 +1803,19 @@ void DisplayManager_::gammaCorrection()
{
leds[i] = applyGamma_video(leds[i], gamma);
}

if (MIRROR_DISPLAY)
{
for (int y = 0; y < MATRIX_HEIGHT; y++)
{
for (int x = 0; x < MATRIX_WIDTH / 2; x++)
{
int index1 = y * MATRIX_WIDTH + x;
int index2 = y * MATRIX_WIDTH + (MATRIX_WIDTH - x - 1);
std::swap(leds[index1], leds[index2]);
}
}
}
}

void DisplayManager_::sendAppLoop()
Expand Down
7 changes: 6 additions & 1 deletion src/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ void loadDevSettings()
MATRIX_LAYOUT = doc["matrix"];
}

if (doc.containsKey("mirror_screen"))
{
MIRROR_DISPLAY = doc["mirror_screen"].as<bool>();
}

if (doc.containsKey("temp_offset"))
{
TEMP_OFFSET = doc["temp_offset"];
Expand Down Expand Up @@ -351,7 +356,7 @@ bool AUTO_BRIGHTNESS = true;
bool UPPERCASE_LETTERS = true;
bool AP_MODE;
bool MATRIX_OFF;

bool MIRROR_DISPLAY=false;
uint16_t TEXTCOLOR_565;
bool SOUND_ACTIVE;
String BOOT_SOUND = "";
Expand Down
2 changes: 1 addition & 1 deletion src/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern bool AUTO_BRIGHTNESS;
extern bool AP_MODE;
extern bool MATRIX_OFF;
extern uint16_t TEXTCOLOR_565;

extern bool MIRROR_DISPLAY;
extern bool AUTO_TRANSITION;
extern String TIME_FORMAT;
extern String DATE_FORMAT;
Expand Down

0 comments on commit 621d515

Please sign in to comment.