revert gif decoder call
This commit is contained in:
@@ -189,7 +189,7 @@ void TempApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x,
|
||||
return;
|
||||
CURRENT_APP = "Temperature";
|
||||
DisplayManager.getInstance().resetTextColor();
|
||||
matrix->drawRGBBitmap(x, y, get_icon(234), 8, 8);
|
||||
matrix->drawRGBBitmap(x, y, icon_234, 8, 8);
|
||||
|
||||
if (TEMP_DECIMAL_PLACES > 0)
|
||||
matrix->setCursor(8 + x, 6 + y);
|
||||
@@ -215,13 +215,15 @@ void HumApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x, i
|
||||
return;
|
||||
CURRENT_APP = "Humidity";
|
||||
DisplayManager.getInstance().resetTextColor();
|
||||
matrix->drawRGBBitmap(x, y + 1, get_icon(2075), 8, 8);
|
||||
matrix->drawRGBBitmap(x, y + 1, icon_2075, 8, 8);
|
||||
matrix->setCursor(14 + x, 6 + y);
|
||||
int humidity = CURRENT_HUM; // Humidity without decimal places
|
||||
matrix->print(humidity); // Output humidity
|
||||
matrix->print("%");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef ULANZI
|
||||
void BatApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x, int16_t y, bool firstFrame, bool lastFrame)
|
||||
{
|
||||
@@ -229,7 +231,7 @@ void BatApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x, i
|
||||
return;
|
||||
CURRENT_APP = "Battery";
|
||||
DisplayManager.getInstance().resetTextColor();
|
||||
matrix->drawRGBBitmap(x, y, get_icon(1486), 8, 8);
|
||||
matrix->drawRGBBitmap(x, y, icon_1486, 8, 8);
|
||||
matrix->setCursor(14 + x, 6 + y);
|
||||
matrix->print(BATTERY_PERCENT); // Ausgabe des Ladezustands
|
||||
matrix->print("%");
|
||||
|
||||
@@ -95,13 +95,8 @@ bool DisplayManager_::setAutoTransition(bool active)
|
||||
|
||||
void DisplayManager_::drawGIF(uint16_t x, uint16_t y, fs::File gFile)
|
||||
{
|
||||
gifX = x;
|
||||
gifY = y;
|
||||
if (!showGif)
|
||||
{
|
||||
gif.setFile(gFile);
|
||||
showGif = true;
|
||||
}
|
||||
gif.setFile(gFile);
|
||||
gif.drawFrame(x, y);
|
||||
}
|
||||
|
||||
void DisplayManager_::drawJPG(uint16_t x, uint16_t y, fs::File jpgFile)
|
||||
@@ -542,8 +537,10 @@ void DisplayManager_::setup()
|
||||
{
|
||||
TJpgDec.setCallback(jpg_output);
|
||||
TJpgDec.setJpgScale(1);
|
||||
FastLED.addLeds<NEOPIXEL, MATRIX_PIN>(leds, MATRIX_WIDTH * MATRIX_HEIGHT);
|
||||
|
||||
FastLED.addLeds<NEOPIXEL, MATRIX_PIN>(leds, MATRIX_WIDTH * MATRIX_HEIGHT).setTemperature(OvercastSky);
|
||||
setMatrixLayout(MATRIX_LAYOUT);
|
||||
|
||||
gif.setMatrix(matrix);
|
||||
ui->setAppAnimation(SLIDE_DOWN);
|
||||
ui->setTimePerApp(TIME_PER_APP);
|
||||
@@ -565,7 +562,10 @@ void DisplayManager_::tick()
|
||||
HSVtext(2, 6, "AP MODE", true, 1);
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
ui->update();
|
||||
|
||||
if (ui->getUiState()->appState == IN_TRANSITION && !appIsSwitching)
|
||||
{
|
||||
appIsSwitching = true;
|
||||
@@ -577,11 +577,9 @@ void DisplayManager_::tick()
|
||||
MQTTManager.setCurrentApp(CURRENT_APP);
|
||||
setAppTime(TIME_PER_APP);
|
||||
}
|
||||
int remainingTimeBudget = ui->update();
|
||||
|
||||
if (showGif && !MenuManager.inMenu)
|
||||
gif.drawFrame(gifX, gifY);
|
||||
matrix->show();
|
||||
// if (showGif && !MenuManager.inMenu)
|
||||
//
|
||||
// matrix->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -287,9 +287,6 @@ void MQTTManager_::setup()
|
||||
device.setSoftwareVersion(VERSION);
|
||||
device.setManufacturer(HAmanufacturer);
|
||||
device.setModel(HAmodel);
|
||||
char url[50];
|
||||
snprintf(url, sizeof(url), "http://%s", WiFi.localIP().toString().c_str());
|
||||
device.setURL("http://192.168.178.102");
|
||||
device.setAvailability(true);
|
||||
device.enableSharedAvailability();
|
||||
device.enableLastWill();
|
||||
|
||||
@@ -96,21 +96,9 @@ void left_button_pressed()
|
||||
#ifndef ULANZI
|
||||
PeripheryManager.playFromFile(DFMINI_MP3_CLICK);
|
||||
#endif
|
||||
if (AP_MODE)
|
||||
{
|
||||
#ifndef ULANZI
|
||||
--MATRIX_LAYOUT;
|
||||
if (MATRIX_LAYOUT < 0)
|
||||
MATRIX_LAYOUT = 2;
|
||||
saveSettings();
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayManager.leftButton();
|
||||
MenuManager.leftButton();
|
||||
}
|
||||
|
||||
DisplayManager.leftButton();
|
||||
MenuManager.leftButton();
|
||||
}
|
||||
|
||||
void right_button_pressed()
|
||||
@@ -118,21 +106,9 @@ void right_button_pressed()
|
||||
#ifndef ULANZI
|
||||
PeripheryManager.playFromFile(DFMINI_MP3_CLICK);
|
||||
#endif
|
||||
if (AP_MODE)
|
||||
{
|
||||
#ifndef ULANZI
|
||||
++MATRIX_LAYOUT;
|
||||
if (MATRIX_LAYOUT > 2)
|
||||
MATRIX_LAYOUT = 0;
|
||||
saveSettings();
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayManager.rightButton();
|
||||
MenuManager.rightButton();
|
||||
}
|
||||
|
||||
DisplayManager.rightButton();
|
||||
MenuManager.rightButton();
|
||||
}
|
||||
|
||||
void select_button_pressed()
|
||||
@@ -146,9 +122,21 @@ void select_button_pressed()
|
||||
|
||||
void select_button_pressed_long()
|
||||
{
|
||||
|
||||
DisplayManager.selectButtonLong();
|
||||
MenuManager.selectButtonLong();
|
||||
if (AP_MODE)
|
||||
{
|
||||
#ifndef ULANZI
|
||||
++MATRIX_LAYOUT;
|
||||
if (MATRIX_LAYOUT < 0)
|
||||
MATRIX_LAYOUT = 2;
|
||||
saveSettings();
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayManager.selectButtonLong();
|
||||
MenuManager.selectButtonLong();
|
||||
}
|
||||
}
|
||||
|
||||
void select_button_double()
|
||||
@@ -234,37 +222,15 @@ bool PeripheryManager_::isPlaying()
|
||||
#endif
|
||||
}
|
||||
|
||||
void firstStart()
|
||||
{
|
||||
#ifdef ULANZI
|
||||
uint16_t ADCVALUE = analogRead(BATTERY_PIN);
|
||||
BATTERY_PERCENT = min((int)map(ADCVALUE, 490, 690, 0, 100), 100);
|
||||
BATTERY_RAW = ADCVALUE;
|
||||
sht31.readBoth(&CURRENT_TEMP, &CURRENT_HUM);
|
||||
CURRENT_TEMP -= 9.0;
|
||||
#else
|
||||
CURRENT_TEMP = bme280.readTemperature();
|
||||
CURRENT_HUM = bme280.readHumidity();
|
||||
#endif
|
||||
|
||||
uint16_t LDRVALUE = analogRead(LDR_PIN);
|
||||
brightnessPercent = LDRVALUE / 4095.0 * 100.0;
|
||||
int brightness = map(brightnessPercent, 0, 100, 10, 120);
|
||||
DisplayManager.setBrightness(brightness);
|
||||
}
|
||||
|
||||
void PeripheryManager_::setup()
|
||||
{
|
||||
startTime = millis();
|
||||
pinMode(LDR_PIN, INPUT);
|
||||
#ifdef ULANZI
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_PIN, LOW);
|
||||
#else
|
||||
dfmp3.begin();
|
||||
delay(100);
|
||||
setVolume(VOLUME);
|
||||
#endif
|
||||
#ifdef AWTRIX_UPGRADE
|
||||
dfmp3.begin();
|
||||
delay(100);
|
||||
setVolume(VOLUME);
|
||||
#endif
|
||||
button_left.begin();
|
||||
button_right.begin();
|
||||
button_select.begin();
|
||||
@@ -283,7 +249,6 @@ void PeripheryManager_::setup()
|
||||
dfmp3.begin();
|
||||
#endif
|
||||
photocell.setPhotocellPositionOnGround(false);
|
||||
firstStart();
|
||||
}
|
||||
|
||||
void PeripheryManager_::tick()
|
||||
|
||||
@@ -59,13 +59,16 @@ void BootAnimation(void *parameter)
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(15, OUTPUT);
|
||||
digitalWrite(15, LOW);
|
||||
delay(2000);
|
||||
loadSettings();
|
||||
Serial.begin(115200);
|
||||
PeripheryManager.setup();
|
||||
ServerManager.loadSettings();
|
||||
DisplayManager.setup();
|
||||
DisplayManager.HSVtext(9, 6, VERSION, true, 0);
|
||||
delay(500);
|
||||
|
||||
PeripheryManager.playBootSound();
|
||||
xTaskCreatePinnedToCore(BootAnimation, "Task", 10000, NULL, 1, &taskHandle, 0);
|
||||
ServerManager.setup();
|
||||
|
||||
Reference in New Issue
Block a user