Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Morse code cheat sheet, better use [of] pixels available on screen

This improvement allows to show all characters even on a tiny screen
like the screen of the iPod Minis

Change-Id: Ibffd4f562d8bf9b3859528bbea59ca4f9190c4fd

+30 -20
+30 -20
apps/recorder/keyboard.c
··· 951 951 #ifdef HAVE_MORSE_INPUT 952 952 if (state->morse_mode) 953 953 { 954 - const int w = 6, h = 8; /* sysfixed font width, height */ 955 - int i, j, x, y; 954 + const int w = 6, h = 9; /* sysfixed font width, height */ 955 + int i, iNext, j, x, y; 956 956 int sc_w = vp->width, sc_h = vp->height;//pm->main_y - pm->keyboard_margin - 1; 957 957 958 958 /* Draw morse code screen with sysfont */ ··· 960 960 x = 0; 961 961 y = 0; 962 962 outline[1] = '\0'; 963 - 963 + 964 964 /* Draw morse code table with code descriptions. */ 965 - for (i = 0; morse_alphabets[i] != '\0'; i++) 966 - { 965 + for (i = 0; morse_alphabets[i] != '\0'; i++) { 967 966 int morse_code; 968 - 969 967 outline[0] = morse_alphabets[i]; 970 968 sc->putsxy(x, y, outline); 971 - 972 969 morse_code = morse_codes[i]; 973 - for (j = 0; morse_code > 0x01; morse_code >>= 1) 970 + for (j = 0; morse_code > 0x01; morse_code >>= 1) { 974 971 j++; 975 - 976 - x += w + 3 + j*4; 972 + } 973 + x += w + 3 + j * 4; 977 974 morse_code = morse_codes[i]; 978 - for (; morse_code > 0x01; morse_code >>= 1) 979 - { 975 + for (; morse_code > 0x01; morse_code >>= 1) { 980 976 x -= 4; 981 - if (morse_code & 0x01) 977 + if (morse_code & 0x01) { 982 978 sc->fillrect(x, y + 2, 3, 4); 983 - else 979 + } else { 984 980 sc->fillrect(x, y + 3, 1, 2); 981 + } 985 982 } 986 - 987 - x += w*5 - 3; 988 - if (x + w*6 >= sc_w) 989 - { 983 + x += j * 4; 984 + iNext = i + 1; 985 + if (morse_alphabets[iNext] == '\0') { 986 + break; 987 + } 988 + morse_code = morse_codes[iNext]; 989 + for (j = 0; morse_code > 0x01; morse_code >>= 1) { 990 + j++; 991 + } 992 + // If the next one will go out of line 993 + bool needNewLine = x + w + 3 + j * 4 + w >= sc_w; 994 + if (needNewLine) { 995 + if (y + h >= sc_h) { 996 + // No more height space 997 + break; 998 + } 990 999 x = 0; 991 1000 y += h; 992 - if (y + h >= sc_h) 993 - break; 1001 + } else { 1002 + // Some pixels for spacing in the same line 1003 + x += w; 994 1004 } 995 1005 } 996 1006 }