Skip to content

Commit 5595eb7

Browse files
committed
Mon 18 Nov 2019 08:43:47 EST - quick fix
1 parent 8a5a90a commit 5595eb7

File tree

22 files changed

+111
-63
lines changed

22 files changed

+111
-63
lines changed

Components/frodo-go/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/go-play/odroid-go-common/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/gogo/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/handy-go/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static float adc_value = 0.0f;
3030
static float forced_adc_value = 0.0f;
3131
static bool battery_monitor_enabled = true;
3232

33-
#define BACKLIGHT_LEVEL_COUNT (4)
34-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
33+
#define BACKLIGHT_LEVEL_COUNT (10)
34+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3535
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3636

3737
int is_backlight_initialized();

Components/odroid-go-pcengine-huexpress/odroid-go-common/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static float adc_value = 0.0f;
3030
static float forced_adc_value = 0.0f;
3131
static bool battery_monitor_enabled = true;
3232

33-
#define BACKLIGHT_LEVEL_COUNT (4)
34-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
33+
#define BACKLIGHT_LEVEL_COUNT (10)
34+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3535
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3636

3737
int is_backlight_initialized();

Components/pitpo/odroid-go-common/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/prosystem-odroid-go/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/stella-odroid-go/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Components/super-go-play/odroid-go-common/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Emulators/handy-go/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static float adc_value = 0.0f;
3030
static float forced_adc_value = 0.0f;
3131
static bool battery_monitor_enabled = true;
3232

33-
#define BACKLIGHT_LEVEL_COUNT (4)
34-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
33+
#define BACKLIGHT_LEVEL_COUNT (10)
34+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3535
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3636

3737
int is_backlight_initialized();

Firmware/Releases/Retro ESP32.fw

-6.81 MB
Binary file not shown.

Firmware/Releases/odroid-go.zip

-2.1 MB
Binary file not shown.
23.2 KB
Binary file not shown.

Firmware/Releases/retro-esp.zip

-2.1 MB
Binary file not shown.
23 KB
Binary file not shown.

Launchers/gogo/components/odroid/odroid_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ static float adc_value = 0.0f;
2727
static float forced_adc_value = 0.0f;
2828
static bool battery_monitor_enabled = true;
2929

30-
#define BACKLIGHT_LEVEL_COUNT (4)
31-
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10, 33, 66, 100};
30+
#define BACKLIGHT_LEVEL_COUNT (10)
31+
static int BacklightLevels[BACKLIGHT_LEVEL_COUNT] = {10,20,30,40,50,60,70,80,90,100};
3232
static int BacklightLevel = BACKLIGHT_LEVEL_COUNT - 1;
3333

3434
int is_backlight_initialized();

Launchers/retro-esp32/components/odroid/odroid_input.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static void odroid_input_task(void *arg)
135135
break;
136136
}
137137
}
138-
138+
/*
139139
if (gamepad_state.values[ODROID_INPUT_START])
140140
{
141141
@@ -158,13 +158,13 @@ static void odroid_input_task(void *arg)
158158
159159
160160
}
161-
162161
if (is_backlight_initialized())
163162
{
164163
const int DUTY_MAX = 0x1fff;
165164
int duty = DUTY_MAX * (BacklightLevels[BacklightLevel] * 0.01f);
166165
167166
uint32_t currentDuty = ledc_get_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
167+
168168
if (currentDuty != duty)
169169
{
170170
changed = true;
@@ -176,13 +176,14 @@ static void odroid_input_task(void *arg)
176176
177177
178178
ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty, 1);
179-
ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE /*LEDC_FADE_NO_WAIT*/);
179+
ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE);
180180
181181
//ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty);
182182
183183
changed = false;
184184
}
185185
}
186+
*/
186187

187188
previous_gamepad_state = gamepad_state;
188189

Launchers/retro-esp32/main/includes/declarations.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void draw_media(int x, int y, bool current);
7171
void draw_folder(int x, int y, bool current);
7272
void draw_battery();
7373
void draw_speaker();
74+
void draw_contrast();
7475
void draw_numbers();
7576
void draw_launcher();
7677
void draw_launcher_options();

Launchers/retro-esp32/main/main.c

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
int PREVIOUS = 0;
2424
int32_t VOLUME = 0;
2525
int32_t BRIGHTNESS = 0;
26+
int32_t BRIGHTNESS_COUNT = 10;
2627
int32_t BRIGHTNESS_LEVELS[10] = {10,20,30,40,50,60,70,80,90,100};
2728
int8_t USER;
2829
int8_t SETTING;
2930
int8_t COLOR;
31+
uint32_t currentDuty;
3032

3133
char** FILES;
3234
char folder_path[256] = "";
@@ -111,11 +113,12 @@
111113
VOLUME = odroid_settings_Volume_get();
112114
odroid_settings_Volume_set(VOLUME);
113115

114-
BRIGHTNESS = get_brightness();
115116
//odroid_settings_Backlight_set(BRIGHTNESS);
116117

117118
// Display
118119
ili9341_init();
120+
BRIGHTNESS = get_brightness();
121+
apply_brightness();
119122

120123
// Joystick
121124
odroid_input_gamepad_init();
@@ -152,7 +155,7 @@
152155
RESTART = false;
153156
break;
154157
}
155-
STEP = 0;
158+
//STEP = 0;
156159
RESTART ? restart() : SPLASH ? splash() : NULL;
157160
draw_background();
158161
restore_layout();
@@ -167,6 +170,7 @@
167170
void debounce(int key) {
168171
draw_battery();
169172
draw_speaker();
173+
draw_contrast();
170174
while (gamepad.values[key]) odroid_input_gamepad_read(&gamepad);
171175
}
172176
//}#pragma endregion Debounce
@@ -301,6 +305,7 @@
301305
for (int i = 0; i < 4; i++) draw_mask(0, i*h, w, h);
302306
draw_battery();
303307
draw_speaker();
308+
draw_contrast();
304309
}
305310
//}#pragma endregion Mask
306311

