diff options
Diffstat (limited to 'apps/plugins/resistor.c')
-rw-r--r-- | apps/plugins/resistor.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/apps/plugins/resistor.c b/apps/plugins/resistor.c index ec6a364f23..2e204010a9 100644 --- a/apps/plugins/resistor.c +++ b/apps/plugins/resistor.c | |||
@@ -566,15 +566,17 @@ static void display_helpfile(void) | |||
566 | { 159, TEXT_UNDERLINE }, | 566 | { 159, TEXT_UNDERLINE }, |
567 | LAST_STYLE_ITEM | 567 | LAST_STYLE_ITEM |
568 | }; | 568 | }; |
569 | 569 | ||
570 | display_text(ARRAYLEN(helpfile_text), helpfile_text, formatting, | 570 | display_text(ARRAYLEN(helpfile_text), helpfile_text, formatting, |
571 | NULL, true); | 571 | NULL, true); |
572 | return; | 572 | return; |
573 | } | 573 | } |
574 | 574 | ||
575 | static void led_resistance_calc(void) | 575 | static void led_resistance_calc(void) |
576 | { | 576 | { |
577 | #ifdef HAVE_BACKLIGHT | ||
577 | backlight_ignore_timeout(); | 578 | backlight_ignore_timeout(); |
579 | #endif | ||
578 | int voltage_menu_selection, button_press, j, k, l, foreward_current = 0; | 580 | int voltage_menu_selection, button_press, j, k, l, foreward_current = 0; |
579 | int fwd_current_selection = 0; | 581 | int fwd_current_selection = 0; |
580 | bool quit = false; | 582 | bool quit = false; |
@@ -759,14 +761,17 @@ static void led_resistance_calc(void) | |||
759 | rb->lcd_puts_scroll(resistance_val_x, lineno++, power_rating_out_str); | 761 | rb->lcd_puts_scroll(resistance_val_x, lineno++, power_rating_out_str); |
760 | 762 | ||
761 | rb->lcd_update(); | 763 | rb->lcd_update(); |
762 | 764 | ||
763 | while ((button_press = rb->button_get(true)) & BUTTON_REL); | 765 | while ((button_press = rb->button_get(true)) & BUTTON_REL); |
764 | switch(button_press) { | 766 | switch(button_press) { |
765 | case PLA_SELECT: | 767 | case PLA_SELECT: |
766 | break; | 768 | break; |
767 | default: | 769 | default: |
768 | quit = true; | 770 | quit = true; |
771 | |||
772 | #ifdef HAVE_BACKLIGHT | ||
769 | backlight_use_settings(); | 773 | backlight_use_settings(); |
774 | #endif | ||
770 | break; | 775 | break; |
771 | } | 776 | } |
772 | } | 777 | } |
@@ -776,10 +781,12 @@ static void led_resistance_calc(void) | |||
776 | rb->lcd_clear_display(); | 781 | rb->lcd_clear_display(); |
777 | } | 782 | } |
778 | 783 | ||
779 | 784 | ||
780 | static void resistance_to_color(void) | 785 | static void resistance_to_color(void) |
781 | { | 786 | { |
787 | #ifdef HAVE_BACKLIGHT | ||
782 | backlight_ignore_timeout(); | 788 | backlight_ignore_timeout(); |
789 | #endif | ||
783 | int menu_selection; | 790 | int menu_selection; |
784 | int menu_selection_tol; | 791 | int menu_selection_tol; |
785 | int button_press; | 792 | int button_press; |
@@ -883,27 +890,29 @@ static void resistance_to_color(void) | |||
883 | in_resistance_int,band_data[units_used].unit); | 890 | in_resistance_int,band_data[units_used].unit); |
884 | return; | 891 | return; |
885 | } | 892 | } |
886 | 893 | ||
887 | rb->lcd_clear_display(); | 894 | rb->lcd_clear_display(); |
888 | lineno = INITIAL_TEXT_Y; | 895 | lineno = INITIAL_TEXT_Y; |
889 | #ifndef USE_TEXT_ONLY | 896 | #ifndef USE_TEXT_ONLY |
890 | draw_resistor(first_band, second_band, multiplier, fourth_band); | 897 | draw_resistor(first_band, second_band, multiplier, fourth_band); |
891 | #endif | 898 | #endif |
892 | draw_resistor_text(first_band, second_band, multiplier, fourth_band); | 899 | draw_resistor_text(first_band, second_band, multiplier, fourth_band); |
893 | 900 | ||
894 | rb->snprintf(out_str, sizeof(out_str), "Input: %d %s", in_resistance_int, | 901 | rb->snprintf(out_str, sizeof(out_str), "Input: %d %s", in_resistance_int, |
895 | band_data[units_used].unit); | 902 | band_data[units_used].unit); |
896 | display->set_viewport(&text_vp); | 903 | display->set_viewport(&text_vp); |
897 | rb->lcd_puts_scroll(r_to_c_out_str_x, lineno++, out_str); | 904 | rb->lcd_puts_scroll(r_to_c_out_str_x, lineno++, out_str); |
898 | rb->lcd_update(); | 905 | rb->lcd_update(); |
899 | 906 | ||
900 | button_press = rb->button_get(true); | 907 | button_press = rb->button_get(true); |
901 | switch(button_press) { | 908 | switch(button_press) { |
902 | case PLA_SELECT: | 909 | case PLA_SELECT: |
903 | break; | 910 | break; |
904 | default: | 911 | default: |
905 | quit = true; | 912 | quit = true; |
913 | #ifdef HAVE_BACKLIGHT | ||
906 | backlight_use_settings(); | 914 | backlight_use_settings(); |
915 | #endif | ||
907 | break; | 916 | break; |
908 | } | 917 | } |
909 | } | 918 | } |
@@ -912,25 +921,27 @@ static void resistance_to_color(void) | |||
912 | display->set_viewport(&screen_vp); | 921 | display->set_viewport(&screen_vp); |
913 | rb->lcd_clear_display(); | 922 | rb->lcd_clear_display(); |
914 | } | 923 | } |
915 | 924 | ||
916 | static void color_to_resistance(void) | 925 | static void color_to_resistance(void) |
917 | { | 926 | { |
927 | #ifdef HAVE_BACKLIGHT | ||
918 | backlight_ignore_timeout(); | 928 | backlight_ignore_timeout(); |
929 | #endif | ||
919 | bool quit = false; | 930 | bool quit = false; |
920 | int button_input = 0; | 931 | int button_input = 0; |
921 | 932 | ||
922 | /* The colors of the bands */ | 933 | /* The colors of the bands */ |
923 | enum color first_band = 0; | 934 | enum color first_band = 0; |
924 | enum color second_band = 0; | 935 | enum color second_band = 0; |
925 | enum color third_band = 0; | 936 | enum color third_band = 0; |
926 | enum color fourth_band = 0; | 937 | enum color fourth_band = 0; |
927 | 938 | ||
928 | int total_resistance_centiunits = 0; | 939 | int total_resistance_centiunits = 0; |
929 | char total_resistance_str [35]; | 940 | char total_resistance_str [35]; |
930 | 941 | ||
931 | rb->splash(HZ/2, "Colour to resistance"); | 942 | rb->splash(HZ/2, "Colour to resistance"); |
932 | rb->lcd_clear_display(); | 943 | rb->lcd_clear_display(); |
933 | 944 | ||
934 | while(!quit) { | 945 | while(!quit) { |
935 | first_band = do_first_band_menu(); | 946 | first_band = do_first_band_menu(); |
936 | if(first_band==RES_INVALID) break; | 947 | if(first_band==RES_INVALID) break; |
@@ -984,9 +995,11 @@ static void color_to_resistance(void) | |||
984 | case PLA_SELECT: | 995 | case PLA_SELECT: |
985 | default: | 996 | default: |
986 | quit = true; | 997 | quit = true; |
998 | #ifdef HAVE_BACKLIGHT | ||
987 | backlight_use_settings(); | 999 | backlight_use_settings(); |
1000 | #endif | ||
988 | break; | 1001 | break; |
989 | } | 1002 | } |
990 | } | 1003 | } |
991 | display->set_viewport(&text_vp); | 1004 | display->set_viewport(&text_vp); |
992 | rb->lcd_scroll_stop(); | 1005 | rb->lcd_scroll_stop(); |