6363 bool INIT = false;
6464 bool SAVED = false;
6565 bool forceConsoleReset ;
66+
67+ int32_t VOLUME = 0 ;
68+ int32_t BRIGHTNESS = 0 ;
69+ const int32_t BRIGHTNESS_COUNT = 10 ;
70+ const int32_t BRIGHTNESS_LEVELS [10 ] = {10 ,20 ,30 ,40 ,50 ,60 ,70 ,80 ,90 ,100 };
6671//}#pragma endregion Globals
6772
6873//{#pragma region Structs
@@ -438,28 +443,33 @@ const uint16_t icons[55][5] = {
438443 }
439444 ili9341_write_frame_rectangleLE (x , y , 100 , 7 , buffer );
440445
441- i = 0 ;
442- for (h = 0 ; h < 7 ; h ++ ) {
443- for (w = 0 ; w < percent ; w ++ ) {
444- buffer [i ] = active ? GUI .hl : GUI .fg ;
445- i ++ ;
446- }
447- }
448- ili9341_write_frame_rectangleLE (x , y , percent , 7 , buffer );
446+ if (percent > 0 ) {
447+ i = 0 ;
448+ for (h = 0 ; h < 7 ; h ++ ) {
449+ for (w = 0 ; w < percent ; w ++ ) {
450+ buffer [i ] = active ? GUI .hl : GUI .fg ;
451+ i ++ ;
452+ }
453+ }
454+ ili9341_write_frame_rectangleLE (x , y , percent , 7 , buffer );
455+ }
449456 }
450457
451458 void hud_volume () {
452459 // y=176;
460+ int32_t VOLUME = odroid_audio_volume_get ();
453461 int LIMIT = OPTIONS - 3 ;
454462 bool active = OPTION == LIMIT ? true : false;
455- hud_bar ((SCREEN .w - 120 ), 176 , 50 , active );
463+ hud_bar ((SCREEN .w - 120 ), 176 , VOLUME * 12.5 , active );
456464 }
457465
458466 void hud_brightness () {
459467 // y=176;
460468 int LIMIT = OPTIONS - 2 ;
461469 bool active = OPTION == LIMIT ? true : false;
462- hud_bar ((SCREEN .w - 120 ), 196 , 25 , active );
470+ BRIGHTNESS = odroid_display_backlight_get ();
471+
472+ hud_bar ((SCREEN .w - 120 ), 196 , (BRIGHTNESS_COUNT * BRIGHTNESS )+ BRIGHTNESS + 1 , active );
463473 }
464474
465475 void hud_options () {
@@ -543,9 +553,9 @@ const uint16_t icons[55][5] = {
543553
544554//{#pragma region Menu
545555 void hud_menu (void ) {
546- int volume = odroid_audio_volume_get ();
556+ VOLUME = odroid_audio_volume_get ();
547557 #ifdef CONFIG_LCD_DRIVER_CHIP_RETRO_ESP32
548- volume = 8 ;
558+ // volume = 8;
549559 #endif
550560 odroid_audio_terminate ();
551561 hud_init ();
@@ -576,12 +586,57 @@ const uint16_t icons[55][5] = {
576586 usleep (200000 );
577587 //debounce(ODROID_INPUT_DOWN);
578588 }
589+
590+ /*
591+ LEFT
592+ */
593+ if (gamepad .values [ODROID_INPUT_LEFT ]) {
594+ if (OPTION == OPTIONS - 3 ) {
595+ if (VOLUME > 0 ) {
596+ VOLUME -- ;
597+ odroid_audio_volume_set (VOLUME );
598+ hud_options ();
599+ usleep (200000 );
600+ }
601+ }
602+ if (OPTION == OPTIONS - 3 + 1 ) {
603+ if (BRIGHTNESS > 0 ) {
604+ BRIGHTNESS -- ;
605+ odroid_display_backlight_set (BRIGHTNESS );
606+ hud_options ();
607+ usleep (200000 );
608+ }
609+ }
610+ }
611+
612+ /*
613+ RIGHT
614+ */
615+ if (gamepad .values [ODROID_INPUT_RIGHT ]) {
616+ if (OPTION == OPTIONS - 3 ) {
617+ if (VOLUME < 8 ) {
618+ VOLUME ++ ;
619+ odroid_audio_volume_set (VOLUME );
620+ hud_options ();
621+ usleep (200000 );
622+ }
623+ }
624+ if (OPTION == OPTIONS - 3 + 1 ) {
625+ if (BRIGHTNESS < (BRIGHTNESS_COUNT - 1 )) {
626+ BRIGHTNESS ++ ;
627+ odroid_display_backlight_set (BRIGHTNESS );
628+ hud_options ();
629+ usleep (200000 );
630+ }
631+ }
632+ }
633+
579634 /*
580635 BUTTON B
581636 */
582637 if (gamepad .values [ODROID_INPUT_B ]) {
583638 ACTION = 0 ;
584- odroid_audio_volume_set (volume );
639+ odroid_audio_volume_set (VOLUME );
585640
586641 int sink = odroid_settings_AudioSink_get ();
587642 odroid_settings_AudioSink_set (sink );
@@ -593,7 +648,7 @@ const uint16_t icons[55][5] = {
593648 BUTTON A
594649 */
595650 if (gamepad .values [ODROID_INPUT_A ]) {
596- odroid_audio_volume_set (volume );
651+ odroid_audio_volume_set (VOLUME );
597652
598653 int sink = odroid_settings_AudioSink_get ();
599654 odroid_settings_AudioSink_set (sink );
0 commit comments