|
77 | 77 | #define vol_offset_y 150 // Volume vertical offset |
78 | 78 | #define rds_offset_x 165 // RDS horizontal offset |
79 | 79 | #define rds_offset_y 94 // RDS vertical offset |
80 | | -#define batt_offset_x 286 // Battery meter x offset |
| 80 | +#define batt_offset_x 288 // Battery meter x offset |
81 | 81 | #define batt_offset_y 0 // Battery meter y offset |
82 | 82 | #define clock_datum 90 // Clock x offset |
83 | 83 |
|
@@ -2327,52 +2327,59 @@ void batteryMonitor() { |
2327 | 2327 | uint16_t batteryLevelColor; |
2328 | 2328 |
|
2329 | 2329 | if (batt_soc_state == 0 ) { |
2330 | | - chargeLevel=7; |
| 2330 | + chargeLevel=6; |
2331 | 2331 | batteryLevelColor=theme[themeIdx].batt_low; |
2332 | 2332 | } |
2333 | 2333 | if (batt_soc_state == 1 ) { |
2334 | | - chargeLevel=14; |
| 2334 | + chargeLevel=12; |
2335 | 2335 | batteryLevelColor=theme[themeIdx].batt_full; |
2336 | 2336 | } |
2337 | 2337 | if (batt_soc_state == 2 ) { |
2338 | | - chargeLevel=21; |
| 2338 | + chargeLevel=18; |
2339 | 2339 | batteryLevelColor=theme[themeIdx].batt_full; |
2340 | 2340 | } |
2341 | 2341 | if (batt_soc_state == 3 ) { |
2342 | | - chargeLevel=28; |
| 2342 | + chargeLevel=24; |
2343 | 2343 | batteryLevelColor=theme[themeIdx].batt_full; |
2344 | 2344 | } |
2345 | 2345 |
|
2346 | 2346 | // Set display information |
2347 | | - spr.fillRect(batt_offset_x, batt_offset_y + 1, 30, 14, theme[themeIdx].batt_border); |
2348 | | - spr.fillRect(batt_offset_x + 30, batt_offset_y + 3, 3, 10, theme[themeIdx].batt_border); |
| 2347 | + spr.drawRoundRect(batt_offset_x, batt_offset_y + 1, 28, 14, 3, theme[themeIdx].batt_border); |
| 2348 | + spr.drawLine(batt_offset_x + 29, batt_offset_y + 5, batt_offset_x + 29, batt_offset_y + 10, theme[themeIdx].batt_border); |
| 2349 | + spr.drawLine(batt_offset_x + 30, batt_offset_y + 6, batt_offset_x + 30, batt_offset_y + 9, theme[themeIdx].batt_border); |
2349 | 2350 |
|
2350 | 2351 | spr.setTextDatum(TR_DATUM); |
2351 | 2352 | spr.setTextColor(theme[themeIdx].batt_voltage, theme[themeIdx].bg); |
2352 | 2353 |
|
2353 | 2354 | #if THEME_EDITOR |
2354 | | - spr.fillRect(batt_offset_x - 32, batt_offset_y + 1, 30, 14, theme[themeIdx].batt_border); |
2355 | | - spr.fillRect(batt_offset_x - 32 + 30, batt_offset_y + 3, 3, 10, theme[themeIdx].batt_border); |
| 2355 | + spr.drawRoundRect(batt_offset_x - 31, batt_offset_y + 1, 28, 14, 3, theme[themeIdx].batt_border); |
| 2356 | + spr.drawLine(batt_offset_x - 31 + 29, batt_offset_y + 5, batt_offset_x - 31 + 29, batt_offset_y + 10, theme[themeIdx].batt_border); |
| 2357 | + spr.drawLine(batt_offset_x - 31 + 30, batt_offset_y + 6, batt_offset_x - 31 + 30, batt_offset_y + 9, theme[themeIdx].batt_border); |
2356 | 2358 |
|
2357 | | - spr.fillRect(batt_offset_x -32 + 1, batt_offset_y + 2, 28, 12, theme[themeIdx].bg); |
2358 | | - spr.fillRect(batt_offset_x -32 + 1, batt_offset_y + 2, 21, 12, theme[themeIdx].batt_full); |
2359 | | - spr.fillRect(batt_offset_x -32 + 1, batt_offset_y + 2, 14, 12, theme[themeIdx].batt_low); |
2360 | | - spr.drawString("4.0V", batt_offset_x -32 - 3, batt_offset_y, 2); |
| 2359 | + spr.fillRoundRect(batt_offset_x - 31 + 2, batt_offset_y + 3, 18, 10, 2, theme[themeIdx].batt_full); |
| 2360 | + spr.fillRoundRect(batt_offset_x - 31 + 2, batt_offset_y + 3, 12, 10, 2, theme[themeIdx].batt_low); |
| 2361 | + spr.drawString("4.0V", batt_offset_x - 31 - 3, batt_offset_y, 2); |
2361 | 2362 |
|
2362 | 2363 | adc_volt_avr = 4.5; |
2363 | 2364 | #endif |
2364 | 2365 | // The hardware has a load sharing circuit to allow simultaneous charge and power |
2365 | 2366 | // With USB(5V) connected the voltage reading will be approx. VBUS - Diode Drop = 4.65V |
2366 | 2367 | // If the average voltage is greater than 4.3V, show ligtning on the display |
2367 | 2368 | if (adc_volt_avr > 4.3) { |
2368 | | - spr.fillRect(batt_offset_x + 1, batt_offset_y + 2, 28, 12, theme[themeIdx].batt_charge); |
2369 | | - spr.fillTriangle(batt_offset_x + 6, batt_offset_y + 7, batt_offset_x + 16, batt_offset_y + 7, batt_offset_x + 16, batt_offset_y + 4, theme[themeIdx].batt_icon); |
2370 | | - spr.fillTriangle(batt_offset_x + 23, batt_offset_y + 8, batt_offset_x + 13, batt_offset_y + 8, batt_offset_x + 13, batt_offset_y + 11, theme[themeIdx].batt_icon); |
2371 | | - } |
2372 | | - else { |
| 2369 | + spr.fillRoundRect(batt_offset_x + 2, batt_offset_y + 3, 24, 10, 2, theme[themeIdx].batt_charge); |
| 2370 | + spr.drawLine(batt_offset_x + 9 + 8, batt_offset_y + 1, batt_offset_x + 9 + 6, batt_offset_y + 1 + 5, theme[themeIdx].bg); |
| 2371 | + spr.drawLine(batt_offset_x + 9 + 6, batt_offset_y + 1 + 5, batt_offset_x + 9 + 10, batt_offset_y + 1 + 5, theme[themeIdx].bg); |
| 2372 | + spr.drawLine(batt_offset_x + 9 + 11, batt_offset_y + 1 + 6, batt_offset_x + 9 + 4, batt_offset_y + 1 + 13, theme[themeIdx].bg); |
| 2373 | + spr.drawLine(batt_offset_x + 9 + 2, batt_offset_y + 1 + 13, batt_offset_x + 9 + 4, batt_offset_y + 1 + 8, theme[themeIdx].bg); |
| 2374 | + spr.drawLine(batt_offset_x + 9 + 4, batt_offset_y + 1 + 8, batt_offset_x + 9 + 0, batt_offset_y + 1 + 8, theme[themeIdx].bg); |
| 2375 | + spr.drawLine(batt_offset_x + 9 - 1, batt_offset_y + 1 + 7, batt_offset_x + 9 + 6, batt_offset_y + 1 + 0, theme[themeIdx].bg); |
| 2376 | + spr.fillTriangle(batt_offset_x + 9 + 7, batt_offset_y + 1, batt_offset_x + 9 + 4, batt_offset_y + 1 + 6, batt_offset_x + 9, batt_offset_y + 1 + 7, theme[themeIdx].batt_icon); |
| 2377 | + spr.fillTriangle(batt_offset_x + 9 + 5, batt_offset_y + 1 + 6, batt_offset_x + 9 + 10, batt_offset_y + 1 + 6, batt_offset_x + 9 + 3, batt_offset_y + 1 + 13, theme[themeIdx].batt_icon); |
| 2378 | + spr.fillRect(batt_offset_x + 9 + 1, batt_offset_y + 1 + 6, 9, 2, theme[themeIdx].batt_icon); |
| 2379 | + spr.drawPixel(batt_offset_x + 9 + 3, batt_offset_y + 1 + 12, theme[themeIdx].batt_icon); |
| 2380 | + } else { |
2373 | 2381 | char voltage[8]; |
2374 | | - spr.fillRect(batt_offset_x + 1, batt_offset_y + 2, 28, 12, theme[themeIdx].bg); |
2375 | | - spr.fillRect(batt_offset_x + 1, batt_offset_y + 2, chargeLevel, 12, batteryLevelColor); |
| 2382 | + spr.fillRoundRect(batt_offset_x + 2, batt_offset_y + 3, chargeLevel, 10, 2, batteryLevelColor); |
2376 | 2383 | sprintf(voltage, "%.02fV", adc_volt_avr); |
2377 | 2384 | spr.drawString(voltage, batt_offset_x - 3, batt_offset_y, 2); |
2378 | 2385 | } |
|
0 commit comments