add color correction
This commit is contained in:
@@ -12,5 +12,6 @@ The JSON object has the following properties:
|
|||||||
| Key | Type | Description | Default |
|
| Key | Type | Description | Default |
|
||||||
| --- | ---- | ----------- | ------- |
|
| --- | ---- | ----------- | ------- |
|
||||||
| `bootsound` | string | Uses a custom melodie while booting | |
|
| `bootsound` | string | Uses a custom melodie while booting | |
|
||||||
| `uppercase` | boolean | Print every character in uppercase | true |
|
| `uppercase` | boolean | Print every character in uppercase | `true` |
|
||||||
| `temp_dec_places` | int | Number of decimal places for temperature measurements | 0 |
|
| `temp_dec_places` | int | Number of decimal places for temperature measurements | `0` |
|
||||||
|
| `color_correction` | array of int | Sets the colorcorrection of the matrix | `[255,255,255]` |
|
||||||
@@ -56,7 +56,11 @@ void DisplayManager_::setBrightness(uint8_t bri)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
matrix->setBrightness(bri);
|
matrix->setBrightness(bri);
|
||||||
// napplyGamma_video(&leds[256], 256, 2.2);
|
if (GAMMA > 0)
|
||||||
|
{
|
||||||
|
Serial.println(GAMMA);
|
||||||
|
napplyGamma_video(&leds[256], 256, GAMMA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,8 +541,12 @@ void DisplayManager_::setup()
|
|||||||
TJpgDec.setCallback(jpg_output);
|
TJpgDec.setCallback(jpg_output);
|
||||||
TJpgDec.setJpgScale(1);
|
TJpgDec.setJpgScale(1);
|
||||||
|
|
||||||
FastLED.addLeds<NEOPIXEL, MATRIX_PIN>(leds, MATRIX_WIDTH * MATRIX_HEIGHT).setCorrection(OvercastSky);
|
FastLED.addLeds<NEOPIXEL, MATRIX_PIN>(leds, MATRIX_WIDTH * MATRIX_HEIGHT);
|
||||||
setMatrixLayout(MATRIX_LAYOUT);
|
setMatrixLayout(MATRIX_LAYOUT);
|
||||||
|
if (COLOR_CORRECTION)
|
||||||
|
{
|
||||||
|
FastLED.setCorrection(COLOR_CORRECTION);
|
||||||
|
}
|
||||||
gif.setMatrix(matrix);
|
gif.setMatrix(matrix);
|
||||||
ui->setAppAnimation(SLIDE_DOWN);
|
ui->setAppAnimation(SLIDE_DOWN);
|
||||||
ui->setTimePerApp(TIME_PER_APP);
|
ui->setTimePerApp(TIME_PER_APP);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Preferences.h"
|
#include "Preferences.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
|
|
||||||
Preferences Settings;
|
Preferences Settings;
|
||||||
@@ -66,6 +67,22 @@ void loadDevSettings()
|
|||||||
TEMP_DECIMAL_PLACES = doc["temp_dec_places"].as<int>();
|
TEMP_DECIMAL_PLACES = doc["temp_dec_places"].as<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc.containsKey("gamma"))
|
||||||
|
{
|
||||||
|
GAMMA = doc["gamma"].as<float>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doc.containsKey("color_correction"))
|
||||||
|
{
|
||||||
|
auto correction = doc["color_correction"];
|
||||||
|
if (correction.is<JsonArray>() && correction.size() == 3)
|
||||||
|
{
|
||||||
|
uint8_t r = correction[0];
|
||||||
|
uint8_t g = correction[1];
|
||||||
|
uint8_t b = correction[2];
|
||||||
|
COLOR_CORRECTION.setRGB(r, g, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,3 +228,5 @@ uint8_t VOLUME;
|
|||||||
int MATRIX_LAYOUT;
|
int MATRIX_LAYOUT;
|
||||||
bool UPDATE_AVAILABLE = false;
|
bool UPDATE_AVAILABLE = false;
|
||||||
long RECEIVED_MESSAGES;
|
long RECEIVED_MESSAGES;
|
||||||
|
CRGB COLOR_CORRECTION;
|
||||||
|
float GAMMA = 0;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef GLOBALS_H
|
#ifndef GLOBALS_H
|
||||||
#define GLOBALS_H
|
#define GLOBALS_H
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <FastLED.h>
|
||||||
|
|
||||||
extern const char *uniqueID;
|
extern const char *uniqueID;
|
||||||
extern const char *VERSION;
|
extern const char *VERSION;
|
||||||
@@ -76,6 +77,8 @@ extern uint8_t VOLUME;
|
|||||||
extern int MATRIX_LAYOUT;
|
extern int MATRIX_LAYOUT;
|
||||||
extern bool UPDATE_AVAILABLE;
|
extern bool UPDATE_AVAILABLE;
|
||||||
extern long RECEIVED_MESSAGES;
|
extern long RECEIVED_MESSAGES;
|
||||||
|
extern CRGB COLOR_CORRECTION;
|
||||||
|
extern float GAMMA;
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
#endif // Globals_H
|
#endif // Globals_H
|
||||||
@@ -94,7 +94,6 @@ void setup()
|
|||||||
|
|
||||||
delay(200);
|
delay(200);
|
||||||
DisplayManager.setBrightness(BRIGHTNESS);
|
DisplayManager.setBrightness(BRIGHTNESS);
|
||||||
DisplayManager.clearMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
|||||||
Reference in New Issue
Block a user