Change screen filters presets (adding more) menu & print CCT. Fixes #1442.
Most new presets come from 8bitwonder
This commit is contained in:
parent
9411a8c186
commit
e69f89a0d4
@ -32,10 +32,14 @@ extern Menu screenFiltersMenu;
|
||||
|
||||
extern int screenFiltersCurrentTemperature;
|
||||
|
||||
void screenFiltersSetDisabled(void);
|
||||
void screenFiltersReduceBlueLevel1(void);
|
||||
void screenFiltersReduceBlueLevel2(void);
|
||||
void screenFiltersReduceBlueLevel3(void);
|
||||
void screenFiltersReduceBlueLevel4(void);
|
||||
void screenFiltersReduceBlueLevel5(void);
|
||||
void screenFiltersSetTemperature(int temperature);
|
||||
void ScreenFiltersMenu_SetDefault(void); // 6500K (default)
|
||||
|
||||
void ScreenFiltersMenu_SetAquarium(void); // 10000K
|
||||
void ScreenFiltersMenu_SetOvercastSky(void); // 7500K
|
||||
void ScreenFiltersMenu_SetDaylight(void); // 5500K
|
||||
void ScreenFiltersMenu_SetFluorescent(void); // 4200K
|
||||
void ScreenFiltersMenu_SetHalogen(void); // 3400K
|
||||
void ScreenFiltersMenu_SetIncandescent(void); // 2700K
|
||||
void ScreenFiltersMenu_SetWarmIncandescent(void); // 2300K
|
||||
void ScreenFiltersMenu_SetCandle(void); // 1900K
|
||||
void ScreenFiltersMenu_SetEmber(void); // 1200K
|
||||
|
@ -32,11 +32,19 @@
|
||||
#include "redshift/redshift.h"
|
||||
#include "redshift/colorramp.h"
|
||||
|
||||
#define TEMP_DEFAULT NEUTRAL_TEMP
|
||||
typedef struct {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 z;
|
||||
} Pixel;
|
||||
|
||||
int screenFiltersCurrentTemperature = TEMP_DEFAULT;
|
||||
static u16 g_c[0x600];
|
||||
static Pixel g_px[0x400];
|
||||
|
||||
void writeLut(u32* lut)
|
||||
int screenFiltersCurrentTemperature = 6500;
|
||||
|
||||
static void ScreenFiltersMenu_WriteLut(const u32* lut)
|
||||
{
|
||||
GPU_FB_TOP_COL_LUT_INDEX = 0;
|
||||
GPU_FB_BOTTOM_COL_LUT_INDEX = 0;
|
||||
@ -48,17 +56,7 @@ void writeLut(u32* lut)
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 z;
|
||||
} Pixel;
|
||||
|
||||
static u16 g_c[0x600];
|
||||
static Pixel g_px[0x400];
|
||||
|
||||
void applyColorSettings(color_setting_t* cs)
|
||||
static void ScreenFiltersMenu_ApplyColorSettings(color_setting_t* cs)
|
||||
{
|
||||
u8 i = 0;
|
||||
|
||||
@ -86,68 +84,56 @@ void applyColorSettings(color_setting_t* cs)
|
||||
g_px[i].b = *(g_c + i + 0x200) >> 8;
|
||||
} while(++i);
|
||||
|
||||
writeLut((u32*)g_px);
|
||||
ScreenFiltersMenu_WriteLut((u32*)g_px);
|
||||
}
|
||||
|
||||
Menu screenFiltersMenu = {
|
||||
"Screen filters menu",
|
||||
{
|
||||
{ "Disable", METHOD, .method = &screenFiltersSetDisabled },
|
||||
{ "Reduce blue light (level 1)", METHOD, .method = &screenFiltersReduceBlueLevel1 },
|
||||
{ "Reduce blue light (level 2)", METHOD, .method = &screenFiltersReduceBlueLevel2 },
|
||||
{ "Reduce blue light (level 3)", METHOD, .method = &screenFiltersReduceBlueLevel3 },
|
||||
{ "Reduce blue light (level 4)", METHOD, .method = &screenFiltersReduceBlueLevel4 },
|
||||
{ "Reduce blue light (level 5)", METHOD, .method = &screenFiltersReduceBlueLevel5 },
|
||||
{},
|
||||
}
|
||||
};
|
||||
|
||||
void screenFiltersSetDisabled(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = TEMP_DEFAULT;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersReduceBlueLevel1(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = 4300;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersReduceBlueLevel2(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = 3200;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersReduceBlueLevel3(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = 2100;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersReduceBlueLevel4(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = 1550;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersReduceBlueLevel5(void)
|
||||
{
|
||||
screenFiltersCurrentTemperature = 1000;
|
||||
screenFiltersSetTemperature(screenFiltersCurrentTemperature);
|
||||
}
|
||||
|
||||
void screenFiltersSetTemperature(int temperature)
|
||||
static void ScreenFiltersMenu_SetCct(int cct)
|
||||
{
|
||||
color_setting_t cs;
|
||||
memset(&cs, 0, sizeof(cs));
|
||||
|
||||
cs.temperature = temperature;
|
||||
cs.temperature = cct;
|
||||
/*cs.gamma[0] = 1.0F;
|
||||
cs.gamma[1] = 1.0F;
|
||||
cs.gamma[2] = 1.0F;
|
||||
cs.brightness = 1.0F;*/
|
||||
|
||||
applyColorSettings(&cs);
|
||||
ScreenFiltersMenu_ApplyColorSettings(&cs);
|
||||
}
|
||||
|
||||
|
||||
Menu screenFiltersMenu = {
|
||||
"Screen filters menu",
|
||||
{
|
||||
{ "[6500K] Default", METHOD, .method = &ScreenFiltersMenu_SetDefault },
|
||||
{ "[10000K] Aquarium", METHOD, .method = &ScreenFiltersMenu_SetAquarium },
|
||||
{ "[7500K] Overcast Sky", METHOD, .method = &ScreenFiltersMenu_SetOvercastSky },
|
||||
{ "[5500K] Daylight", METHOD, .method = &ScreenFiltersMenu_SetDaylight },
|
||||
{ "[4200K] Fluorescent", METHOD, .method = &ScreenFiltersMenu_SetFluorescent },
|
||||
{ "[3400K] Halogen", METHOD, .method = &ScreenFiltersMenu_SetHalogen },
|
||||
{ "[2700K] Incandescent", METHOD, .method = &ScreenFiltersMenu_SetIncandescent },
|
||||
{ "[2300K] Warm Incandescent", METHOD, .method = &ScreenFiltersMenu_SetWarmIncandescent },
|
||||
{ "[1900K] Candle", METHOD, .method = &ScreenFiltersMenu_SetCandle },
|
||||
{ "[2700K] Ember", METHOD, .method = &ScreenFiltersMenu_SetEmber },
|
||||
{},
|
||||
}
|
||||
};
|
||||
|
||||
#define DEF_CCT_SETTER(temp, name)\
|
||||
void ScreenFiltersMenu_Set##name(void)\
|
||||
{\
|
||||
screenFiltersCurrentTemperature = temp;\
|
||||
ScreenFiltersMenu_SetCct(temp);\
|
||||
}
|
||||
|
||||
DEF_CCT_SETTER(6500, Default)
|
||||
|
||||
DEF_CCT_SETTER(10000, Aquarium)
|
||||
DEF_CCT_SETTER(7500, OvercastSky)
|
||||
DEF_CCT_SETTER(5500, Daylight)
|
||||
DEF_CCT_SETTER(4200, Fluorescent)
|
||||
DEF_CCT_SETTER(3400, Halogen)
|
||||
DEF_CCT_SETTER(2700, Incandescent)
|
||||
DEF_CCT_SETTER(2300, WarmIncandescent)
|
||||
DEF_CCT_SETTER(1900, Candle)
|
||||
DEF_CCT_SETTER(1200, Ember)
|
||||
|
Reference in New Issue
Block a user