I'm trying to solve the same issue and have gotten past the first hurdle. I'm displaying the correct characters in a menu I'm coding, but stuff is being added on the ends of the lines.
Here's my code:
// Menu and state variables
#define ZERO 0
#define MAIN_SCREEN 1
#define MENU 2
#define PAIRING 3
#define TRACKING 4
#define NOTICE 5
// Display strings for above constants
char vilolage[9] = {0x56, 0x69, 0x6C, 0x6F, 0x6C, 0xE4, 0x67, 0x65, 0x20};
char sluta_spara[11] = {0x53, 0x6C, 0x75, 0x74, 0x61, 0x20, 0x73, 0x70, 0xE5, 0x72, 0x61};
char borja_spara[11] = {0x42, 0xF6, 0x72, 0x6A, 0x61, 0x20, 0x73, 0x70, 0xE5, 0x72, 0x61};
char* MenuStrings[] = {
vilolage, // ZERO 0
"Tillbaka", // MAIN_SCREEN 1
"Meny", // MENU 2
"Koppla enhet", // PAIRING 3
hasTarget ? sluta_spara : borja_spara, // TRACKING 4
"Skicka notis", // NOTICE 5
};
// Items and order of menu
int MenuItems[] = {
MAIN_SCREEN, // Return to main screen
PAIRING, // Try to pair with another device
TRACKING, // Start tracking a paired device
NOTICE, // Send notice to a paired device
ZERO // Go to sleep mode
};
#define MenuLength sizeof(MenuItems) / sizeof(int)
// The rendering of the menu:
void drawMenu() {
for (int i = 0; i < MenuLength; i++) {
u8g.drawStr( charWidth*2, (charHeight+1)*(i+1), MenuStrings[MenuItems[i]]);
}
u8g.drawStr( 0, (charHeight+1)*(currentMenuOption+1), ">");
}
As you can see in the attached photo, the contents of borja_spara
is added after vilolage
. Some memory leakage, I'm guessing.
I'll try to add more here when I've solved this.