After some googling I came up with this solution. I really hope someone finds a more elegant way to express it. These embedded ternary operators are really error prone.
#define IV(i) ( \
(i=='┌'i)=='┌' ? (0xc9) : \
((i=='⎩'i)=='⎩' ? (0x15) : \
((i=='⎭'i)=='⎭' ? (0x17) : \
((i=='⎰'i)=='⎰' ? (0x18) : \
((i=='°'i)=='°' ? (0xb2) : \
((i=='TM'i)=='TM' ? (0xd0) : \
((i=='Ξ'i)=='Ξ' ? (0xd8) : \
(i) ))))))
char line2[21] = {0x15, '_', 0xd8, '_', 0x17, 0xd0, '1', 0xc9, '5', 0x18, '5', '0', '0', 0xb2, ' ', ' ', ' ', ' ', ' ', 0}; //original
char line4[21] = {IV('⎩'), '_', IV('Ξ'), '_', IV('⎭'), IV('TM'), '1', IV('┌'), '5', IV('⎰'), '5', '0', '0', IV('°'), ' ', ' ', ' ', ' ', ' ', 0}; //wanted
void setup() {}
void loop() {}
After some googling I came up with this solution. I really hope someone finds a more elegant way to express it. These embedded ternary operators are really error prone.
#define IV(i) \
(i=='┌') ? (0xc9) : \
((i=='⎩') ? (0x15) : \
((i=='⎭') ? (0x17) : \
((i=='⎰') ? (0x18) : \
((i=='°') ? (0xb2) : \
((i=='TM') ? (0xd0) : \
((i=='Ξ') ? (0xd8) : \
(i) ))))))
char line2[21] = {0x15, '_', 0xd8, '_', 0x17, 0xd0, '1', 0xc9, '5', 0x18, '5', '0', '0', 0xb2, ' ', ' ', ' ', ' ', ' ', 0}; //original
char line4[21] = {IV('⎩'), '_', IV('Ξ'), '_', IV('⎭'), IV('TM'), '1', IV('┌'), '5', IV('⎰'), '5', '0', '0', IV('°'), ' ', ' ', ' ', ' ', ' ', 0}; //wanted
void setup() {}
void loop() {}
After some googling I came up with this solution. I really hope someone finds a more elegant way to express it. These embedded ternary operators are really error prone.
#define IV(i) ( \
(i)=='┌' ? 0xc9 : \
(i)=='⎩' ? 0x15 : \
(i)=='⎭' ? 0x17 : \
(i)=='⎰' ? 0x18 : \
(i)=='°' ? 0xb2 : \
(i)=='TM' ? 0xd0 : \
(i)=='Ξ' ? 0xd8 : \
(i) )
char line2[21] = {0x15, '_', 0xd8, '_', 0x17, 0xd0, '1', 0xc9, '5', 0x18, '5', '0', '0', 0xb2, ' ', ' ', ' ', ' ', ' ', 0}; //original
char line4[21] = {IV('⎩'), '_', IV('Ξ'), '_', IV('⎭'), IV('TM'), '1', IV('┌'), '5', IV('⎰'), '5', '0', '0', IV('°'), ' ', ' ', ' ', ' ', ' ', 0}; //wanted
void setup() {}
void loop() {}
After some googling I came up with this solution. I really hope someone finds a more elegant way to express it. These embedded ternary operators are really error prone.
#define IV(i) \
(i=='┌') ? (0xc9) : \
((i=='⎩') ? (0x15) : \
((i=='⎭') ? (0x17) : \
((i=='⎰') ? (0x18) : \
((i=='°') ? (0xb2) : \
((i=='TM') ? (0xd0) : \
((i=='Ξ') ? (0xd8) : \
(i) ))))))
char line2[21] = {0x15, '_', 0xd8, '_', 0x17, 0xd0, '1', 0xc9, '5', 0x18, '5', '0', '0', 0xb2, ' ', ' ', ' ', ' ', ' ', 0}; //original
char line4[21] = {IV('⎩'), '_', IV('Ξ'), '_', IV('⎭'), IV('TM'), '1', IV('┌'), '5', IV('⎰'), '5', '0', '0', IV('°'), ' ', ' ', ' ', ' ', ' ', 0}; //wanted
void setup() {}
void loop() {}