@@ -427,7 +432,6 @@
427432

428433
//{#pragma region Brightness
429434
void draw_brightness() {
430-
BRIGHTNESS = get_brightness();
431435
int x = SCREEN.w - 120;
432436
int y = POS.y + 106;
433437
int w, h;
@@ -444,7 +448,7 @@
444448
//if(BRIGHTNESS > 0) {
445449
i = 0;
446450
for(h = 0; h < 7; h++) {
447-
for(w = 0; w < (10 * BRIGHTNESS)+10; w++) {
451+
for(w = 0; w < (BRIGHTNESS_COUNT * BRIGHTNESS)+BRIGHTNESS+1; w++) {
448452
if(SETTING == 3) {
449453
buffer[i] = WHITE;
450454
} else {
@@ -453,40 +457,41 @@
453457
i++;
454458
}
455459
}
456-
ili9341_write_frame_rectangleLE(x, y, (10 * BRIGHTNESS)+10, 7, buffer);
460+
ili9341_write_frame_rectangleLE(x, y, (BRIGHTNESS_COUNT * BRIGHTNESS)+BRIGHTNESS+1, 7, buffer);
457461
//}
458-
459-
//draw_speaker();
462+
draw_contrast();
460463
}
461464
int32_t get_brightness() {
462465
return odroid_settings_Backlight_get();
463466
}
464467
void set_brightness() {
465468
odroid_settings_Backlight_set(BRIGHTNESS);
466-
usleep(15000);
469+
draw_brightness();
467470
apply_brightness();
468-
//draw_brightness();
469471
}
470472
void apply_brightness() {
471473
const int DUTY_MAX = 0x1fff;
474+
//BRIGHTNESS = get_brightness();
472475
int duty = DUTY_MAX * (BRIGHTNESS_LEVELS[BRIGHTNESS] * 0.01f);
473476

474-
//if(is_backlight_initialized()) {
475-
uint32_t currentDuty = ledc_get_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
476-
printf("\n******\nBRIGHTNESS:%d\nBRIGHTNESS_LEVELS[%d]:%d\nduty:%d\ncurrentDuty:%d\n******\n",
477-
BRIGHTNESS,
478-
BRIGHTNESS,
479-
BRIGHTNESS_LEVELS[BRIGHTNESS],
480-
duty,
481-
currentDuty);
482-
//if (currentDuty != duty) {
483-
ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty, 1);
484-
ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE);
485-
ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty);
486-
//}
487-
//}
488-
489-
//backlight_percentage_set(BRIGHTNESS_LEVELS[BRIGHTNESS]);
477+
if(is_backlight_initialized()) {
478+
currentDuty = ledc_get_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
479+
if (currentDuty != duty) {
480+
//ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, currentDuty);
481+
//ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
482+
//ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty, 1000);
483+
//ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE /*LEDC_FADE_NO_WAIT|LEDC_FADE_WAIT_DONE|LEDC_FADE_MAX*/);
484+
//ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, duty);
485+
//ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
486+
ledc_set_fade_time_and_start(
487+
LEDC_LOW_SPEED_MODE,
488+
LEDC_CHANNEL_0,
489+
duty,
490+
25,
491+
LEDC_FADE_WAIT_DONE
492+
);
493+
}
494+
}
490495
}
491496
//}#pragma endregion Brightness
492497

@@ -695,6 +700,46 @@
695700
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
696701
}
697702

703+
void draw_contrast() {
704+
int32_t dy = 0;
705+
switch(BRIGHTNESS) {
706+
case 10:
707+
case 9:
708+
case 8:
709+
dy = 0;
710+
break;
711+
case 7:
712+
case 6:
713+
case 5:
714+
dy = 16;
715+
break;
716+
case 4:
717+
case 3:
718+
case 2:
719+
dy = 32;
720+
break;
721+
case 1:
722+
case 0:
723+
dy = 48;
724+
break;
725+
}
726+
int i = 0;
727+
int x = SCREEN.w - 72;
728+
int y = 8;
729+
int h = 16;
730+
int w = 16;
731+
732+
draw_mask(x,y,16,16);
733+
734+
for(h = 0; h < 16; h++) {
735+
for(w = 0; w < 16; w++) {
736+
buffer[i] = brightness[dy+h][w] == WHITE ? WHITE : GUI.bg;
737+
i++;
738+
}
739+
}
740+
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
741+
}
742+
698743
void draw_numbers() {
699744
int x = 296;
700745
int y = POS.y + 48;
@@ -830,6 +875,7 @@
830875
//}#pragma endregion Sort
831876

832877
void get_files() {
878+
free(FILES);
833879
FILES = (char**)malloc(MAX_FILES * sizeof(void*));
834880
ROMS.total = 0;
835881

@@ -1181,12 +1227,12 @@
11811227
static void launcher() {
11821228
draw_battery();
11831229
draw_speaker();
1230+
draw_contrast();
11841231
while (true) {
11851232
/*
11861233
Get Gamepad State
11871234
*/
11881235
odroid_input_gamepad_read(&gamepad);
1189-
11901236
/*
11911237
LEFT
11921238
*/
@@ -1243,7 +1289,7 @@
12431289
}
12441290
}
12451291
if(SETTING == 3) {
1246-
if(BRIGHTNESS < 9) {
1292+
if(BRIGHTNESS < (BRIGHTNESS_COUNT-1)) {
12471293
BRIGHTNESS++;
12481294
set_brightness();
12491295
usleep(200000);

0 commit comments

Comments
 (0)