Skip to content

Commit

Permalink
Merge pull request #87 from AxxAxx/85-design-a-better-looking-screen-…
Browse files Browse the repository at this point in the history
…for-landscape-mode

85 design a better looking screen for landscape mode
  • Loading branch information
AxxAxx authored Nov 20, 2024
2 parents c74be5c + 9bcef77 commit f430300
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [axxaxx]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: axxaxx
Expand Down
134 changes: 77 additions & 57 deletions AxxSolder_firmware/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,10 @@ void update_display(){
DISPLAY_buffer[2] = 32;
DISPLAY_buffer[3] = 32;
}
LCD_PutStr(14, 35, DISPLAY_buffer, FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(64, 35, DISPLAY_buffer, FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));

if(cartridge_state == DETACHED) {
LCD_PutStr(10, 120, " --- ", FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(60, 115, " --- ", FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else{
memset(&DISPLAY_buffer, '\0', sizeof(DISPLAY_buffer));
Expand All @@ -813,12 +813,12 @@ void update_display(){
DISPLAY_buffer[2] = 32;
DISPLAY_buffer[3] = 32;
}
LCD_PutStr(14, 120, DISPLAY_buffer, FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(64, 115, DISPLAY_buffer, FONT_arial_36X44_NUMBERS, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}

memset(&DISPLAY_buffer, '\0', sizeof(DISPLAY_buffer));
sprintf(DISPLAY_buffer, "%.1f", sensor_values.bus_voltage);
LCD_PutStr(120, 200, DISPLAY_buffer, FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(170, 195, DISPLAY_buffer, FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));

memset(&DISPLAY_buffer, '\0', sizeof(DISPLAY_buffer));
if(convert_temperature(sensor_values.mcu_temperature) < 99.5){
Expand All @@ -827,44 +827,52 @@ void update_display(){
else{
sprintf(DISPLAY_buffer, "%.0f", convert_temperature(sensor_values.mcu_temperature));
}
LCD_PutStr(52, 220, DISPLAY_buffer, FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(102, 215, DISPLAY_buffer, FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));

if(attached_handle == T210){
LCD_PutStr(120, 180, "T210 ", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(170, 175, "T210 ", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else if(attached_handle == T245){
LCD_PutStr(120, 180, "T245 ", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(170, 175, "T245 ", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else if(attached_handle == NT115){
LCD_PutStr(120, 180, "NT115", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(170, 175, "NT115", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}

if(sensor_values.max_power_watt < 100){
sprintf(DISPLAY_buffer, "%.0f W ", sensor_values.max_power_watt);
}
else{
sprintf(DISPLAY_buffer, "%.0f W", sensor_values.max_power_watt);
}
LCD_PutStr(2, 10, DISPLAY_buffer, FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));

if((sensor_values.current_state == SLEEP || sensor_values.current_state == EMERGENCY_SLEEP || sensor_values.current_state == HALTED) && !sleep_state_written_to_LCD){
UG_FillFrame(290,12,310,229, RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 6, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(296, 41, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 76, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(296, 111, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 146, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(296, 181, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
UG_FillFrame(10,32,30,209, RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 41, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(16, 68, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 95, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(16, 122, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 149, "Z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(16, 176, "z", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
sleep_state_written_to_LCD = 1;
standby_state_written_to_LCD = 0;
}
else if((sensor_values.current_state == STANDBY) && !standby_state_written_to_LCD){
UG_FillFrame(290,12,310,229, RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 6, "S", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 35, "T", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 64, "A", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 93, "N", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 122, "D", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 151, "B", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(294, 180, "Y", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
UG_FillFrame(10,32,30,209, RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 41, "S", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 63, "T", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 85, "A", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 107, "N", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 129, "D", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 151, "B", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
LCD_PutStr(14, 173, "Y", FONT_arial_20X23, RGB_to_BRG(C_BLACK), RGB_to_BRG(C_ORANGE));
standby_state_written_to_LCD = 1;
sleep_state_written_to_LCD = 0;
}
else if(sensor_values.current_state == RUN){
UG_FillFrame(290, 229-(sensor_values.requested_power_filtered/PID_MAX_OUTPUT)*217, 310, 229, RGB_to_BRG(C_LIGHT_SKY_BLUE));
UG_FillFrame(290, 12, 310, 229-(sensor_values.requested_power_filtered/PID_MAX_OUTPUT)*217, RGB_to_BRG(C_BLACK));
UG_FillFrame(10, 209-(sensor_values.requested_power_filtered/PID_MAX_OUTPUT)*177, 30, 209, RGB_to_BRG(C_LIGHT_SKY_BLUE));
UG_FillFrame(10, 32, 30, 209-(sensor_values.requested_power_filtered/PID_MAX_OUTPUT)*177, RGB_to_BRG(C_BLACK));
standby_state_written_to_LCD = 0;
sleep_state_written_to_LCD = 0;
}
Expand Down Expand Up @@ -940,71 +948,83 @@ void LCD_draw_main_screen(){
UG_DrawFrame(208, 64, 232, 270, RGB_to_BRG(C_WHITE));
UG_DrawFrame(209, 65, 231, 269, RGB_to_BRG(C_WHITE));

LCD_PutStr(205, 275, "0 W", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(2, 275, "0 W", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else{
UG_FillScreen(RGB_to_BRG(C_BLACK));
LCD_PutStr(165, 10, "AxxSolder", FONT_arial_20X23, RGB_to_BRG(C_YELLOW), RGB_to_BRG(C_BLACK));

LCD_PutStr(14, 10, "Set temp", FONT_arial_20X23, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
UG_DrawCircle(123, 41, 5, RGB_to_BRG(C_WHITE));
UG_DrawCircle(123, 41, 4, RGB_to_BRG(C_WHITE));
UG_DrawCircle(123, 41, 3, RGB_to_BRG(C_WHITE));
LCD_PutStr(64, 10, "Set temp", FONT_arial_20X23, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
UG_DrawCircle(173, 41, 5, RGB_to_BRG(C_WHITE));
UG_DrawCircle(173, 41, 4, RGB_to_BRG(C_WHITE));
UG_DrawCircle(173, 41, 3, RGB_to_BRG(C_WHITE));
if(flash_values.deg_celsius == 1){
LCD_PutStr(130, 35, "C", FONT_arial_36X44_C, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(180, 35, "C", FONT_arial_36X44_C, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else{
LCD_PutStr(130, 35, "F", FONT_arial_36X44_F, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(180, 35, "F", FONT_arial_36X44_F, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
LCD_PutStr(14, 95, "Actual temp", FONT_arial_20X23, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
UG_DrawCircle(123, 126, 5, RGB_to_BRG(C_WHITE));
UG_DrawCircle(123, 126, 4, RGB_to_BRG(C_WHITE));
UG_DrawCircle(123, 126, 3, RGB_to_BRG(C_WHITE));
LCD_PutStr(64, 90, "Actual temp", FONT_arial_20X23, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
UG_DrawCircle(173, 121, 5, RGB_to_BRG(C_WHITE));
UG_DrawCircle(173, 121, 4, RGB_to_BRG(C_WHITE));
UG_DrawCircle(173, 121, 3, RGB_to_BRG(C_WHITE));
if(flash_values.deg_celsius == 1){
LCD_PutStr(130, 120, "C", FONT_arial_36X44_C, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(180, 115, "C", FONT_arial_36X44_C, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else{
LCD_PutStr(130, 120, "F", FONT_arial_36X44_F, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(180, 115, "F", FONT_arial_36X44_F, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}

UG_DrawFrame(6, 89, 182,175, RGB_to_BRG(C_WHITE));
UG_DrawFrame(5, 88, 183, 176, RGB_to_BRG(C_WHITE));
UG_DrawFrame(56, 84, 232,170, RGB_to_BRG(C_WHITE));
UG_DrawFrame(56, 83, 233, 171, RGB_to_BRG(C_WHITE));

LCD_PutStr(6, 180, "Handle type:", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(6, 200, "Input voltage: V", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(56, 175, "Handle type:", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(56, 195, "Input voltage: V", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
if(flash_values.deg_celsius == 1){
LCD_PutStr(6, 220, "MCU: °C", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(56, 215, "MCU: °C", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
else{
LCD_PutStr(6, 220, "MCU: °F", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(56, 215, "MCU: °F", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
}
LCD_PutStr(110, 220, "SRC:", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(160, 215, "SRC:", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
switch(power_source){
case POWER_DC:
LCD_PutStr(160, 220, "DC", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(210, 215, "DC", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
break;
case POWER_USB:
LCD_PutStr(160, 220, "USB", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(210, 215, "USB", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
break;
case POWER_BAT:
LCD_PutStr(160, 220, "BAT", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
LCD_PutStr(210, 215, "BAT", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));
break;
}

/*
UG_DrawLine(20, 0, 20, 220, RGB_to_BRG(C_DARK_SEA_GREEN));
UG_DrawLine(21, 0, 21, 220, RGB_to_BRG(C_DARK_SEA_GREEN));

LCD_PutStr(6, 271, "PRESETS", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
UG_DrawLine(265, 0, 265, 240, RGB_to_BRG(C_DARK_SEA_GREEN));
UG_DrawLine(266, 0, 266, 240, RGB_to_BRG(C_DARK_SEA_GREEN));
UG_DrawLine(315, 0, 315, 240, RGB_to_BRG(C_DARK_SEA_GREEN));
UG_DrawLine(316, 0, 316, 240, RGB_to_BRG(C_DARK_SEA_GREEN));

LCD_PutStr(285, 75, "P", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 97, "R", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 119, "E", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 141, "S", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 163, "E", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 185, "T", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(285, 207, "S", FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
memset(&DISPLAY_buffer, '\0', sizeof(DISPLAY_buffer));
sprintf(DISPLAY_buffer, "%.0f", flash_values.preset_temp_1);
LCD_PutStr(130, 301, DISPLAY_buffer, FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
LCD_PutStr(272, 40, DISPLAY_buffer, FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
memset(&DISPLAY_buffer, '\0', sizeof(DISPLAY_buffer));
sprintf(DISPLAY_buffer, "%.0f", flash_values.preset_temp_2);
LCD_PutStr(190, 271, DISPLAY_buffer, FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));
*/
LCD_PutStr(272, 10, DISPLAY_buffer, FONT_arial_20X23, RGB_to_BRG(C_DARK_SEA_GREEN), RGB_to_BRG(C_BLACK));


UG_DrawFrame(8, 30, 32, 212, RGB_to_BRG(C_WHITE));
UG_DrawFrame(9, 31, 31, 211, RGB_to_BRG(C_WHITE));

LCD_PutStr(5, 215, "0 W", FONT_arial_17X18, RGB_to_BRG(C_WHITE), RGB_to_BRG(C_BLACK));

UG_DrawFrame(288, 10, 312, 232, RGB_to_BRG(C_WHITE));
UG_DrawFrame(289, 11, 311, 231, RGB_to_BRG(C_WHITE));
}
}

Expand Down
4 changes: 2 additions & 2 deletions AxxSolder_firmware/Drivers/UGUI/ugui.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,11 @@ void UG_PutString( UG_S16 x, UG_S16 y, char* str )
}
cw = _UG_GetCharData(chr,NULL);
if(cw==-1) continue;
if ( xp + cw > gui->device->x_dim - 1 )
/*if ( xp + cw > gui->device->x_dim - 1 )
{
xp = x;
yp += gui->currentFont.char_height+gui->char_v_space;
}
}*/

_UG_PutChar(chr, xp, yp, gui->fore_color, gui->back_color);

Expand Down
Loading

0 comments on commit f430300

Please sign in to comment.