|
@@ -1044,9 +1044,9 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1044
|
1044
|
if (value != NULL) {
|
1045
|
1045
|
lcd_put_wchar(':');
|
1046
|
1046
|
int len = utf8_strlen(value);
|
1047
|
|
- const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
1048
|
|
- lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
|
1049
|
|
- lcd_put_wchar(' '); // overwrite char if value gets shorter
|
|
1047
|
+ const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
|
1048
|
+ lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
|
|
1049
|
+ lcd_put_wchar(' '); // Overwrite char if value gets shorter
|
1050
|
1050
|
lcd_put_u8str(value);
|
1051
|
1051
|
}
|
1052
|
1052
|
}
|
|
@@ -1156,69 +1156,73 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1156
|
1156
|
|
1157
|
1157
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
1158
|
1158
|
|
1159
|
|
- /**
|
1160
|
|
- Possible map screens:
|
1161
|
|
-
|
1162
|
|
- 16x2 |X000.00 Y000.00|
|
1163
|
|
- |(00,00) Z00.000|
|
1164
|
|
-
|
1165
|
|
- 20x2 | X:000.00 Y:000.00 |
|
1166
|
|
- | (00,00) Z:00.000 |
|
|
1159
|
+ #define HD44780_CHAR_WIDTH 5
|
|
1160
|
+ #define HD44780_CHAR_HEIGHT 8
|
|
1161
|
+ #define MESH_MAP_COLS 7
|
|
1162
|
+ #define MESH_MAP_ROWS 4
|
|
1163
|
+
|
|
1164
|
+ #define CHAR_LINE_TOP 0
|
|
1165
|
+ #define CHAR_LINE_BOT 1
|
|
1166
|
+ #define CHAR_EDGE_L 2
|
|
1167
|
+ #define CHAR_EDGE_R 3
|
|
1168
|
+ #define CHAR_UL_UL 4
|
|
1169
|
+ #define CHAR_LR_UL 5
|
|
1170
|
+ #define CHAR_UL_LR 6
|
|
1171
|
+ #define CHAR_LR_LR 7
|
|
1172
|
+
|
|
1173
|
+ #define TOP_LEFT _BV(0)
|
|
1174
|
+ #define TOP_RIGHT _BV(1)
|
|
1175
|
+ #define LOWER_LEFT _BV(2)
|
|
1176
|
+ #define LOWER_RIGHT _BV(3)
|
1167
|
1177
|
|
1168
|
|
- 16x4 |+-------+(00,00)|
|
1169
|
|
- || |X000.00|
|
1170
|
|
- || |Y000.00|
|
1171
|
|
- |+-------+Z00.000|
|
1172
|
|
-
|
1173
|
|
- 20x4 | +-------+ (00,00) |
|
1174
|
|
- | | | X:000.00|
|
1175
|
|
- | | | Y:000.00|
|
1176
|
|
- | +-------+ Z:00.000|
|
1177
|
|
- */
|
|
1178
|
+ /**
|
|
1179
|
+ * Possible map screens:
|
|
1180
|
+ *
|
|
1181
|
+ * 16x2 |X000.00 Y000.00|
|
|
1182
|
+ * |(00,00) Z00.000|
|
|
1183
|
+ *
|
|
1184
|
+ * 20x2 | X:000.00 Y:000.00 |
|
|
1185
|
+ * | (00,00) Z:00.000 |
|
|
1186
|
+ *
|
|
1187
|
+ * 16x4 |+-------+(00,00)|
|
|
1188
|
+ * || |X000.00|
|
|
1189
|
+ * || |Y000.00|
|
|
1190
|
+ * |+-------+Z00.000|
|
|
1191
|
+ *
|
|
1192
|
+ * 20x4 | +-------+ (00,00) |
|
|
1193
|
+ * | | | X:000.00|
|
|
1194
|
+ * | | | Y:000.00|
|
|
1195
|
+ * | +-------+ Z:00.000|
|
|
1196
|
+ */
|
1178
|
1197
|
|
1179
|
1198
|
typedef struct {
|
1180
|
|
- uint8_t custom_char_bits[ULTRA_Y_PIXELS_PER_CHAR];
|
|
1199
|
+ uint8_t custom_char_bits[HD44780_CHAR_HEIGHT];
|
1181
|
1200
|
} custom_char;
|
1182
|
1201
|
|
1183
|
1202
|
typedef struct {
|
1184
|
|
- uint8_t column, row;
|
1185
|
|
- uint8_t y_pixel_offset, x_pixel_offset;
|
1186
|
|
- uint8_t x_pixel_mask;
|
|
1203
|
+ uint8_t column, row,
|
|
1204
|
+ x_pixel_offset, y_pixel_offset,
|
|
1205
|
+ x_pixel_mask;
|
1187
|
1206
|
} coordinate;
|
1188
|
1207
|
|
1189
|
|
- void add_edges_to_custom_char(custom_char * const custom, coordinate * const ul, coordinate * const lr, coordinate * const brc, const uint8_t cell_location);
|
|
1208
|
+ void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location);
|
1190
|
1209
|
FORCE_INLINE static void clear_custom_char(custom_char * const cc) { ZERO(cc->custom_char_bits); }
|
1191
|
1210
|
|
1192
|
|
- /*
|
1193
|
|
- // This debug routine should be deleted by anybody that sees it. It doesn't belong here
|
1194
|
|
- // But I'm leaving it for now until we know the 20x4 Radar Map is working right.
|
1195
|
|
- // We may need it again if any funny lines show up on the mesh points.
|
1196
|
|
- void dump_custom_char(char *title, custom_char *c) {
|
1197
|
|
- SERIAL_PROTOCOLLN(title);
|
1198
|
|
- for (uint8_t j = 0; j < 8; j++) {
|
1199
|
|
- for (uint8_t i = 7; i >= 0; i--)
|
1200
|
|
- SERIAL_PROTOCOLCHAR(TEST(c->custom_char_bits[j], i) ? '1' : '0');
|
1201
|
|
- SERIAL_EOL();
|
1202
|
|
- }
|
1203
|
|
- SERIAL_EOL();
|
1204
|
|
- }
|
1205
|
|
- //*/
|
1206
|
|
-
|
1207
|
1211
|
coordinate pixel_location(int16_t x, int16_t y) {
|
1208
|
1212
|
coordinate ret_val;
|
1209
|
1213
|
int16_t xp, yp, r, c;
|
1210
|
1214
|
|
1211
|
1215
|
x++; y++; // +1 because lines on the left and top
|
1212
|
1216
|
|
1213
|
|
- c = x / (ULTRA_X_PIXELS_PER_CHAR);
|
1214
|
|
- r = y / (ULTRA_Y_PIXELS_PER_CHAR);
|
|
1217
|
+ c = x / (HD44780_CHAR_WIDTH);
|
|
1218
|
+ r = y / (HD44780_CHAR_HEIGHT);
|
1215
|
1219
|
|
1216
|
1220
|
ret_val.column = c;
|
1217
|
1221
|
ret_val.row = r;
|
1218
|
1222
|
|
1219
|
|
- xp = x - c * (ULTRA_X_PIXELS_PER_CHAR); // get the pixel offsets into the character cell
|
1220
|
|
- xp = ULTRA_X_PIXELS_PER_CHAR - 1 - xp; // column within relevant character cell (0 on the right)
|
1221
|
|
- yp = y - r * (ULTRA_Y_PIXELS_PER_CHAR);
|
|
1223
|
+ xp = x - c * (HD44780_CHAR_WIDTH); // Get the pixel offsets into the character cell
|
|
1224
|
+ xp = HD44780_CHAR_WIDTH - 1 - xp; // Column within relevant character cell (0 on the right)
|
|
1225
|
+ yp = y - r * (HD44780_CHAR_HEIGHT);
|
1222
|
1226
|
|
1223
|
1227
|
ret_val.x_pixel_mask = _BV(xp);
|
1224
|
1228
|
ret_val.x_pixel_offset = xp;
|
|
@@ -1228,6 +1232,13 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1228
|
1232
|
|
1229
|
1233
|
inline coordinate pixel_location(const uint8_t x, const uint8_t y) { return pixel_location((int16_t)x, (int16_t)y); }
|
1230
|
1234
|
|
|
1235
|
+ void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const uint8_t x, const uint8_t y) {
|
|
1236
|
+ add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
|
1237
|
+ lcd.createChar(c, (uint8_t*)&chrdata);
|
|
1238
|
+ lcd_moveto(x, y);
|
|
1239
|
+ lcd_put_wchar(c);
|
|
1240
|
+ }
|
|
1241
|
+
|
1231
|
1242
|
void lcd_implementation_ubl_plot(const uint8_t x, const uint8_t inverted_y) {
|
1232
|
1243
|
|
1233
|
1244
|
#if LCD_WIDTH >= 20
|
|
@@ -1280,44 +1291,43 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1280
|
1291
|
|
1281
|
1292
|
lcd_implementation_clear();
|
1282
|
1293
|
|
1283
|
|
- x_map_pixels = (ULTRA_X_PIXELS_PER_CHAR) * (ULTRA_COLUMNS_FOR_MESH_MAP) - 2; // minus 2 because we are drawing a box around the map
|
1284
|
|
- y_map_pixels = (ULTRA_Y_PIXELS_PER_CHAR) * (ULTRA_ROWS_FOR_MESH_MAP) - 2;
|
|
1294
|
+ x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map
|
|
1295
|
+ y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2;
|
1285
|
1296
|
|
1286
|
1297
|
pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X);
|
1287
|
1298
|
pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y);
|
1288
|
1299
|
|
1289
|
|
- if (pixels_per_x_mesh_pnt >= ULTRA_X_PIXELS_PER_CHAR) { // There are only 2 custom characters available, so the X
|
1290
|
|
- pixels_per_x_mesh_pnt = ULTRA_X_PIXELS_PER_CHAR; // size of the mesh point needs to fit within them independent
|
1291
|
|
- suppress_x_offset = 1; // of where the starting pixel is located.
|
|
1300
|
+ if (pixels_per_x_mesh_pnt >= HD44780_CHAR_WIDTH) { // There are only 2 custom characters available, so the X
|
|
1301
|
+ pixels_per_x_mesh_pnt = HD44780_CHAR_WIDTH; // Size of the mesh point needs to fit within them independent
|
|
1302
|
+ suppress_x_offset = 1; // Of where the starting pixel is located.
|
1292
|
1303
|
}
|
1293
|
1304
|
|
1294
|
|
- if (pixels_per_y_mesh_pnt >= ULTRA_Y_PIXELS_PER_CHAR) { // There are only 2 custom characters available, so the Y
|
1295
|
|
- pixels_per_y_mesh_pnt = ULTRA_Y_PIXELS_PER_CHAR; // size of the mesh point needs to fit within them independent
|
1296
|
|
- suppress_y_offset = 1; // of where the starting pixel is located.
|
|
1305
|
+ if (pixels_per_y_mesh_pnt >= HD44780_CHAR_HEIGHT) { // There are only 2 custom characters available, so the Y
|
|
1306
|
+ pixels_per_y_mesh_pnt = HD44780_CHAR_HEIGHT; // Size of the mesh point needs to fit within them independent
|
|
1307
|
+ suppress_y_offset = 1; // Of where the starting pixel is located.
|
1297
|
1308
|
}
|
1298
|
1309
|
|
1299
|
|
- x_map_pixels = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X); // now we have the right number of pixels to make both
|
1300
|
|
- y_map_pixels = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y); // directions fit nicely
|
|
1310
|
+ x_map_pixels = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X); // Now we have the right number of pixels to make both
|
|
1311
|
+ y_map_pixels = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y); // Directions fit nicely
|
1301
|
1312
|
|
1302
|
|
- right_edge = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X) + 1; // find location of right edge within the character cell
|
1303
|
|
- bottom_line= pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 1; // find location of bottome line within the character cell
|
|
1313
|
+ right_edge = pixels_per_x_mesh_pnt * (GRID_MAX_POINTS_X) + 1; // Find location of right edge within the character cell
|
|
1314
|
+ bottom_line = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 1; // Find location of bottome line within the character cell
|
1304
|
1315
|
|
1305
|
|
- n_rows = bottom_line / (ULTRA_Y_PIXELS_PER_CHAR) + 1;
|
1306
|
|
- n_cols = right_edge / (ULTRA_X_PIXELS_PER_CHAR) + 1;
|
|
1316
|
+ n_rows = bottom_line / (HD44780_CHAR_HEIGHT) + 1;
|
|
1317
|
+ n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
1307
|
1318
|
|
1308
|
1319
|
for (i = 0; i < n_cols; i++) {
|
1309
|
1320
|
lcd_moveto(i, 0);
|
1310
|
|
- lcd_put_wchar((char)0x00); // top line of the box
|
1311
|
|
-
|
|
1321
|
+ lcd_put_wchar(CHAR_LINE_TOP); // Box Top line
|
1312
|
1322
|
lcd_moveto(i, n_rows - 1);
|
1313
|
|
- lcd_put_wchar(0x01); // bottom line of the box
|
|
1323
|
+ lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line
|
1314
|
1324
|
}
|
1315
|
1325
|
|
1316
|
1326
|
for (j = 0; j < n_rows; j++) {
|
1317
|
1327
|
lcd_moveto(0, j);
|
1318
|
|
- lcd_put_wchar(0x02); // Left edge of the box
|
|
1328
|
+ lcd_put_wchar(CHAR_EDGE_L); // Box Left edge
|
1319
|
1329
|
lcd_moveto(n_cols - 1, j);
|
1320
|
|
- lcd_put_wchar(0x03); // right edge of the box
|
|
1330
|
+ lcd_put_wchar(CHAR_EDGE_R); // Box Right edge
|
1321
|
1331
|
}
|
1322
|
1332
|
|
1323
|
1333
|
/**
|
|
@@ -1325,36 +1335,36 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1325
|
1335
|
*/
|
1326
|
1336
|
|
1327
|
1337
|
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
1328
|
|
- l = (ULTRA_Y_PIXELS_PER_CHAR) * n_rows;
|
1329
|
|
- if (l > k && l - k >= (ULTRA_Y_PIXELS_PER_CHAR) / 2) {
|
1330
|
|
- lcd_moveto(0, n_rows - 1); // left edge of the box
|
|
1338
|
+ l = (HD44780_CHAR_HEIGHT) * n_rows;
|
|
1339
|
+ if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
|
1340
|
+ lcd_moveto(0, n_rows - 1); // Box Left edge
|
1331
|
1341
|
lcd_put_wchar(' ');
|
1332
|
|
- lcd_moveto(n_cols - 1, n_rows - 1); // right edge of the box
|
|
1342
|
+ lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge
|
1333
|
1343
|
lcd_put_wchar(' ');
|
1334
|
1344
|
}
|
1335
|
1345
|
|
1336
|
1346
|
clear_custom_char(&new_char);
|
1337
|
|
- new_char.custom_char_bits[0] = 0b11111U; // char #0 is used for the top line of the box
|
1338
|
|
- lcd.createChar(0, (uint8_t*)&new_char);
|
|
1347
|
+ new_char.custom_char_bits[0] = 0b11111U; // Char #0 is used for the box top line
|
|
1348
|
+ lcd.createChar(CHAR_LINE_TOP, (uint8_t*)&new_char);
|
1339
|
1349
|
|
1340
|
1350
|
clear_custom_char(&new_char);
|
1341
|
|
- k = (GRID_MAX_POINTS_Y) * pixels_per_y_mesh_pnt + 1; // row of pixels for the bottom box line
|
1342
|
|
- l = k % (ULTRA_Y_PIXELS_PER_CHAR); // row within relevant character cell
|
1343
|
|
- new_char.custom_char_bits[l] = 0b11111U; // char #1 is used for the bottom line of the box
|
1344
|
|
- lcd.createChar(1, (uint8_t*)&new_char);
|
|
1351
|
+ k = (GRID_MAX_POINTS_Y) * pixels_per_y_mesh_pnt + 1; // Row of pixels for the bottom box line
|
|
1352
|
+ l = k % (HD44780_CHAR_HEIGHT); // Row within relevant character cell
|
|
1353
|
+ new_char.custom_char_bits[l] = 0b11111U; // Char #1 is used for the box bottom line
|
|
1354
|
+ lcd.createChar(CHAR_LINE_BOT, (uint8_t*)&new_char);
|
1345
|
1355
|
|
1346
|
1356
|
clear_custom_char(&new_char);
|
1347
|
|
- for (j = 0; j < ULTRA_Y_PIXELS_PER_CHAR; j++)
|
1348
|
|
- new_char.custom_char_bits[j] = 0b10000U; // char #2 is used for the left edge of the box
|
1349
|
|
- lcd.createChar(2, (uint8_t*)&new_char);
|
|
1357
|
+ for (j = 0; j < HD44780_CHAR_HEIGHT; j++)
|
|
1358
|
+ new_char.custom_char_bits[j] = 0b10000U; // Char #2 is used for the box left edge
|
|
1359
|
+ lcd.createChar(CHAR_EDGE_L, (uint8_t*)&new_char);
|
1350
|
1360
|
|
1351
|
1361
|
clear_custom_char(&new_char);
|
1352
|
|
- m = (GRID_MAX_POINTS_X) * pixels_per_x_mesh_pnt + 1; // Column of pixels for the right box line
|
1353
|
|
- n = m % (ULTRA_X_PIXELS_PER_CHAR); // Column within relevant character cell
|
1354
|
|
- i = ULTRA_X_PIXELS_PER_CHAR - 1 - n; // Column within relevant character cell (0 on the right)
|
1355
|
|
- for (j = 0; j < ULTRA_Y_PIXELS_PER_CHAR; j++)
|
1356
|
|
- new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the right edge of the box
|
1357
|
|
- lcd.createChar(3, (uint8_t*)&new_char);
|
|
1362
|
+ m = (GRID_MAX_POINTS_X) * pixels_per_x_mesh_pnt + 1; // Column of pixels for the right box line
|
|
1363
|
+ n = m % (HD44780_CHAR_WIDTH); // Column within relevant character cell
|
|
1364
|
+ i = HD44780_CHAR_WIDTH - 1 - n; // Column within relevant character cell (0 on the right)
|
|
1365
|
+ for (j = 0; j < HD44780_CHAR_HEIGHT; j++)
|
|
1366
|
+ new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the box right edge
|
|
1367
|
+ lcd.createChar(CHAR_EDGE_R, (uint8_t*)&new_char);
|
1358
|
1368
|
|
1359
|
1369
|
i = x * pixels_per_x_mesh_pnt - suppress_x_offset;
|
1360
|
1370
|
j = y * pixels_per_y_mesh_pnt - suppress_y_offset;
|
|
@@ -1372,10 +1382,8 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1372
|
1382
|
* and deal with that next.
|
1373
|
1383
|
*/
|
1374
|
1384
|
|
1375
|
|
- //dump_custom_char("at entry:", &new_char);
|
1376
|
|
-
|
1377
|
1385
|
clear_custom_char(&new_char);
|
1378
|
|
- const uint8_t ypix = MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, ULTRA_Y_PIXELS_PER_CHAR);
|
|
1386
|
+ const uint8_t ypix = MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
|
1379
|
1387
|
for (j = upper_left.y_pixel_offset; j < ypix; j++) {
|
1380
|
1388
|
i = upper_left.x_pixel_mask;
|
1381
|
1389
|
for (k = 0; k < pixels_per_x_mesh_pnt; k++) {
|
|
@@ -1383,15 +1391,8 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1383
|
1391
|
i >>= 1;
|
1384
|
1392
|
}
|
1385
|
1393
|
}
|
1386
|
|
- //dump_custom_char("after loops:", &new_char);
|
1387
|
|
-
|
1388
|
|
- add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, TOP_LEFT);
|
1389
|
|
- //dump_custom_char("after add edges", &new_char);
|
1390
|
|
- lcd.createChar(4, (uint8_t*)&new_char);
|
1391
|
1394
|
|
1392
|
|
- lcd_moveto(upper_left.column, upper_left.row);
|
1393
|
|
- lcd_put_wchar(0x04);
|
1394
|
|
- //dump_custom_char("after lcd update:", &new_char);
|
|
1395
|
+ prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_LEFT, CHAR_UL_UL, upper_left.column, upper_left.row);
|
1395
|
1396
|
|
1396
|
1397
|
/**
|
1397
|
1398
|
* Next, check for two side by side character cells being used to display the Mesh Point
|
|
@@ -1401,39 +1402,30 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1401
|
1402
|
l = upper_left.x_pixel_offset;
|
1402
|
1403
|
clear_custom_char(&new_char);
|
1403
|
1404
|
for (j = upper_left.y_pixel_offset; j < ypix; j++) {
|
1404
|
|
- i = _BV(ULTRA_X_PIXELS_PER_CHAR - 1); // Fill in the left side of the right character cell
|
|
1405
|
+ i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell
|
1405
|
1406
|
for (k = 0; k < pixels_per_x_mesh_pnt - 1 - l; k++) {
|
1406
|
1407
|
new_char.custom_char_bits[j] |= i;
|
1407
|
1408
|
i >>= 1;
|
1408
|
1409
|
}
|
1409
|
1410
|
}
|
1410
|
|
- add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, TOP_RIGHT);
|
1411
|
|
-
|
1412
|
|
- lcd.createChar(5, (uint8_t *) &new_char);
|
1413
|
|
-
|
1414
|
|
- lcd_moveto(lower_right.column, upper_left.row);
|
1415
|
|
- lcd_put_wchar(0x05);
|
|
1411
|
+ prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, TOP_RIGHT, CHAR_LR_UL, lower_right.column, upper_left.row);
|
1416
|
1412
|
}
|
1417
|
1413
|
|
1418
|
1414
|
/**
|
1419
|
1415
|
* Next, check for two character cells stacked on top of each other being used to display the Mesh Point
|
1420
|
1416
|
*/
|
1421
|
1417
|
if (upper_left.row == lower_right.row - 1) {
|
1422
|
|
- l = ULTRA_Y_PIXELS_PER_CHAR - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
|
1423
|
|
- k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
|
|
1418
|
+ l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
|
|
1419
|
+ k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
|
1424
|
1420
|
clear_custom_char(&new_char);
|
1425
|
1421
|
for (j = 0; j < k; j++) {
|
1426
|
1422
|
i = upper_left.x_pixel_mask;
|
1427
|
|
- for (m = 0; m < pixels_per_x_mesh_pnt; m++) { // Fill in the top side of the bottom character cell
|
|
1423
|
+ for (m = 0; m < pixels_per_x_mesh_pnt; m++) { // Fill in the top side of the bottom character cell
|
1428
|
1424
|
new_char.custom_char_bits[j] |= i;
|
1429
|
1425
|
if (!(i >>= 1)) break;
|
1430
|
1426
|
}
|
1431
|
1427
|
}
|
1432
|
|
- add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, LOWER_LEFT);
|
1433
|
|
- lcd.createChar(6, (uint8_t *) &new_char);
|
1434
|
|
-
|
1435
|
|
- lcd_moveto(upper_left.column, lower_right.row);
|
1436
|
|
- lcd_put_wchar(0x06);
|
|
1428
|
+ prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_LEFT, CHAR_UL_LR, upper_left.column, lower_right.row);
|
1437
|
1429
|
}
|
1438
|
1430
|
|
1439
|
1431
|
/**
|
|
@@ -1443,22 +1435,18 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1443
|
1435
|
*/
|
1444
|
1436
|
|
1445
|
1437
|
if (upper_left.column == lower_right.column - 1 && upper_left.row == lower_right.row - 1) {
|
1446
|
|
- l = ULTRA_Y_PIXELS_PER_CHAR - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
|
1447
|
|
- k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
|
|
1438
|
+ l = HD44780_CHAR_HEIGHT - upper_left.y_pixel_offset; // Number of pixel rows in top character cell
|
|
1439
|
+ k = pixels_per_y_mesh_pnt - l; // Number of pixel rows in bottom character cell
|
1448
|
1440
|
clear_custom_char(&new_char);
|
1449
|
1441
|
for (j = 0; j < k; j++) {
|
1450
|
1442
|
l = upper_left.x_pixel_offset;
|
1451
|
|
- i = _BV(ULTRA_X_PIXELS_PER_CHAR - 1); // Fill in the left side of the right character cell
|
1452
|
|
- for (m = 0; m < pixels_per_x_mesh_pnt - 1 - l; m++) { // Fill in the top side of the bottom character cell
|
|
1443
|
+ i = _BV(HD44780_CHAR_WIDTH - 1); // Fill in the left side of the right character cell
|
|
1444
|
+ for (m = 0; m < pixels_per_x_mesh_pnt - 1 - l; m++) { // Fill in the top side of the bottom character cell
|
1453
|
1445
|
new_char.custom_char_bits[j] |= i;
|
1454
|
1446
|
i >>= 1;
|
1455
|
1447
|
}
|
1456
|
1448
|
}
|
1457
|
|
- add_edges_to_custom_char(&new_char, &upper_left, &lower_right, &bottom_right_corner, LOWER_RIGHT);
|
1458
|
|
- lcd.createChar(7, (uint8_t*)&new_char);
|
1459
|
|
-
|
1460
|
|
- lcd_moveto(lower_right.column, lower_right.row);
|
1461
|
|
- lcd_put_wchar(0x07);
|
|
1449
|
+ prep_and_put_map_char(new_char, upper_left, lower_right, bottom_right_corner, LOWER_RIGHT, CHAR_LR_LR, lower_right.column, lower_right.row);
|
1462
|
1450
|
}
|
1463
|
1451
|
|
1464
|
1452
|
#endif
|
|
@@ -1506,38 +1494,39 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1506
|
1494
|
#endif // LCD_HEIGHT > 3
|
1507
|
1495
|
}
|
1508
|
1496
|
|
1509
|
|
- void add_edges_to_custom_char(custom_char * const custom, coordinate * const ul, coordinate * const lr, coordinate * const brc, uint8_t cell_location) {
|
|
1497
|
+ void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location) {
|
1510
|
1498
|
uint8_t i, k;
|
1511
|
|
- int16_t n_rows = lr->row - ul->row + 1,
|
1512
|
|
- n_cols = lr->column - ul->column + 1;
|
|
1499
|
+ int16_t n_rows = lr.row - ul.row + 1,
|
|
1500
|
+ n_cols = lr.column - ul.column + 1;
|
1513
|
1501
|
|
1514
|
1502
|
/**
|
1515
|
1503
|
* Check if Top line of box needs to be filled in
|
1516
|
1504
|
*/
|
1517
|
|
- if (ul->row == 0 && ((cell_location & TOP_LEFT) || (cell_location & TOP_RIGHT))) { // Only fill in the top line for the top character cells
|
|
1505
|
+
|
|
1506
|
+ if (ul.row == 0 && (cell_location & (TOP_LEFT|TOP_RIGHT))) { // Only fill in the top line for the top character cells
|
1518
|
1507
|
|
1519
|
1508
|
if (n_cols == 1) {
|
1520
|
|
- if (ul->column != brc->column)
|
1521
|
|
- custom->custom_char_bits[0] = 0xFF; // Single column in middle
|
|
1509
|
+ if (ul.column != brc.column)
|
|
1510
|
+ custom.custom_char_bits[0] = 0xFF; // Single column in middle
|
1522
|
1511
|
else
|
1523
|
|
- for (i = brc->x_pixel_offset; i < ULTRA_X_PIXELS_PER_CHAR; i++) // Single column on right side
|
1524
|
|
- SBI(custom->custom_char_bits[0], i);
|
|
1512
|
+ for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++) // Single column on right side
|
|
1513
|
+ SBI(custom.custom_char_bits[0], i);
|
1525
|
1514
|
}
|
1526
|
|
- else if ((cell_location & TOP_LEFT) || lr->column != brc->column) // Multiple column in the middle or with right cell in middle
|
1527
|
|
- custom->custom_char_bits[0] = 0xFF;
|
|
1515
|
+ else if ((cell_location & TOP_LEFT) || lr.column != brc.column) // Multiple column in the middle or with right cell in middle
|
|
1516
|
+ custom.custom_char_bits[0] = 0xFF;
|
1528
|
1517
|
else
|
1529
|
|
- for (i = brc->x_pixel_offset; i < ULTRA_X_PIXELS_PER_CHAR; i++)
|
1530
|
|
- SBI(custom->custom_char_bits[0], i);
|
|
1518
|
+ for (i = brc.x_pixel_offset; i < HD44780_CHAR_WIDTH; i++)
|
|
1519
|
+ SBI(custom.custom_char_bits[0], i);
|
1531
|
1520
|
}
|
1532
|
1521
|
|
1533
|
1522
|
/**
|
1534
|
1523
|
* Check if left line of box needs to be filled in
|
1535
|
1524
|
*/
|
1536
|
|
- if ((cell_location & TOP_LEFT) || (cell_location & LOWER_LEFT)) {
|
1537
|
|
- if (ul->column == 0) { // Left column of characters on LCD Display
|
1538
|
|
- k = ul->row == brc->row ? brc->y_pixel_offset : ULTRA_Y_PIXELS_PER_CHAR; // If it isn't the last row... do the full character cell
|
|
1525
|
+ if (cell_location & (TOP_LEFT|LOWER_LEFT)) {
|
|
1526
|
+ if (ul.column == 0) { // Left column of characters on LCD Display
|
|
1527
|
+ k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT; // If it isn't the last row... do the full character cell
|
1539
|
1528
|
for (i = 0; i < k; i++)
|
1540
|
|
- SBI(custom->custom_char_bits[i], ULTRA_X_PIXELS_PER_CHAR - 1);
|
|
1529
|
+ SBI(custom.custom_char_bits[i], HD44780_CHAR_WIDTH - 1);
|
1541
|
1530
|
}
|
1542
|
1531
|
}
|
1543
|
1532
|
|
|
@@ -1546,30 +1535,30 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1546
|
1535
|
*/
|
1547
|
1536
|
|
1548
|
1537
|
// Single row of mesh plot cells
|
1549
|
|
- if (n_rows == 1 /* && (cell_location == TOP_LEFT || cell_location == TOP_RIGHT) */ && ul->row == brc->row) {
|
|
1538
|
+ if (n_rows == 1 /* && (cell_location & (TOP_LEFT|TOP_RIGHT)) */ && ul.row == brc.row) {
|
1550
|
1539
|
if (n_cols == 1) // Single row, single column case
|
1551
|
|
- k = ul->column == brc->column ? brc->x_pixel_mask : 0x01;
|
|
1540
|
+ k = ul.column == brc.column ? brc.x_pixel_mask : 0x01;
|
1552
|
1541
|
else if (cell_location & TOP_RIGHT) // Single row, multiple column case
|
1553
|
|
- k = lr->column == brc->column ? brc->x_pixel_mask : 0x01;
|
|
1542
|
+ k = lr.column == brc.column ? brc.x_pixel_mask : 0x01;
|
1554
|
1543
|
else // Single row, left of multiple columns
|
1555
|
1544
|
k = 0x01;
|
1556
|
|
- while (k < _BV(ULTRA_X_PIXELS_PER_CHAR)) {
|
1557
|
|
- custom->custom_char_bits[brc->y_pixel_offset] |= k;
|
|
1545
|
+ while (k < _BV(HD44780_CHAR_WIDTH)) {
|
|
1546
|
+ custom.custom_char_bits[brc.y_pixel_offset] |= k;
|
1558
|
1547
|
k <<= 1;
|
1559
|
1548
|
}
|
1560
|
1549
|
}
|
1561
|
1550
|
|
1562
|
1551
|
// Double row of characters on LCD Display
|
1563
|
1552
|
// And this is a bottom custom character
|
1564
|
|
- if (n_rows == 2 && (cell_location == LOWER_LEFT || cell_location == LOWER_RIGHT) && lr->row == brc->row) {
|
1565
|
|
- if (n_cols == 1) // Double row, single column case
|
1566
|
|
- k = ul->column == brc->column ? brc->x_pixel_mask : 0x01;
|
1567
|
|
- else if (cell_location & LOWER_RIGHT) // Double row, multiple column case
|
1568
|
|
- k = lr->column == brc->column ? brc->x_pixel_mask : 0x01;
|
1569
|
|
- else // Double row, left of multiple columns
|
|
1553
|
+ if (n_rows == 2 && (cell_location & (LOWER_LEFT|LOWER_RIGHT)) && lr.row == brc.row) {
|
|
1554
|
+ if (n_cols == 1) // Double row, single column case
|
|
1555
|
+ k = ul.column == brc.column ? brc.x_pixel_mask : 0x01;
|
|
1556
|
+ else if (cell_location & LOWER_RIGHT) // Double row, multiple column case
|
|
1557
|
+ k = lr.column == brc.column ? brc.x_pixel_mask : 0x01;
|
|
1558
|
+ else // Double row, left of multiple columns
|
1570
|
1559
|
k = 0x01;
|
1571
|
|
- while (k < _BV(ULTRA_X_PIXELS_PER_CHAR)) {
|
1572
|
|
- custom->custom_char_bits[brc->y_pixel_offset] |= k;
|
|
1560
|
+ while (k < _BV(HD44780_CHAR_WIDTH)) {
|
|
1561
|
+ custom.custom_char_bits[brc.y_pixel_offset] |= k;
|
1573
|
1562
|
k <<= 1;
|
1574
|
1563
|
}
|
1575
|
1564
|
}
|
|
@@ -1577,13 +1566,14 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
|
1577
|
1566
|
/**
|
1578
|
1567
|
* Check if right line of box needs to be filled in
|
1579
|
1568
|
*/
|
|
1569
|
+
|
1580
|
1570
|
// Nothing to do if the lower right part of the mesh pnt isn't in the same column as the box line
|
1581
|
|
- if (lr->column == brc->column) {
|
|
1571
|
+ if (lr.column == brc.column) {
|
1582
|
1572
|
// This mesh point is in the same character cell as the right box line
|
1583
|
|
- if (ul->column == brc->column || (cell_location & TOP_RIGHT) || (cell_location & LOWER_RIGHT)) {
|
|
1573
|
+ if (ul.column == brc.column || (cell_location & (TOP_RIGHT|LOWER_RIGHT))) {
|
1584
|
1574
|
// If not the last row... do the full character cell
|
1585
|
|
- k = ul->row == brc->row ? brc->y_pixel_offset : ULTRA_Y_PIXELS_PER_CHAR;
|
1586
|
|
- for (i = 0; i < k; i++) custom->custom_char_bits[i] |= brc->x_pixel_mask;
|
|
1575
|
+ k = ul.row == brc.row ? brc.y_pixel_offset : HD44780_CHAR_HEIGHT;
|
|
1576
|
+ for (i = 0; i < k; i++) custom.custom_char_bits[i] |= brc.x_pixel_mask;
|
1587
|
1577
|
}
|
1588
|
1578
|
}
|
1589
|
1579
|
}
|