Compare commits
4 Commits
d4d9f44605
...
0fa53919e0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fa53919e0 | ||
|
|
88c00aacbd | ||
|
|
38d8a6eaa1 | ||
|
|
fda9a1add3 |
@ -123,6 +123,13 @@ void LCD_DrawHollowRoundRect(
|
||||
uint16_t fill_color,
|
||||
uint8_t do_fill);
|
||||
|
||||
// Build icons with https://notisrac.github.io/FileToCArray/
|
||||
void LCD_Draw_Icon(const uint8_t *icon, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t fg_color, uint16_t bg_color);
|
||||
|
||||
// Three colors icon, 8bits/pixel RRRGGGBB, RRR > 0x800 => FG, GGG > 0x800 => ALT, BB > 0x80 => BG
|
||||
// Build icons with https://notisrac.github.io/FileToCArray/
|
||||
void LCD_Draw_Icon_3(const uint8_t *icon, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t fg_color, uint16_t alt_color, uint16_t bg_color);
|
||||
|
||||
#endif
|
||||
|
||||
/*******************PARTIE ISSUE DE LA LIB ILI9193_GFX.h***************************/
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -643,3 +643,90 @@ void LCD_DrawHollowRoundRect(
|
||||
}
|
||||
}
|
||||
|
||||
// Build icons with https://notisrac.github.io/FileToCArray/
|
||||
void LCD_Draw_Icon(
|
||||
const uint8_t *icon,
|
||||
uint16_t x,
|
||||
uint16_t y,
|
||||
uint16_t w,
|
||||
uint16_t h,
|
||||
uint16_t fg_color,
|
||||
uint16_t bg_color) {
|
||||
|
||||
LCD_Set_Address(x, y, x + w - 1, y + h - 1);
|
||||
|
||||
uint16_t pendingPixelCount = 0;
|
||||
uint8_t pendingPixelBit = 0;
|
||||
uint16_t i = 0;
|
||||
for (int line = 0; line < h; line++) {
|
||||
for (int col = 0; col < w; col++) {
|
||||
|
||||
uint16_t byteIndex = i / 8;
|
||||
uint8_t bitIndex = i % 8;
|
||||
uint8_t pixelBit = (icon[byteIndex] & (0x80 >> bitIndex)) ? 1 : 0;
|
||||
|
||||
if (pixelBit == pendingPixelBit) {
|
||||
pendingPixelCount++;
|
||||
} else {
|
||||
if (pendingPixelCount != 0) {
|
||||
LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color,
|
||||
pendingPixelCount);
|
||||
pendingPixelCount = 1;
|
||||
}
|
||||
pendingPixelBit = pixelBit;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (pendingPixelCount != 0) {
|
||||
LCD_Draw_Colour_Burst(pendingPixelBit ? fg_color : bg_color,
|
||||
pendingPixelCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Three colors icon, 8bits/pixel RRRGGGBB, RRR >= 0b100 => FG, GGG >= 0b100 => ALT, BB >= 0b10 => BG
|
||||
// Build icons with https://notisrac.github.io/FileToCArray/
|
||||
void LCD_Draw_Icon_3(
|
||||
const uint8_t *icon,
|
||||
uint16_t x,
|
||||
uint16_t y,
|
||||
uint16_t w,
|
||||
uint16_t h,
|
||||
uint16_t fg_color,
|
||||
uint16_t alt_color,
|
||||
uint16_t bg_color) {
|
||||
LCD_Set_Address(x, y, x + w - 1, y + h - 1);
|
||||
|
||||
uint16_t pendingPixelCount = 0;
|
||||
uint16_t pendingPixelColor = 0;
|
||||
uint16_t i = 0;
|
||||
for (int line = 0; line < h; line++) {
|
||||
for (int col = 0; col < w; col++) {
|
||||
|
||||
uint8_t pixelByte = icon[i];
|
||||
uint8_t rrr = (pixelByte & 0b11100000) >> 5;
|
||||
uint8_t ggg = (pixelByte & 0b00011100) >> 2;
|
||||
//uint8_t bb = (pixelByte & 0b00000011);
|
||||
|
||||
uint16_t color =
|
||||
rrr >= 0b100 ? fg_color : (ggg >= 0b100 ? alt_color : bg_color);
|
||||
|
||||
LCD_Draw_Colour_Burst(color, 1);
|
||||
// if (color == pendingPixelColor) {
|
||||
// pendingPixelCount++;
|
||||
// } else {
|
||||
// if (pendingPixelCount != 0) {
|
||||
// LCD_Draw_Colour_Burst(color, pendingPixelCount);
|
||||
// pendingPixelCount = 1;
|
||||
// }
|
||||
// pendingPixelColor = color;
|
||||
// }
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (pendingPixelCount != 0) {
|
||||
LCD_Draw_Colour_Burst(pendingPixelColor, pendingPixelCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "dashboard.h"
|
||||
#include "font.h"
|
||||
#include "monomaniacone12pt.h"
|
||||
#include "icons.h"
|
||||
//#include "monomaniacone12pt.h"
|
||||
#include "monomaniacone14pt.h"
|
||||
#include "monomaniacone20pt.h"
|
||||
#include "monomaniacone72pt.h"
|
||||
@ -12,11 +13,18 @@ void run_dashboard_loop() {
|
||||
uint32_t i = 0;
|
||||
while (1) {
|
||||
|
||||
draw_battery(654, i * 100, 1321, 343);
|
||||
draw_speed(i * 1000);
|
||||
draw_battery(654, i * 100 / 4, 1321, 343);
|
||||
draw_speed(i * 1000 / 4);
|
||||
int16_t duty = 1000 - (int16_t) i * 1000 / 200;
|
||||
draw_power_bars(duty);
|
||||
draw_power(100 * i / 20 * (duty < 0 ? -1 : 1), duty, 60 * 10);
|
||||
|
||||
HAL_Delay(100);
|
||||
if (i == 100) {
|
||||
draw_adc((i % 34) * 100000, ((400 - i + 16) % 34) * 100000);
|
||||
|
||||
draw_temps((4 * i) % 900, ((10 * i) + 450) % 900);
|
||||
|
||||
HAL_Delay(50);
|
||||
if (i == 400) {
|
||||
i = 0;
|
||||
} else {
|
||||
i++;
|
||||
@ -51,10 +59,28 @@ void LCD_DrawHollowRoundRect(
|
||||
uint16_t fill_color,
|
||||
uint8_t do_fill);
|
||||
|
||||
#define LEFT_CENTER_COL1 38
|
||||
#define LEFT_CENTER_COL2 116
|
||||
#define RIGHT_CENTER 400
|
||||
|
||||
void draw_init() {
|
||||
LCD_Fill_Screen(COLOR_OFF, 1);
|
||||
LCD_Fill_Screen(COLOR_BG, 0);
|
||||
|
||||
// Draw footpad sensors rect
|
||||
uint16_t sensor_width = 126;
|
||||
LCD_DrawHollowRoundRect(RIGHT_CENTER - sensor_width / 2, 70, sensor_width, 73,
|
||||
15, 0, 6, COLOR_PRIMARY, 0, 0);
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER - 3, 76, 6, 61, COLOR_PRIMARY);
|
||||
|
||||
// Draw temp icons
|
||||
LCD_Draw_Icon_3(motort_icon, LEFT_CENTER_COL1 - MOTORT_ICON_WIDTH / 2, 73,
|
||||
MOTORT_ICON_WIDTH, MOTORT_ICON_HEIGHT, COLOR_SECONDARY, COLOR_ERROR,
|
||||
COLOR_BG);
|
||||
LCD_Draw_Icon_3(chipt_icon, LEFT_CENTER_COL2 - CHIPT_ICON_WIDTH / 2, 73,
|
||||
CHIPT_ICON_WIDTH, CHIPT_ICON_HEIGHT, COLOR_PRIMARY, COLOR_ERROR,
|
||||
COLOR_BG);
|
||||
|
||||
// GFX_DrawChar(40, 40, '!', &monomaniacone20pt, COLOR_PRIMARY, COLOR_BG);
|
||||
// GFX_DrawChar(60, 40, '2', &monomaniacone20pt, COLOR_PRIMARY, COLOR_BG);
|
||||
// GFX_DrawChar(80, 40, '3', &monomaniacone20pt, COLOR_SECONDARY, COLOR_BG);
|
||||
@ -87,20 +113,31 @@ void draw_init() {
|
||||
// battery percent (level) from COMM_GET_VALUES_SETUP, scale 100
|
||||
// trip distance from COMM_GET_VALUES_SETUP, scale 100
|
||||
// life distance (odometer) from COMM_GET_VALUES_SETUP
|
||||
int16_t last_voltage = 0;
|
||||
int32_t last_percent = 0;
|
||||
int32_t last_trip_dist = 0;
|
||||
void draw_battery(
|
||||
int16_t voltage,
|
||||
int32_t percent,
|
||||
int32_t trip_dist,
|
||||
uint32_t life_dist) {
|
||||
|
||||
if (voltage == last_voltage && percent / 100 == last_percent / 100
|
||||
&& trip_dist / 10 == last_trip_dist / 10) {
|
||||
return;
|
||||
}
|
||||
last_voltage = voltage;
|
||||
last_percent = percent;
|
||||
last_trip_dist = trip_dist;
|
||||
|
||||
uint16_t bar_width = LCD_WIDTH - 12;
|
||||
uint16_t bar_height = 22;
|
||||
uint16_t filled_bar_width = (((float) (percent / 100)) / 100.0) * bar_width;
|
||||
if(filled_bar_width < 6) {
|
||||
filled_bar_width = 6; // Must be at least the size of the border radius.
|
||||
if (filled_bar_width < 6) {
|
||||
filled_bar_width = 6;// Must be at least the size of the border radius.
|
||||
}
|
||||
uint16_t filled_bar_end_x = 4 + 2 + filled_bar_width;
|
||||
uint16_t text_y_12 = LCD_HEIGHT - 6 - (22 - 16) / 2;
|
||||
//uint16_t text_y_12 = LCD_HEIGHT - 6 - (22 - 16) / 2;
|
||||
uint16_t text_y_14 = LCD_HEIGHT - 6 - (22 - 18) / 2;
|
||||
|
||||
char voltage_text[8];
|
||||
@ -125,12 +162,12 @@ void draw_battery(
|
||||
|
||||
if (percent > 20 * 100) {
|
||||
// Drawing the voltage to the left
|
||||
left_x = 12
|
||||
left_x = 10
|
||||
+ GFX_DrawText(left_x, text_y_14, voltage_text, &monomaniacone14pt,
|
||||
COLOR_BG, COLOR_SUCCESS, 0, -2);
|
||||
} else {
|
||||
// Drawing the voltage to the right
|
||||
right_x = -12
|
||||
right_x = -10
|
||||
+ GFX_DrawText(right_x, text_y_14, voltage_text, &monomaniacone14pt,
|
||||
COLOR_FG, COLOR_BG, 2, -2);
|
||||
}
|
||||
@ -138,11 +175,11 @@ void draw_battery(
|
||||
if (percent > 50 * 100) {
|
||||
// Drawing the distances on the left
|
||||
GFX_DrawText(left_x, text_y_14, distances_text, &monomaniacone14pt,
|
||||
COLOR_BG, COLOR_SUCCESS, 0, -4);
|
||||
COLOR_BG, COLOR_SUCCESS, 0, -3);
|
||||
} else {
|
||||
// Drawing the distances on the right
|
||||
GFX_DrawText(right_x, text_y_14, distances_text, &monomaniacone14pt,
|
||||
COLOR_FG, COLOR_BG, 2, -4);
|
||||
COLOR_FG, COLOR_BG, 2, -3);
|
||||
}
|
||||
|
||||
if (percent > 80 * 100) {
|
||||
@ -161,42 +198,253 @@ void draw_battery(
|
||||
|
||||
// Displays the power bars at the top
|
||||
// Duty from COMM_GET_VALUES, scale 1000
|
||||
void draw_power_bars(int16_t duty) {
|
||||
uint16_t offset = LCD_WIDTH/2;
|
||||
uint16_t max_width = LCD_WIDTH/2;
|
||||
uint16_t last_width = 0;
|
||||
uint8_t last_regen = 0;
|
||||
void draw_power_bars(int16_t dutyy) {
|
||||
uint16_t offset = LCD_WIDTH / 2;
|
||||
uint16_t max_width = LCD_WIDTH / 2;
|
||||
uint8_t regen = dutyy < 0;
|
||||
uint16_t duty = regen ? -dutyy : dutyy;
|
||||
duty *= 1 / 0.8;// 80% duty means the bar is at 100%
|
||||
uint16_t width = ((float) duty / 1000.0) * max_width;
|
||||
|
||||
uint16_t width = (duty/100) * max_width / 10;
|
||||
uint16_t last_origin = last_regen ? offset - last_width : offset;
|
||||
uint16_t origin = regen ? offset - width : offset;
|
||||
uint16_t color = regen ? COLOR_ERROR : COLOR_SUCCESS;
|
||||
|
||||
if (regen != last_regen) {
|
||||
LCD_Draw_Rectangle(last_origin, 0, last_width, 20, COLOR_BG);
|
||||
LCD_Draw_Rectangle(origin, 0, width, 20, color);
|
||||
last_regen = regen;
|
||||
last_width = width;
|
||||
|
||||
} else if (width != last_width) {
|
||||
if (regen) {
|
||||
if (last_origin < origin) {
|
||||
LCD_Draw_Rectangle(last_origin, 0, origin - last_origin, 20, COLOR_BG);
|
||||
} else {
|
||||
LCD_Draw_Rectangle(origin, 0, last_origin - origin, 20, color);
|
||||
}
|
||||
} else {
|
||||
if (last_width < width) {
|
||||
LCD_Draw_Rectangle(origin + last_width, 0, width - last_width, 20,
|
||||
color);
|
||||
} else {
|
||||
LCD_Draw_Rectangle(origin + width, 0, last_width - width, 20, COLOR_BG);
|
||||
}
|
||||
}
|
||||
|
||||
last_width = width;
|
||||
}
|
||||
}
|
||||
|
||||
// Displays the huge speed counter with avg and max values.
|
||||
// Speed from COMM_GET_VALUES_SETUP, scale 1000
|
||||
void draw_speed(int32_t speed) {
|
||||
uint16_t erase_width = 90; // width to erase from center
|
||||
uint32_t last_speed = 30;
|
||||
uint32_t max_speed = 0;
|
||||
uint32_t last_avg_speed = 30;
|
||||
uint32_t avg_speed_tot = 0;// You need to ride super fast for a super long time for it to overflow ;)
|
||||
uint32_t avg_speed_count = 0;
|
||||
void draw_speed(int32_t speedd) {
|
||||
|
||||
char speed_text[6];
|
||||
sprintf(speed_text, "%lu", abs(speed / 1000));
|
||||
uint32_t speed = speedd < 0 ? -speedd / 1000 : speedd / 1000;
|
||||
if (speed >= 100) {
|
||||
speed = 99;
|
||||
}
|
||||
|
||||
LCD_Draw_Rectangle(LCD_WIDTH/2 - erase_width, 22, 2*erase_width, 110, COLOR_BG);
|
||||
GFX_DrawText(LCD_WIDTH / 2, 32 + 95, speed_text, &monomaniacone72pt, COLOR_FG,
|
||||
COLOR_BG, 1, -5);
|
||||
// update max speed
|
||||
uint8_t update_stats = 0;
|
||||
if (speed > max_speed) {
|
||||
max_speed = speed;
|
||||
update_stats = 1;
|
||||
}
|
||||
// update avg speed
|
||||
avg_speed_tot += speed;
|
||||
avg_speed_count += 1;
|
||||
uint32_t avg_speed = avg_speed_tot / avg_speed_count;
|
||||
if (last_avg_speed != avg_speed) {
|
||||
last_avg_speed = avg_speed;
|
||||
update_stats = 1;
|
||||
}
|
||||
|
||||
// Draw
|
||||
if (last_speed != speed) {
|
||||
last_speed = speed;
|
||||
uint16_t erase_width = 85;// width to erase from center
|
||||
char speed_text[4];
|
||||
sprintf(speed_text, "%lu", speed);
|
||||
LCD_Draw_Rectangle(LCD_WIDTH / 2 - erase_width, 22, 2 * erase_width, 110,
|
||||
COLOR_BG);
|
||||
GFX_DrawText(LCD_WIDTH / 2, 32 + 95, speed_text, &monomaniacone72pt,
|
||||
COLOR_FG, COLOR_BG, 1, -5);
|
||||
}
|
||||
|
||||
if (update_stats) {
|
||||
char stats_text[20];
|
||||
uint16_t erase_width = 90;// width to erase from center
|
||||
sprintf(stats_text, "avg: %lu max: %lu", avg_speed, max_speed);
|
||||
LCD_Draw_Rectangle(LCD_WIDTH / 2 - erase_width, 140, 2 * erase_width, 25,
|
||||
COLOR_BG);
|
||||
GFX_DrawText(LCD_WIDTH / 2, 159, stats_text, &monomaniacone14pt,
|
||||
COLOR_SECONDARY, COLOR_BG, 1, -3);
|
||||
}
|
||||
}
|
||||
|
||||
int16_t last_current = 99;
|
||||
uint16_t last_duty = 99;
|
||||
int32_t last_power = 1000;
|
||||
// Displays Current, Duty, Watts
|
||||
// Current from COMM_GET_VALUES, scale 100
|
||||
// Duty from COMM_GET_VALUES, scale 1000
|
||||
// Input voltage from COMM_GET_VALUES, scale 10
|
||||
void draw_power(int32_t amps, int16_t duty, int16_t voltage) {
|
||||
void draw_power(int32_t current_i, int16_t duty_i, int16_t voltage_i) {
|
||||
|
||||
int16_t current = current_i / 100;
|
||||
uint16_t duty = duty_i < 0 ? -duty_i / 10 : duty_i / 10;
|
||||
int32_t power = ((int32_t) voltage_i) * ((int32_t) current_i) / 10000 * 10;
|
||||
if (power >= 1000) {
|
||||
power = power / 100 * 100;
|
||||
} else if (power <= -1000) {
|
||||
power = power / 100 * 100;
|
||||
}
|
||||
|
||||
if (current != last_current) {
|
||||
last_current = current;
|
||||
if (current >= 100) {
|
||||
current = 99;
|
||||
} else if (current <= -100) {
|
||||
current = -99;
|
||||
}
|
||||
|
||||
char text[8];
|
||||
sprintf(text, "%dA", current);
|
||||
LCD_Draw_Rectangle(LEFT_CENTER_COL1 - 38, 30, 2 * 39, 35, COLOR_BG);
|
||||
GFX_DrawText(LEFT_CENTER_COL1, 60, text, &monomaniacone20pt,
|
||||
COLOR_PRIMARY, COLOR_BG, 1, -2);
|
||||
}
|
||||
if (duty != last_duty) {
|
||||
last_duty = duty;
|
||||
if (duty >= 100) {
|
||||
duty = 99;
|
||||
}
|
||||
|
||||
char text[8];
|
||||
sprintf(text, "%u%%", duty);
|
||||
LCD_Draw_Rectangle(LEFT_CENTER_COL2 - 39, 30, 2 * 39, 35, COLOR_BG);
|
||||
GFX_DrawText(LEFT_CENTER_COL2, 60, text, &monomaniacone20pt,
|
||||
COLOR_PRIMARY, COLOR_BG, 1, -2);
|
||||
}
|
||||
if (power != last_power) {
|
||||
last_power = power;
|
||||
if (power >= 10000) {
|
||||
power = 9999;
|
||||
} else if (power <= -10000) {
|
||||
power = -9999;
|
||||
}
|
||||
|
||||
char text[10];
|
||||
sprintf(text, "%ldW", power);
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER - 70, 30, 2 * 70, 35, COLOR_BG);
|
||||
GFX_DrawText(RIGHT_CENTER, 60, text, &monomaniacone20pt,
|
||||
COLOR_PRIMARY, COLOR_BG, 1, -2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint16_t last_adc1 = 1000;
|
||||
uint16_t last_adc2 = 1000;
|
||||
uint16_t adc_threshold = 29;
|
||||
// Displays the two ADS voltages
|
||||
// 2 voltages from COMM_GET_DECODED_ADC, scale 1 000 000
|
||||
void draw_adc(int32_t adc1, int32_t adc2) {
|
||||
void draw_adc(int32_t adc1_scaled, int32_t adc2_scaled) {
|
||||
uint16_t adc1 =
|
||||
adc1_scaled < 0 ? -adc1_scaled / 100000 : adc1_scaled / 100000;
|
||||
uint16_t adc2 =
|
||||
adc2_scaled < 0 ? -adc2_scaled / 100000 : adc2_scaled / 100000;
|
||||
if (adc1 > 33) {
|
||||
adc1 = 33;
|
||||
}
|
||||
if (adc2 > 33) {
|
||||
adc2 = 33;
|
||||
}
|
||||
// Max filled height = 39
|
||||
if (adc1 != last_adc1) {
|
||||
uint16_t filled_height = adc1 * 39 / 33;
|
||||
uint16_t free_height = 61 - filled_height;
|
||||
|
||||
// Reset the top part
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER - 3 - 54 + 2, 76 + 2, 54 - 4, 2, COLOR_BG);
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER - 3 - 54 + 0, 76 + 4, 54, free_height - 4,
|
||||
COLOR_BG);
|
||||
|
||||
// Draw the colored zone
|
||||
uint16_t color = adc1 >= adc_threshold ? COLOR_SUCCESS : COLOR_ERROR;
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER - 3 - 54, 76 + free_height, 54,
|
||||
filled_height, color);
|
||||
|
||||
// Draw the text
|
||||
char text[8];
|
||||
sprintf(text, "%.1fV", ((float) adc1) / 10);
|
||||
GFX_DrawText(RIGHT_CENTER - 3 - 27, 76 + free_height - 2, text,
|
||||
&monomaniacone14pt, color, COLOR_BG, 1, -2);
|
||||
|
||||
last_adc1 = adc1;
|
||||
}
|
||||
// Max filled height = 39
|
||||
if (adc2 != last_adc2) {
|
||||
uint16_t filled_height = adc2 * 39 / 33;
|
||||
uint16_t free_height = 61 - filled_height;
|
||||
|
||||
// Reset the top part
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER + 3 + 2, 76 + 2, 54 - 4, 2, COLOR_BG);
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER + 3 + 0, 76 + 4, 54, free_height - 4,
|
||||
COLOR_BG);
|
||||
|
||||
// Draw the colored zone
|
||||
uint16_t color = adc2 >= adc_threshold ? COLOR_SUCCESS : COLOR_ERROR;
|
||||
LCD_Draw_Rectangle(RIGHT_CENTER + 3, 76 + free_height, 54, filled_height,
|
||||
color);
|
||||
|
||||
// Draw the text
|
||||
char text[8];
|
||||
sprintf(text, "%.1fV", ((float) adc2) / 10);
|
||||
GFX_DrawText(RIGHT_CENTER + 3 + 27, 76 + free_height - 2, text,
|
||||
&monomaniacone14pt, color, COLOR_BG, 1, -2);
|
||||
|
||||
last_adc2 = adc2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint16_t last_temp_fet = 1000;
|
||||
uint16_t last_temp_mot = 1000;
|
||||
// Displays the controller and motor temperatures
|
||||
// 2 temperatures from COMM_GET_VALUES_SETUP, scale 10
|
||||
void draw_temps(int16_t temp_fet, int16_t temp_motor) {
|
||||
void draw_temps(int16_t temp_fet_scaled, int16_t temp_motor_scaled) {
|
||||
uint16_t temp_fet = temp_fet_scaled < 0 ? 0 : temp_fet_scaled / 10;
|
||||
uint16_t temp_mot = temp_motor_scaled < 0 ? 0 : temp_motor_scaled / 10;
|
||||
if(temp_fet > 99) {
|
||||
temp_fet = 99;
|
||||
}
|
||||
if(temp_mot > 99) {
|
||||
temp_mot = 99;
|
||||
}
|
||||
|
||||
|
||||
if (temp_mot != last_temp_mot) {
|
||||
last_temp_mot = temp_mot;
|
||||
|
||||
char text[8];
|
||||
sprintf(text, "%u>C", temp_mot);
|
||||
LCD_Draw_Rectangle(LEFT_CENTER_COL1 - 38, 138, 2 * 39, 25, COLOR_BG);
|
||||
GFX_DrawText(LEFT_CENTER_COL1, 159, text, &monomaniacone14pt, COLOR_SECONDARY, COLOR_BG, 1, -1);
|
||||
}
|
||||
if (temp_fet != last_temp_fet) {
|
||||
last_temp_fet = temp_fet;
|
||||
|
||||
char text[8];
|
||||
sprintf(text, "%u>C", temp_fet);
|
||||
LCD_Draw_Rectangle(LEFT_CENTER_COL2 - 39, 138, 2 * 39, 25, COLOR_BG);
|
||||
GFX_DrawText(LEFT_CENTER_COL2, 159, text, &monomaniacone14pt, COLOR_PRIMARY, COLOR_BG, 1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ void GFX_DrawChar(
|
||||
for (uint8_t col = 0; col < glyph->width; col++) {
|
||||
uint16_t byteIndex = glyph->bitmapOffset + (bitPos / 8);
|
||||
uint8_t bitIndex = bitPos % 8;
|
||||
uint8_t pixelBit = font->bitmaps[byteIndex] & (0x80 >> bitIndex);
|
||||
uint8_t pixelBit = (font->bitmaps[byteIndex] & (0x80 >> bitIndex)) ? 1 : 0;
|
||||
|
||||
if (pixelBit == pendingPixelBit) {
|
||||
pendingPixelCount++;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user