diff options
Diffstat (limited to '')
-rw-r--r-- | drv_Crystalfontz.c | 86 | ||||
-rw-r--r-- | plugin_mpd.c | 4 |
2 files changed, 87 insertions, 3 deletions
diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c index 5dd42b6..4526c02 100644 --- a/drv_Crystalfontz.c +++ b/drv_Crystalfontz.c @@ -353,6 +353,86 @@ static void drv_CF_send(const unsigned char cmd, const unsigned char len, const } +/* check http://www.crystalfontz.com/products/634/cgrom.html */ +/* HINT: the input should using the ISO-8859-1 charset */ +void convertToCgrom2(char *str) +{ + unsigned int i; + for (i = 0; i < strlen(str); i++) { + switch ((unsigned char) str[i]) { + case 0x5d: /* ] */ + str[i] = 252; + break; + case 0x5b: /* [ */ + str[i] = 250; + break; + case 0x24: /* $ */ + str[i] = 162; + break; + case 0x40: /* @ */ + str[i] = 160; + break; + case 0x5c: /* \ */ + str[i] = 251; + break; + case 0x7b: /* { */ + str[i] = 253; + break; + case 0x7d: /* } */ + str[i] = 255; + break; + case 0x7c: + str[i] = 254; /* pipe */ + break; + case 0x27: + case 0x60: + case 0xB4: + str[i] = 39; /* ' */ + break; + case 0xe8: + str[i] = 164; /* french e */ + break; + case 0xe9: + str[i] = 165; /* french e */ + break; + case 0xc8: + str[i] = 197; /* french E */ + break; + case 0xc9: + str[i] = 207; /* french E */ + break; + + case 0xe4: + str[i] = 123; /* small german ae */ + break; + case 0xc4: + str[i] = 91; /* big german ae */ + break; + case 0xf6: + str[i] = 124; /* small german oe */ + break; + case 0xd6: + str[i] = 92; /* big german oe */ + break; + case 0xfc: + str[i] = 126; /* small german ue */ + break; + case 0xdc: + str[i] = 94; /* big german ue */ + break; + case 0x5e: /* ^ */ + str[i] = 253; + break; + case 0x5f: /* _ */ + str[i] = 254; + break; + default: + break; + } + } +} + + static void drv_CF_write1(const int row, const int col, const char *data, const int len) { char cmd[3] = "\021xy"; /* set cursor position */ @@ -365,6 +445,11 @@ static void drv_CF_write1(const int row, const int col, const char *data, const drv_generic_serial_write(cmd, 3); } + /* Model 634 and 632 use another ROM */ + if (Model == 4 || Model == 2) { + convertToCgrom2((char *) data); + } + drv_generic_serial_write(data, len); } @@ -411,7 +496,6 @@ static void drv_CF_write3(const int row, const int col, const char *data, const memcpy(cmd + 2, data, l); drv_CF_send(31, l + 2, cmd); - } diff --git a/plugin_mpd.c b/plugin_mpd.c index b644a8a..0aaeae0 100644 --- a/plugin_mpd.c +++ b/plugin_mpd.c @@ -208,13 +208,13 @@ static int mpd_update() if (conn == NULL || conn->error) { if (conn) { if (errorcnt < ERROR_DISPLAY) - debug("[MPD] Error: [%s], try to reconnect to [%s]:[%i]\n", conn->errorStr, host, iport); + debug("[MPD] Error: [%s], try to reconnect to [%s]:[%i]\n", conn->errorStr, host, iport); mpd_closeConnection(conn); } else debug("[MPD] initialize connect to [%s]:[%i]\n", host, iport); conn = mpd_newConnection(host, iport, TIMEOUT_IN_S); - if (conn->error) { + if (conn->error) { if (errorcnt < ERROR_DISPLAY) error("[MPD] connection failed, give up..."); if (errorcnt == ERROR_DISPLAY) |