Custom characters on phi-panel

You can use all custom characters on phi-panels as long as you are not using them in a long message, which uses custom characters to display the scroll bar on the right.

You can do the following:

When you need to use custom characters, follow the sample code phi_panel_big_show between lines 167 and 189. The last command in that function prints “\eZ~” to the panel to reinitialize the panel’s internal custom characters. Otherwise you will see your custom characters in place of the scroll bar 🙂

You will need the custom character definitions in your code as well so:
The code may be a bit messed up by the blog posting restrictions but you can find original code in the beginning and between lines 167 and 189 of the sample code phi_panel_big_show.

PROGMEM prog_char ch0[]={B110,B100,B100,B110,B100000,B1010,B10101,B10101,0};// cm
PROGMEM prog_char ch1[]={B11011,B10011,B11011,B11011,B11011,B11011,B10001,B11111,0};//Inverted 1
PROGMEM prog_char ch2[]={B10001,B1110,B11110,B11101,B11011,B10111,B100000,B11111,0};//Inverted 2
PROGMEM prog_char ch3[]={B100000,B11101,B11011,B11101,B11110,B1110,B10001,B11111,0};//Inverted 3
PROGMEM prog_char ch4[]={B11101,B11001,B10101,B1101,B100000,B11101,B11101,B11111,0};//Inverted 4
PROGMEM prog_char ch5[]={B10,B100,B1000,B10011,B100,B10,B1,B110,0};// /s
PROGMEM prog_char ch6[]={B100000,B100000,B100,B1110,B11111,B100,B100,B100000,0};//Up arrow
PROGMEM prog_char ch7[]={B100000,B100000,B100,B100,B11111,B1110,B100,B100000,0};//Down arrow
PROGMEM const char *ch_item[] = {ch0, ch1, ch2, ch3, ch4, ch5, ch6, ch7};

byte ch_buffer[10];

void demo_custom_char()

{
for (byte i=0;i {
strcpy_P((char*)ch_buffer,(char*)pgm_read_word(&(ch_item[i])));
Serial.print(“\eS”); // Start custom character sequence
Serial.print(i,DEC); // Indicate the custom character to create
for (byte j=0;j {
Serial.write(ch_buffer[j]|0x80); // Add a 1 to MSB to make sure the custom character definition is always beyond a numerical value of 31 to avoid a confusion with control characters.
}
Serial.write(‘~’);
}
Serial.print(‘\f’); // Clear screen
Serial.print(“Custom character “);
for (byte i=0;i {
Serial.write(i);
}
delay(5000);
Serial.print(“\eZ~”); // Reinitialize phi_prompt since the long message requires custom characters;

}

Leave a Reply

%d