1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

🚸 Improve CocoaPress Touch UI (#25446)

This commit is contained in:
Marcio T 2023-03-01 21:07:23 -07:00 committed by Scott Lahteine
parent a9a6d1f716
commit cba3b2c527
19 changed files with 695 additions and 207 deletions

View File

@ -58,8 +58,8 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.enabled(ENABLED(HAS_TRINAMIC_CONFIG))
.tag(3) .button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT))
.enabled(ENABLED(LIN_ADVANCE))
.tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE))
.tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED))
.tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE))
.tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED_NO_UNITS))
.tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION))
.tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK)))
.tag(8) .button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS))

View File

@ -1,4 +1,3 @@
/****************************************************************************
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -28,33 +27,26 @@ constexpr float x_max = 480.000000;
constexpr float y_min = 0.000000;
constexpr float y_max = 272.000000;
const PROGMEM uint16_t syringe_outline[] = {0xED96, 0x14F0, 0xE65D, 0x10E9, 0xDED2, 0x0F9C, 0xD74B, 0x110E, 0xD01B, 0x1543, 0xCE80, 0x1836, 0xCE0A, 0x1C3A, 0xCE0F, 0x27AD, 0xCF0A, 0x2BD3, 0xD127, 0x2E5B, 0xD2A1, 0x2FF0, 0xD2A2, 0x9FC9, 0xD407, 0xA97A, 0xD7B9, 0xB10C, 0xD7BF, 0xBB58, 0xD978, 0xC2BE, 0xDD55, 0xC6EB, 0xDD58, 0xD159, 0xDE3B, 0xD3A8, 0xDFCF, 0xD3AF, 0xE0B8, 0xD04C, 0xE0B8, 0xC6EB, 0xE4A7, 0xC299, 0xE652, 0xBAF6, 0xE652, 0xB10C, 0xEA2E, 0xA8EA, 0xEB6C, 0x9E86, 0xEB6C, 0x2F58, 0xEF3C, 0x2B4E, 0xF003, 0x2583, 0xEFFD, 0x1AC2, 0xED96, 0x14F0, 0xED96, 0x14F0};
const PROGMEM uint16_t syringe_fluid[] = {0xDE73, 0x2512, 0xDA0C, 0x261D, 0xD5B8, 0x29A0, 0xD4AE, 0x2D87, 0xD4AE, 0x9F60, 0xD585, 0xA63B, 0xDE44, 0xA9DE, 0xE32A, 0xA942, 0xE7E3, 0xA6A5, 0xE930, 0xA342, 0xE95D, 0x9C1D, 0xE95B, 0x31B8, 0xE955, 0x2B63, 0xE867, 0x2A67, 0xE790, 0x28DE, 0xE342, 0x25CB, 0xDE73, 0x2512};
const PROGMEM uint16_t syringe[] = {0xED91, 0x1502, 0xE658, 0x10FB, 0xDECE, 0x0FAE, 0xD746, 0x1120, 0xD016, 0x1555, 0xCE7B, 0x1848, 0xCE05, 0x1C4D, 0xCE0A, 0x27BF, 0xCF05, 0x2BE5, 0xD122, 0x2E6E, 0xD29C, 0x3002, 0xD29D, 0x9FDB, 0xD402, 0xA98C, 0xD7B4, 0xB11F, 0xD7BA, 0xBB6A, 0xD973, 0xC2D1, 0xDD50, 0xC6FD, 0xDD53, 0xD16C, 0xDE36, 0xD3BA, 0xDFCA, 0xD3C2, 0xE0B3, 0xD05E, 0xE0B3, 0xC6FD, 0xE4A2, 0xC2AB, 0xE64D, 0xBB09, 0xE64D, 0xB11F, 0xEA29, 0xA8FC, 0xEB67, 0x9E98, 0xEB67, 0x2F6B, 0xEF37, 0x2B60, 0xEFFE, 0x2595, 0xEFF8, 0x1AD5, 0xED91, 0x1502, 0xED91, 0x1502, 0xFFFF, 0xD1CF, 0x1A7E, 0xD84F, 0x16DB, 0xDF19, 0x15A9, 0xE5E0, 0x16EA, 0xEC5B, 0x1AA4, 0xEC9D, 0x1D34, 0xEC9D, 0x20CC, 0xE5F1, 0x1D41, 0xDF02, 0x1C12, 0xD812, 0x1D41, 0xD166, 0x20CC, 0xD16C, 0x1B45, 0xD1CF, 0x1A7E, 0xFFFF, 0xE3BD, 0xACFD, 0xDE8E, 0xAF4F, 0xD988, 0xAC0F, 0xD7CC, 0xA8CD, 0xDD1C, 0xAAA9, 0xE287, 0xAA5B, 0xE655, 0xA8BE, 0xE3BD, 0xACFD, 0xFFFF, 0xE802, 0x2DC5, 0xE809, 0x343C, 0xE808, 0x9FC8, 0xE7E3, 0xA296, 0xE70D, 0xA4B1, 0xE2C9, 0xA70E, 0xDE4E, 0xA790, 0xD6A1, 0xA457, 0xD5FF, 0x9F2B, 0xD5FF, 0x2DFD, 0xD6B2, 0x2B72, 0xDA78, 0x2861, 0xDE9D, 0x276F, 0xE300, 0x2824, 0xE70D, 0x2B13, 0xE7FF, 0x2DB6, 0xE800, 0x2DC5, 0xE802, 0x2DC5, 0xFFFF, 0xE2ED, 0xBA8B, 0xE1CC, 0xBF52, 0xDF1C, 0xC165, 0xDC64, 0xBF99, 0xDB1B, 0xBAFF, 0xDB19, 0xB433, 0xDF04, 0xB552, 0xE2EF, 0xB438, 0xE2ED, 0xBA8B, 0xFFFF, 0xEC09, 0x2893, 0xE925, 0x2A08, 0xE57D, 0x261D, 0xE149, 0x246F, 0xDBDE, 0x24A0, 0xD6BC, 0x2795, 0xD484, 0x2A46, 0xD1C0, 0x2853, 0xD166, 0x251E, 0xD80D, 0x2151, 0xDF02, 0x200C, 0xE5F6, 0x2151, 0xEC9D, 0x251E, 0xEC09, 0x2893};
const PROGMEM uint16_t park_btn[] = {0x0AAA, 0x0E1E, 0x57FF, 0x0E1E, 0x57FF, 0x33C3, 0x0AAA, 0x33C3, 0x0AAA, 0x0E1E};
const PROGMEM uint16_t pause_btn[] = {0x47FF, 0xCA58, 0x7FFF, 0xCA58, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCA58};
const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3D2C, 0x57FF, 0x3D2C, 0x57FF, 0x62D2, 0x0AAA, 0x62D2, 0x0AAA, 0x3D2C};
const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x6C3B, 0x57FF, 0x6C3B, 0x57FF, 0x91E0, 0x0AAA, 0x91E0, 0x0AAA, 0x6C3B};
const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x9B4A, 0x57FF, 0x9B4A, 0x57FF, 0xC0EF, 0x0AAA, 0xC0EF, 0x0AAA, 0x9B4A};
const PROGMEM uint16_t print_btn[] = {0x0AAA, 0xCA58, 0x42AA, 0xCA58, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCA58};
const PROGMEM uint16_t stop_btn[] = {0x8554, 0xCA58, 0xBD53, 0xCA58, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCA58};
const PROGMEM uint16_t print_time_hms[] = {0x62A9, 0xA968, 0x8FFE, 0xA968, 0x8FFE, 0xC0EF, 0x62A9, 0xC0EF, 0x62A9, 0xA968};
const PROGMEM uint16_t print_time_percent[] = {0x8FFE, 0xA968, 0xBD53, 0xA968, 0xBD53, 0xC0EF, 0x8FFE, 0xC0EF, 0x8FFE, 0xA968};
const PROGMEM uint16_t print_time_label[] = {0x62A9, 0x91E0, 0xBD53, 0x91E0, 0xBD53, 0xA986, 0x62A9, 0xA986, 0x62A9, 0x91E0};
const PROGMEM uint16_t h3_temp[] = {0x62A9, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x8D2C, 0x62A9, 0x8D2C, 0x62A9, 0x75A4};
const PROGMEM uint16_t h3_label[] = {0x62A9, 0x5E1D, 0x8FFE, 0x5E1D, 0x8FFE, 0x75A4, 0x62A9, 0x75A4, 0x62A9, 0x5E1D};
const PROGMEM uint16_t chocolate_label[] = {0x62A9, 0x12D2, 0xBD53, 0x12D2, 0xBD53, 0x2A5A, 0x62A9, 0x2A5A, 0x62A9, 0x12D2};
const PROGMEM uint16_t h0_label[] = {0x62A9, 0x2A5A, 0x8FFE, 0x2A5A, 0x8FFE, 0x41E1, 0x62A9, 0x41E1, 0x62A9, 0x2A5A};
const PROGMEM uint16_t h0_temp[] = {0x62A9, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x5968, 0x62A9, 0x5968, 0x62A9, 0x41E1};
const PROGMEM uint16_t h1_label[] = {0x8FFE, 0x2A5A, 0xBD53, 0x2A5A, 0xBD53, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x2A5A};
const PROGMEM uint16_t h1_temp[] = {0x8FFE, 0x41E1, 0xBD53, 0x41E1, 0xBD53, 0x5968, 0x8FFE, 0x5968, 0x8FFE, 0x41E1};
const PROGMEM uint16_t h2_label[] = {0x8FFE, 0x5E1D, 0xBD53, 0x5E1D, 0xBD53, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x5E1D};
const PROGMEM uint16_t h2_temp[] = {0x8FFE, 0x75A4, 0xBD53, 0x75A4, 0xBD53, 0x8D2C, 0x8FFE, 0x8D2C, 0x8FFE, 0x75A4};
const PROGMEM uint16_t extrude_btn[] = {0xC859, 0xDD2B, 0xF5AE, 0xDD2B, 0xF5AE, 0xEFFE, 0xC859, 0xEFFE, 0xC859, 0xDD2B};
const PROGMEM uint16_t load_screen_extrude[] = {0x25FB, 0x89AE, 0x2F58, 0x89AE, 0x2F58, 0xAAF6, 0x3406, 0xAAF6, 0x2AAA, 0xBB9A, 0x214D, 0xAAF6, 0x25FB, 0xAAF6, 0x25FB, 0x89AE};
const PROGMEM uint16_t load_screen_retract[] = {0x25FC, 0x790A, 0x2F58, 0x790A, 0x2F58, 0x57C2, 0x3406, 0x57C2, 0x2AAA, 0x471D, 0x214D, 0x57C2, 0x25FC, 0x57C2, 0x25FC, 0x790A};
const PROGMEM uint16_t load_screen_back_btn[] = {0x1555, 0xCA58, 0xC553, 0xCA58, 0xC553, 0xEFFE, 0x1555, 0xEFFE, 0x1555, 0xCA58};
const PROGMEM uint16_t load_screen_unload_btn[] = {0x4AAA, 0x8EBD, 0xC553, 0x8EBD, 0xC553, 0xB463, 0x4AAA, 0xB463, 0x4AAA, 0x8EBD};
const PROGMEM uint16_t load_screen_load_btn[] = {0x4AAA, 0x5322, 0xC553, 0x5322, 0xC553, 0x78C7, 0x4AAA, 0x78C7, 0x4AAA, 0x5322};
const PROGMEM uint16_t load_sreen_title[] = {0x4AAA, 0x1787, 0xC553, 0x1787, 0xC553, 0x3D2C, 0x4AAA, 0x3D2C, 0x4AAA, 0x1787};
const PROGMEM uint16_t load_screen_increment[] = {0x1555, 0x2E1D, 0x3FFF, 0x2E1D, 0x3FFF, 0x3D2C, 0x1555, 0x3D2C, 0x1555, 0x2E1D};
const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x0E1E, 0x6D54, 0x0E1E, 0x6D54, 0x2F0E, 0x0AAA, 0x2F0E, 0x0AAA, 0x0E1E};
const PROGMEM uint16_t print_btn[] = {0x47FF, 0xCF0D, 0x7FFF, 0xCF0D, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCF0D};
const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3878, 0x6D54, 0x3878, 0x6D54, 0x5968, 0x0AAA, 0x5968, 0x0AAA, 0x3878};
const PROGMEM uint16_t extrude_btn[] = {0x0AAA, 0x5E1D, 0x6D54, 0x5E1D, 0x6D54, 0x7F0E, 0x0AAA, 0x7F0E, 0x0AAA, 0x5E1D};
const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x83C2, 0x6D54, 0x83C2, 0x6D54, 0xA4B3, 0x0AAA, 0xA4B3, 0x0AAA, 0x83C2};
const PROGMEM uint16_t media_btn[] = {0x0AAA, 0xCF0D, 0x42AA, 0xCF0D, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCF0D};
const PROGMEM uint16_t pause_btn[] = {0x8554, 0xCF0D, 0xBD53, 0xCF0D, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCF0D};
const PROGMEM uint16_t print_time_hms[] = {0xC59E, 0xAEA0, 0xF510, 0xAEA0, 0xF510, 0xC52D, 0xC59E, 0xC52D, 0xC59E, 0xAEA0};
const PROGMEM uint16_t file_name[] = {0x0B0E, 0xAECD, 0xBCEF, 0xAECD, 0xBCEF, 0xC4AB, 0x0B0E, 0xC4AB, 0x0B0E, 0xAECD};
const PROGMEM uint16_t chocolate_label[] = {0x75C1, 0x1369, 0xF4FE, 0x1369, 0xF4FE, 0x2AB1, 0x75C1, 0x2AB1, 0x75C1, 0x1369};
const PROGMEM uint16_t h0_label[] = {0x8304, 0x4BEB, 0xB271, 0x4BEB, 0xB271, 0x63B0, 0x8304, 0x63B0, 0x8304, 0x4BEB};
const PROGMEM uint16_t h0_temp[] = {0x8304, 0x7190, 0xB271, 0x7190, 0xB271, 0x8955, 0x8304, 0x8955, 0x8304, 0x7190};
const PROGMEM uint16_t h1_label[] = {0xBB04, 0x4BEB, 0xEA71, 0x4BEB, 0xEA71, 0x63B0, 0xBB04, 0x63B0, 0xBB04, 0x4BEB};
const PROGMEM uint16_t h1_temp[] = {0xBB04, 0x7190, 0xEA71, 0x7190, 0xEA71, 0x8956, 0xBB04, 0x8956, 0xBB04, 0x7190};
const PROGMEM uint16_t stop_btn[] = {0xC2A9, 0xCF0D, 0xF553, 0xCF0D, 0xF553, 0xEFFE, 0xC2A9, 0xEFFE, 0xC2A9, 0xCF0D};
const PROGMEM uint16_t load_screen_extrude[] = {0x382C, 0x8B02, 0x4188, 0x8B02, 0x4188, 0xAC4A, 0x4637, 0xAC4A, 0x3CDA, 0xBCEE, 0x337D, 0xAC4A, 0x382C, 0xAC4A, 0x382C, 0x8B02};
const PROGMEM uint16_t load_screen_retract[] = {0x382C, 0x7A5D, 0x4188, 0x7A5D, 0x4188, 0x5915, 0x4637, 0x5915, 0x3CDA, 0x4871, 0x337E, 0x5915, 0x382C, 0x5915, 0x382C, 0x7A5D};
const PROGMEM uint16_t load_screen_back_btn[] = {0x1555, 0xCA58, 0xEAA8, 0xCA58, 0xEAA8, 0xEFFE, 0x1555, 0xEFFE, 0x1555, 0xCA58};
const PROGMEM uint16_t load_screen_unload_btn[] = {0x67FF, 0x70F0, 0xEAA8, 0x70F0, 0xEAA8, 0x9695, 0x67FF, 0x9695, 0x67FF, 0x70F0};
const PROGMEM uint16_t load_screen_start_stop_btn[] = {0x67FF, 0x9B4A, 0xEAA8, 0x9B4A, 0xEAA8, 0xC0EF, 0x67FF, 0xC0EF, 0x67FF, 0x9B4A};
const PROGMEM uint16_t load_screen_load_btn[] = {0x67FF, 0x4696, 0xEAA8, 0x4696, 0xEAA8, 0x6C3B, 0x67FF, 0x6C3B, 0x67FF, 0x4696};
const PROGMEM uint16_t load_screen_continuous[] = {0x67FF, 0x1787, 0xEAA8, 0x1787, 0xEAA8, 0x3D2C, 0x67FF, 0x3D2C, 0x67FF, 0x1787};
const PROGMEM uint16_t load_screen_increment[] = {0x1555, 0x1787, 0x62A9, 0x1787, 0x62A9, 0x3D2C, 0x1555, 0x3D2C, 0x1555, 0x1787};

View File

@ -0,0 +1,55 @@
/**************************************
* confirm_start_print_dialog_box.cpp *
**************************************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <https://www.gnu.org/licenses/>. *
****************************************************************************/
#include "../config.h"
#include "../screens.h"
#ifdef COCOA_CONFIRM_START_PRINT
using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) {
FileList files;
const char *filename = files.filename();
char buffer[strlen_P(GET_TEXT(MSG_START_PRINT_CONFIRMATION)) + strlen(filename) + 1];
sprintf_P(buffer, GET_TEXT(MSG_START_PRINT_CONFIRMATION), filename);
drawMessage((const char *)buffer);
drawYesNoButtons();
}
bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: {
FileList files;
printFile(files.shortFilename());
StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PRINT_STARTING));
GOTO_SCREEN(StatusScreen);
return true;
}
case 2: GOTO_PREVIOUS(); return true;
default: return false;
}
}
#endif // COCOA_CONFIRM_START_PRINT

View File

@ -0,0 +1,32 @@
/************************************
* confirm_start_print_dialog_box.h *
************************************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <https://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
#define COCOA_CONFIRM_START_PRINT
#define COCOA_CONFIRM_START_PRINT_CLASS ConfirmStartPrintDialogBox
class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
public:
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t);
};

View File

@ -0,0 +1,289 @@
/********************
* files_screen.cpp *
********************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <https://www.gnu.org/licenses/>. *
****************************************************************************/
#include "../config.h"
#include "../screens.h"
#include "../screen_data.h"
#ifdef COCOA_FILES_SCREEN
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 6
#define GRID_ROWS 15
#define FILES_PER_PAGE 11
#define PREV_DIR LEFT
#define NEXT_DIR RIGHT
#define PREV_POS BTN_POS(1,1), BTN_SIZE(1,2)
#define HEAD_POS BTN_POS(2,1), BTN_SIZE(4,2)
#define NEXT_POS BTN_POS(6,1), BTN_SIZE(1,2)
#define LIST_POS BTN_POS(1,3), BTN_SIZE(6,FILES_PER_PAGE)
#define BTN1_POS BTN_POS(1,14), BTN_SIZE(3,2)
#define BTN2_POS BTN_POS(4,14), BTN_SIZE(3,2)
#else
#define GRID_COLS 12
#define GRID_ROWS 8
#define FILES_PER_PAGE 6
#define PREV_DIR UP
#define NEXT_DIR DOWN
#define PREV_POS BTN_POS(12,2), BTN_SIZE(1,3)
#define HEAD_POS BTN_POS( 1,1), BTN_SIZE(12,1)
#define NEXT_POS BTN_POS(12,5), BTN_SIZE(1,4)
#define LIST_POS BTN_POS( 1,2), BTN_SIZE(11,FILES_PER_PAGE)
#define BTN1_POS BTN_POS( 1,8), BTN_SIZE(6,1)
#define BTN2_POS BTN_POS( 7,8), BTN_SIZE(5,1)
#endif
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
constexpr static FilesScreenData &mydata = screen_data.FilesScreen;
void FilesScreen::onEntry() {
mydata.cur_page = 0;
mydata.selected_tag = 0xFF;
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP);
#endif
gotoPage(0);
BaseScreen::onEntry();
}
const char *FilesScreen::getSelectedFilename(bool shortName) {
FileList files;
files.seek(getSelectedFileIndex(), true);
return shortName ? files.shortFilename() : files.filename();
}
void FilesScreen::drawSelectedFile() {
if(mydata.selected_tag == 0xFF) return;
FileList files;
files.seek(getSelectedFileIndex(), true);
mydata.flags.is_dir = files.isDir();
drawFileButton(
files.filename(),
mydata.selected_tag,
mydata.flags.is_dir,
true
);
}
uint16_t FilesScreen::getSelectedFileIndex() {
return getFileForTag(mydata.selected_tag);
}
uint16_t FilesScreen::getFileForTag(uint8_t tag) {
return mydata.cur_page * FILES_PER_PAGE + tag - 2;
}
void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filename, uint8_t tag, bool is_dir, bool is_highlighted) {
#define SUB_COLS 6
#define SUB_ROWS FILES_PER_PAGE
const int bx = SUB_X(1);
const int by = SUB_Y(getLineForTag(tag)+1);
const int bw = SUB_W(6);
const int bh = SUB_H(1);
CommandProcessor cmd;
cmd.tag(tag);
cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
cmd.font(font_medium).rectangle(bx, by, bw, bh);
cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) {
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y));
cmd.cmd(SCISSOR_SIZE(w,h));
cmd.cmd(MACRO(0));
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
} else
#endif
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
#if ENABLED(SCROLL_LONG_FILENAMES)
if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
#endif
}
void FilesScreen::drawFileList() {
FileList files;
mydata.num_page = max(1,ceil(float(files.count()) / FILES_PER_PAGE));
mydata.cur_page = min(mydata.cur_page, mydata.num_page-1);
mydata.flags.is_root = files.isAtRootDir();
mydata.flags.is_empty = true;
uint16_t fileIndex = mydata.cur_page * FILES_PER_PAGE;
for (uint8_t i = 0; i < FILES_PER_PAGE; i++, fileIndex++) {
if (files.seek(fileIndex)) {
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
mydata.flags.is_empty = false;
} else
break;
}
}
void FilesScreen::drawHeader() {
char str[16];
sprintf_P(str, PSTR("Page %d of %d"), mydata.cur_page + 1, mydata.num_page);
CommandProcessor cmd;
cmd.colors(normal_btn)
.font(font_small)
.tag(0).button(HEAD_POS, str, OPT_CENTER | OPT_FLAT);
}
void FilesScreen::drawArrows() {
const bool prev_enabled = mydata.cur_page > 0;
const bool next_enabled = mydata.cur_page < (mydata.num_page - 1);
CommandProcessor cmd;
cmd.colors(normal_btn);
cmd.tag(242).enabled(prev_enabled).button(PREV_POS, F("")); if (prev_enabled) drawArrow(PREV_POS, PREV_DIR);
cmd.tag(243).enabled(next_enabled).button(NEXT_POS, F("")); if (next_enabled) drawArrow(NEXT_POS, NEXT_DIR);
}
void FilesScreen::drawFooter() {
const bool has_selection = mydata.selected_tag != 0xFF;
CommandProcessor cmd;
cmd.colors(normal_btn)
.font(font_medium)
.colors(normal_btn)
.enabled(!mydata.flags.is_root)
.tag(245).button(BTN2_POS, F("Up Dir"))
.colors(action_btn);
if (mydata.flags.is_empty)
cmd.tag(240).button(BTN1_POS, GET_TEXT_F(MSG_BUTTON_DONE));
else if (has_selection && mydata.flags.is_dir)
cmd.tag(244).button(BTN1_POS, GET_TEXT_F(MSG_BUTTON_OPEN));
else
cmd.tag(241).enabled(has_selection).button(BTN1_POS, F("Select"));
}
void FilesScreen::drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted) {
#undef MARGIN_L
#undef MARGIN_R
#define MARGIN_L 0
#define MARGIN_R 0
drawFileButton(LIST_POS, filename, tag, is_dir, is_highlighted);
}
void FilesScreen::onRedraw(draw_mode_t what) {
if (what & FOREGROUND) {
drawHeader();
drawArrows();
drawSelectedFile();
drawFooter();
}
}
void FilesScreen::gotoPage(uint8_t page) {
mydata.selected_tag = 0xFF;
mydata.cur_page = page;
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.colors(normal_btn);
drawFileList();
storeBackground();
}
bool FilesScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 240: // Done button, always select first file
{
FileList files;
files.seek(0);
GOTO_PREVIOUS();
}
return true;
case 241: // Select highlighted file
GOTO_PREVIOUS();
return true;
case 242: // Previous page
if (mydata.cur_page > 0) {
gotoPage(mydata.cur_page-1);
}
break;
case 243: // Next page
if (mydata.cur_page < (mydata.num_page-1)) {
gotoPage(mydata.cur_page+1);
}
break;
case 244: // Select directory
{
FileList files;
files.changeDir(getSelectedShortFilename());
gotoPage(0);
}
break;
case 245: // Up directory
{
FileList files;
files.upDir();
gotoPage(0);
}
break;
default: // File selected
if (tag < 240) {
mydata.selected_tag = tag;
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
mydata.scroll_pos = 0;
mydata.scroll_max = 0;
if (FTDI::ftdi_chip >= 810) {
const char *filename = getSelectedFilename();
if (filename[0]) {
CommandProcessor cmd;
constexpr int dim[4] = {LIST_POS};
const uint16_t text_width = cmd.font(font_medium).text_width(filename);
if (text_width > dim[2])
mydata.scroll_max = text_width - dim[2] + MARGIN_L + MARGIN_R + 10;
}
}
#endif
}
break;
}
return true;
}
void FilesScreen::onIdle() {
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
if (FTDI::ftdi_chip >= 810) {
CLCD::mem_write_32(CLCD::REG::MACRO_0,
VERTEX_TRANSLATE_X(-int32_t(mydata.scroll_pos)));
if (mydata.scroll_pos < mydata.scroll_max * 16)
mydata.scroll_pos++;
}
#endif
}
void FilesScreen::onMediaRemoved() {
if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen);
}
#endif // COCOA_FILES_SCREEN

View File

@ -0,0 +1,68 @@
/******************
* files_screen.h *
******************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <https://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
#define COCOA_FILES_SCREEN
#define COCOA_FILES_SCREEN_CLASS FilesScreen
struct FilesScreenData {
struct {
uint8_t is_dir : 1;
uint8_t is_root : 1;
uint8_t is_empty : 1;
} flags;
uint8_t selected_tag;
uint8_t num_page;
uint8_t cur_page;
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
uint16_t scroll_pos;
uint16_t scroll_max;
#endif
};
class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, FILE_SCREEN_DL_SIZE> {
private:
static uint8_t getTagForLine(uint8_t line) {return line + 2;}
static uint8_t getLineForTag(uint8_t tag) {return tag - 2;}
static uint16_t getFileForTag(uint8_t tag);
static uint16_t getSelectedFileIndex();
inline static const char *getSelectedShortFilename() {return getSelectedFilename(true);}
static const char *getSelectedFilename(bool shortName = false);
static void drawFileButton(int x, int y, int w, int h, const char *filename, uint8_t tag, bool is_dir, bool is_highlighted);
static void drawFileButton(const char *filename, uint8_t tag, bool is_dir, bool is_highlighted);
static void drawFileList();
static void drawHeader();
static void drawArrows();
static void drawFooter();
static void drawSelectedFile();
static void gotoPage(uint8_t);
public:
static void onEntry();
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t tag);
static void onIdle();
static void onMediaRemoved();
};

View File

@ -57,7 +57,9 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
cmd.font(font_large)
.cmd(COLOR_RGB(bg_text_enabled))
.text(BED_MESH_TITLE_POS, GET_TEXT_F(MSG_BED_LEVELING))
#if ENABLED(BLTOUCH)
.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
#endif
.font(font_medium).colors(normal_btn)
.tag(2).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED))
.enabled(ENABLED(HAS_MESH))
@ -66,8 +68,10 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
.tag(4).button(EDIT_MESH_POS, GET_TEXT_F(MSG_EDIT_MESH))
#undef GRID_COLS
#define GRID_COLS 2
#if ENABLED(BLTOUCH)
.tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
.tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST))
#endif
#undef GRID_COLS
#define GRID_COLS 3
.colors(action_btn)
@ -81,8 +85,10 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
case 2: BedMeshViewScreen::doProbe(); break;
case 3: BedMeshViewScreen::show(); break;
case 4: BedMeshEditScreen::show(); break;
#if ENABLED(BLTOUCH)
case 5: injectCommands(F("M280 P0 S60")); break;
case 6: SpinnerDialogBox::enqueueAndWait(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
#endif
default: return false;
}
return true;

View File

@ -39,42 +39,6 @@ using namespace Theme;
constexpr static LoadChocolateScreenData &mydata = screen_data.LoadChocolateScreen;
void LoadChocolateScreen::draw_syringe(draw_mode_t what) {
#if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR)
const float fill_level = get_chocolate_fill_level();
#else
constexpr float fill_level = 1.0f;
#endif
CommandProcessor cmd;
PolyUI ui(cmd, what);
if (what & BACKGROUND) {
// Paint the shadow for the syringe
ui.color(shadow_rgb);
ui.shadow(POLY(syringe_outline), shadow_depth);
}
if (what & FOREGROUND) {
int16_t x, y, h, v;
// Paint the syringe icon
ui.color(syringe_rgb);
ui.fill(POLY(syringe_outline));
ui.color(fluid_rgb);
ui.bounds(POLY(syringe_fluid), x, y, h, v);
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level)));
cmd.cmd(SCISSOR_SIZE(h, v * fill_level));
ui.fill(POLY(syringe_fluid), false);
cmd.cmd(RESTORE_CONTEXT());
ui.color(stroke_rgb);
ui.fill(POLY(syringe));
}
}
void LoadChocolateScreen::draw_buttons(draw_mode_t what) {
int16_t x, y, h, v;
@ -84,10 +48,18 @@ void LoadChocolateScreen::draw_buttons(draw_mode_t what) {
cmd.font(font_medium).colors(normal_btn);
ui.bounds(POLY(load_screen_unload_btn), x, y, h, v);
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_FULL_UNLOAD));
cmd.tag(2).colors(mydata.repeat_tag == 5 ? action_btn : normal_btn).button(x, y, h, v, GET_TEXT_F(MSG_UNLOAD));
ui.bounds(POLY(load_screen_load_btn), x, y, h, v);
cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_FULL_LOAD));
cmd.tag(3).colors(mydata.repeat_tag == 6 ? action_btn : normal_btn).button(x, y, h, v, GET_TEXT_F(MSG_LOAD));
ui.bounds(POLY(load_screen_start_stop_btn), x, y, h, v);
if(mydata.repeat_tag == 0) {
cmd.colors(normal_btn).enabled(false);
} else {
cmd.colors(mydata.repeating ? action_btn : normal_btn).enabled(true);
}
cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_START_STOP));
ui.bounds(POLY(load_screen_back_btn), x, y, h, v);
cmd.tag(1).colors(action_btn).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_DONE));
@ -102,8 +74,8 @@ void LoadChocolateScreen::draw_text(draw_mode_t what) {
cmd.font(font_medium).cmd(COLOR_RGB(bg_text_enabled));
ui.bounds(POLY(load_sreen_title), x, y, h, v);
cmd.tag(2).text(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD));
ui.bounds(POLY(load_screen_continuous), x, y, h, v);
cmd.tag(2).text(x, y, h, v, GET_TEXT_F(MSG_CONTINUOUS));
ui.bounds(POLY(load_screen_increment), x, y, h, v);
cmd.tag(3).text(x, y, h, v, GET_TEXT_F(MSG_INCREMENT));
@ -120,11 +92,12 @@ void LoadChocolateScreen::draw_arrows(draw_mode_t what) {
constexpr uint8_t style = PolyUI::REGULAR;
ui.button(4, POLY(load_screen_extrude), style);
ui.button(5, POLY(load_screen_retract), style);
ui.button(5, POLY(load_screen_extrude), style);
ui.button(6, POLY(load_screen_retract), style);
}
void LoadChocolateScreen::onEntry() {
mydata.repeating = false;
mydata.repeat_tag = 0;
}
@ -136,14 +109,15 @@ void LoadChocolateScreen::onRedraw(draw_mode_t what) {
.tag(0);
}
draw_syringe(what);
draw_arrows(what);
draw_buttons(what);
draw_text(what);
}
bool LoadChocolateScreen::onTouchStart(uint8_t) {
mydata.repeat_tag = 0;
bool LoadChocolateScreen::onTouchStart(uint8_t tag) {
if(tag != 4) {
mydata.repeating = false;
}
return true;
}
@ -151,10 +125,13 @@ bool LoadChocolateScreen::onTouchEnd(uint8_t tag) {
using namespace ExtUI;
switch (tag) {
case 2:
mydata.repeat_tag = (mydata.repeat_tag == 2) ? 0 : 2;
mydata.repeat_tag = 5;
break;
case 3:
mydata.repeat_tag = (mydata.repeat_tag == 3) ? 0 : 3;
mydata.repeat_tag = 6;
break;
case 4:
mydata.repeating = !mydata.repeating;
break;
case 1: GOTO_PREVIOUS(); break;
}
@ -176,26 +153,10 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) {
#define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis);
#define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis);
switch (tag) {
case 2: {
if (get_chocolate_fill_level() < 0.1) {
mydata.repeat_tag = 0;
return false;
}
UI_INCREMENT_AXIS(E0);
break;
}
case 3: {
if (get_chocolate_fill_level() > 0.75) {
mydata.repeat_tag = 0;
return false;
}
UI_DECREMENT_AXIS(E0);
break;
}
case 4:
UI_INCREMENT_AXIS(E0);
break;
case 5:
UI_INCREMENT_AXIS(E0);
break;
case 6:
UI_DECREMENT_AXIS(E0);
break;
default: return false;
@ -207,7 +168,7 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) {
void LoadChocolateScreen::onIdle() {
reset_menu_timeout();
if (mydata.repeat_tag) onTouchHeld(mydata.repeat_tag);
if (mydata.repeating) onTouchHeld(mydata.repeat_tag);
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
if (!EventLoop::is_touch_held())
onRefresh();

View File

@ -28,11 +28,11 @@
struct LoadChocolateScreenData {
uint8_t repeat_tag;
bool repeating;
};
class LoadChocolateScreen : public BaseScreen, public CachedScreen<LOAD_CHOCOLATE_SCREEN_CACHE> {
private:
static void draw_syringe(draw_mode_t what);
static void draw_arrows(draw_mode_t what);
static void draw_buttons(draw_mode_t what);
static void draw_text(draw_mode_t what);

View File

@ -32,7 +32,7 @@ using namespace Theme;
#define GRID_ROWS 5
void PreheatMenu::onRedraw(draw_mode_t what) {
const int16_t w = TERN0(COCOA_PRESS_EXTRA_HEATER, has_extra_heater() ? BTN_W(1) : BTN_W(2));
const int16_t w = TERN0(COCOA_PRESS_EXTRA_HEATER, has_extra_heater()) ? BTN_W(1) : BTN_W(2);
const int16_t h = BTN_H(1);
if (what & BACKGROUND) {

View File

@ -90,7 +90,6 @@ enum {
#include "../generic/spinner_dialog_box.h"
#include "../generic/restore_failsafe_dialog_box.h"
#include "../generic/save_settings_dialog_box.h"
#include "../generic/confirm_start_print_dialog_box.h"
#include "../generic/confirm_abort_print_dialog_box.h"
#include "../generic/confirm_user_request_alert_box.h"
#include "../generic/touch_calibration_screen.h"
@ -114,7 +113,6 @@ enum {
#include "../generic/bed_mesh_edit_screen.h"
#include "../generic/case_light_screen.h"
#include "../generic/linear_advance_screen.h"
#include "../generic/files_screen.h"
#include "../generic/move_axis_screen.h"
#include "../generic/flow_percent_screen.h"
#if HAS_JUNCTION_DEVIATION
@ -132,3 +130,5 @@ enum {
#include "leveling_menu.h"
#include "move_xyz_screen.h"
#include "move_e_screen.h"
#include "files_screen.h"
#include "confirm_start_print_dialog_box.h"

View File

@ -29,6 +29,8 @@
#include "cocoa_press_ui.h"
#define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0]))
#define ICON_POS(x,y,w,h) x, y, h, h
#define TEXT_POS(x,y,w,h) x + h, y, w - h, h
const uint8_t shadow_depth = 5;
@ -38,8 +40,28 @@ using namespace ExtUI;
float StatusScreen::increment;
void StatusScreen::_format_time(char *outstr, uint32_t time) {
const uint8_t hrs = time / 3600,
min = (time / 60) % 60,
sec = time % 60;
if (hrs)
sprintf_P(outstr, PSTR("%02d:%02d"), hrs, min);
else
sprintf_P(outstr, PSTR("%02d:%02ds"), min, sec);
}
void StatusScreen::loadBitmaps() {
// Load the bitmaps for the status screen
using namespace Theme;
constexpr uint32_t base = ftdi_memory_map::RAM_G;
CLCD::mem_write_xbm(base + Light_Bulb_Info.RAMG_offset, Light_Bulb, sizeof(Light_Bulb));
CLCD::mem_write_xbm(base + Chamber_Icon_Info.RAMG_offset, Chamber_Icon, sizeof(Chamber_Icon));
CLCD::mem_write_xbm(base + Clock_Icon_Info.RAMG_offset, Clock_Icon, sizeof(Clock_Icon));
CLCD::mem_write_xbm(base + File_Icon_Info.RAMG_offset, File_Icon, sizeof(File_Icon));
CLCD::mem_write_xbm(base + TD_Icon_Info.RAMG_offset, TD_Icon, sizeof(TD_Icon));
CLCD::mem_write_xbm(base + Extruder_Icon_Info.RAMG_offset, Extruder_Icon, sizeof(Extruder_Icon));
CLCD::mem_write_xbm(base + Bed_Heat_Icon_Info.RAMG_offset, Bed_Heat_Icon, sizeof(Bed_Heat_Icon));
CLCD::mem_write_xbm(base + Fan_Icon_Info.RAMG_offset, Fan_Icon, sizeof(Fan_Icon));
// Load fonts for internationalization
#if ENABLED(TOUCH_UI_USE_UTF8)
@ -47,33 +69,50 @@ void StatusScreen::loadBitmaps() {
#endif
}
void StatusScreen::draw_progress(draw_mode_t what) {
void StatusScreen::draw_time(draw_mode_t what) {
CommandProcessor cmd;
PolyUI ui(cmd, what);
int16_t x, y, h, v;
cmd.cmd(COLOR_RGB(accent_color_1));
cmd.font(font_medium);
int16_t x, y, w, h;
ui.bounds(POLY(print_time_hms), x, y, w, h);
if (what & BACKGROUND) {
ui.bounds(POLY(print_time_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_ELAPSED_PRINT));
cmd.cmd(COLOR_RGB(bg_text_enabled))
.cmd (BITMAP_SOURCE(Clock_Icon_Info))
.cmd (BITMAP_LAYOUT(Clock_Icon_Info))
.cmd (BITMAP_SIZE (Clock_Icon_Info))
.icon(ICON_POS(x, y, w, h), Clock_Icon_Info, icon_scale)
.cmd(COLOR_RGB(bg_text_enabled));
}
if (what & FOREGROUND) {
const uint32_t elapsed = getProgress_seconds_elapsed();
const uint8_t hrs = elapsed/3600;
const uint8_t min = (elapsed/60)%60;
char elapsed_str[10];
_format_time(elapsed_str, elapsed);
char str[10];
sprintf_P(str, PSTR(" %02d : %02d"), hrs, min);
ui.bounds(POLY(print_time_hms), x, y, h, v);
cmd.text(x, y, h, v, str);
cmd.font(font_medium)
.cmd(COLOR_RGB(bg_text_enabled))
.text(TEXT_POS(x, y, w, h), elapsed_str);
}
}
sprintf_P(str, PSTR("%-3d%%"), getProgress_percent() );
ui.bounds(POLY(print_time_percent), x, y, h, v);
cmd.text(x, y, h, v, str);
void StatusScreen::draw_progress(draw_mode_t what) {
CommandProcessor cmd;
PolyUI ui(cmd, what);
int16_t x, y, w, h;
cmd.cmd(COLOR_RGB(accent_color_1));
cmd.font(font_medium);
if (what & FOREGROUND) {
// Draw progress bar
ui.bounds(POLY(file_name), x, y, w, h);
const uint16_t bar_width = w * getProgress_percent() / 100;
cmd.tag(8)
.cmd(COLOR_RGB(accent_color_5))
.rectangle(x, y, bar_width, h);
}
}
@ -81,30 +120,38 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
CommandProcessor cmd;
PolyUI ui(cmd, what);
int16_t x, y, h, v;
int16_t x, y, w, h;
if (what & BACKGROUND) {
cmd.cmd(COLOR_RGB(fluid_rgb));
cmd.font(font_medium).tag(10);
ui.bounds(POLY(chocolate_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHOCOLATE));
/*ui.bounds(POLY(temp_lbl), x, y, w, h);
cmd.text(x, y, w, h, F("Temp"));
ui.bounds(POLY(h0_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_NOZZLE));
ui.bounds(POLY(set_lbl), x, y, w, h);
cmd.text(x, y, w, h, F("Set"));*/
ui.bounds(POLY(h1_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_BODY));
ui.bounds(POLY(chocolate_label), x, y, w, h);
cmd.text(x, y, w, h, F("Cocoa Press"));
ui.bounds(POLY(h0_label), x, y, w, h);
cmd.text(x, y, w, h, GET_TEXT_F(MSG_NOZZLE));
ui.bounds(POLY(h1_label), x, y, w, h);
cmd.text(x, y, w, h, GET_TEXT_F(MSG_BODY));
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater()) {
ui.bounds(POLY(h2_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_EXTERNAL));
ui.bounds(POLY(h2_label), x, y, w, h);
cmd.text(x, y, w, h, GET_TEXT_F(MSG_EXTERNAL));
}
#endif
ui.bounds(POLY(h3_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER));
#if ENABLED(COCOA_PRESS_CHAMBER_COOLER)
ui.bounds(POLY(h3_label), x, y, w, h);
cmd.text(x, y, w, h, GET_TEXT_F(MSG_CHAMBER));
#endif
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd); // Restore font bitmap handles
@ -117,68 +164,60 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
cmd.font(font_large).tag(10);
// Show the actual temperatures
format_temp(str, getActualTemp_celsius(E0));
ui.bounds(POLY(h0_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
ui.bounds(POLY(h0_temp), x, y, w, h);
cmd.text(x, y, w, h, str);
format_temp(str, getActualTemp_celsius(E1));
ui.bounds(POLY(h1_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
ui.bounds(POLY(h1_temp), x, y, w, h);
cmd.text(x, y, w, h, str);
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater()) {
format_temp(str, getActualTemp_celsius(E2));
ui.bounds(POLY(h2_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
ui.bounds(POLY(h2_temp), x, y, w, h);
cmd.text(x, y, w, h, str);
}
#endif
format_temp(str, getActualTemp_celsius(CHAMBER));
ui.bounds(POLY(h3_temp), x, y, h, v);
cmd.text(x, y, h, v, str);
}
}
#if ENABLED(COCOA_PRESS_CHAMBER_COOLER)
format_temp(str, getActualTemp_celsius(CHAMBER));
ui.bounds(POLY(h3_temp), x, y, w, h);
cmd.text(x, y, w, h, str);
#endif
void StatusScreen::draw_syringe(draw_mode_t what) {
#if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR)
const float fill_level = get_chocolate_fill_level();
#else
constexpr float fill_level = 1.0f;
#endif
/*// Show the set temperatures
format_temp(str, getTargetTemp_celsius(E0));
ui.bounds(POLY(h0_set), x, y, w, h);
cmd.text(x, y, w, h, str);
CommandProcessor cmd;
PolyUI ui(cmd, what);
format_temp(str, getTargetTemp_celsius(E1));
ui.bounds(POLY(h1_set), x, y, w, h);
cmd.text(x, y, w, h, str);
if (what & BACKGROUND) {
// Paint the shadow for the syringe
ui.color(shadow_rgb);
ui.shadow(POLY(syringe_outline), shadow_depth);
}
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater()) {
format_temp(str, getTargetTemp_celsius(E2));
ui.bounds(POLY(h2_set), x, y, w, h);
cmd.text(x, y, w, h, str);
}
#endif
if (what & FOREGROUND) {
int16_t x, y, h, v;
// Paint the syringe icon
ui.color(syringe_rgb);
ui.fill(POLY(syringe_outline));
ui.color(fluid_rgb);
ui.bounds(POLY(syringe_fluid), x, y, h, v);
cmd.cmd(SAVE_CONTEXT());
cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level)));
cmd.cmd(SCISSOR_SIZE(h, v * fill_level));
ui.fill(POLY(syringe_fluid), false);
cmd.cmd(RESTORE_CONTEXT());
ui.color(stroke_rgb);
ui.fill(POLY(syringe));
#if ENABLED(COCOA_PRESS_CHAMBER_COOLER)
format_temp(str, getTargetTemp_celsius(CHAMBER));
ui.bounds(POLY(h3_set), x, y, w, h);
cmd.text(x, y, w, h, str);
#endif*/
}
}
void StatusScreen::draw_buttons(draw_mode_t what) {
int16_t x, y, h, v;
int16_t x, y, w, h;
const bool can_print = isMediaInserted() && !isPrintingFromMedia();
const bool can_print = !isPrinting() && isMediaInserted() && isFileSelected();
const bool can_select = !isPrinting() && isMediaInserted();
const bool sdOrHostPrinting = ExtUI::isPrinting();
const bool sdOrHostPaused = ExtUI::isPrintingPaused();
@ -187,29 +226,68 @@ void StatusScreen::draw_buttons(draw_mode_t what) {
cmd.font(font_medium).colors(normal_btn);
ui.bounds(POLY(park_btn), x, y, h, v);
cmd.tag(1).button(x, y, h, v, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED));
ui.bounds(POLY(load_chocolate_btn), x, y, w, h);
cmd.tag(1).button(x, y, w, h, GET_TEXT_F(MSG_LOAD_UNLOAD));
ui.bounds(POLY(load_chocolate_btn), x, y, h, v);
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD));
ui.bounds(POLY(extrude_btn), x, y, w, h);
cmd.tag(2).button(x, y, w, h, GET_TEXT_F(MSG_EXTRUDE));
ui.bounds(POLY(preheat_chocolate_btn), x, y, h, v);
cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE));
ui.bounds(POLY(preheat_chocolate_btn), x, y, w, h);
cmd.tag(3).button(x, y, w, h, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE));
ui.bounds(POLY(menu_btn), x, y, h, v);
cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_MENU));
ui.bounds(POLY(menu_btn), x, y, w, h);
cmd.tag(4).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_MENU));
ui.bounds(POLY(pause_btn), x, y, h, v);
cmd.tag(sdOrHostPaused ? 6 : 5).enabled(sdOrHostPrinting).button(x, y, h, v, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE));
ui.bounds(POLY(media_btn), x, y, w, h);
cmd.tag(5).enabled(can_select).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_MEDIA));
ui.bounds(POLY(stop_btn), x, y, h, v);
cmd.tag(7).enabled(sdOrHostPrinting).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_STOP));
ui.bounds(POLY(print_btn), x, y, w, h);
cmd.tag(6).colors(action_btn).enabled(can_print).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_PRINT));
ui.bounds(POLY(extrude_btn), x, y, h, v);
cmd.tag(8).button(x, y, h, v, GET_TEXT_F(MSG_EXTRUDE));
ui.bounds(POLY(pause_btn), x, y, w, h);
cmd.tag(sdOrHostPaused ? 8 : 7).enabled(sdOrHostPrinting).button(x, y, w, h, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE));
ui.bounds(POLY(print_btn), x, y, h, v);
cmd.tag(9).colors(action_btn).enabled(can_print).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_PRINT));
ui.bounds(POLY(stop_btn), x, y, w, h);
cmd.tag(9).enabled(sdOrHostPrinting).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_STOP));
}
void StatusScreen::draw_file(draw_mode_t what) {
int16_t x, y, w, h;
CommandProcessor cmd;
PolyUI ui(cmd, what);
ui.bounds(POLY(file_name), x, y, w, h);
if (what & BACKGROUND) {
cmd.tag(5)
.cmd(COLOR_RGB(bg_text_enabled))
.cmd (BITMAP_SOURCE(File_Icon_Info))
.cmd (BITMAP_LAYOUT(File_Icon_Info))
.cmd (BITMAP_SIZE (File_Icon_Info))
.icon(ICON_POS(x, y, w, h), File_Icon_Info, icon_scale);
}
if (what & FOREGROUND) {
cmd.cmd(COLOR_RGB(bg_text_enabled));
if(!isMediaInserted())
draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No media present"), OPT_CENTERY, font_small);
else if(isFileSelected()) {
FileList list;
draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), list.filename(), OPT_CENTERY, font_small);
} else
draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No file selected"), OPT_CENTERY, font_small);
}
}
bool StatusScreen::isFileSelected() {
if(!isMediaInserted()) return false;
FileList list;
if(list.isDir()) return false;
const char *filename = list.filename();
if(filename[0] == '\0') return false;
return true;
}
void StatusScreen::onRedraw(draw_mode_t what) {
@ -220,8 +298,9 @@ void StatusScreen::onRedraw(draw_mode_t what) {
.tag(0);
}
draw_file(what);
draw_time(what);
draw_progress(what);
draw_syringe(what);
draw_temperature(what);
draw_buttons(what);
}
@ -233,11 +312,12 @@ bool StatusScreen::onTouchStart(uint8_t) {
bool StatusScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: SpinnerDialogBox::enqueueAndWait(F("G28 O\nG27")); break;
case 2: GOTO_SCREEN(LoadChocolateScreen); break;
case 1: GOTO_SCREEN(LoadChocolateScreen); break;
case 3: GOTO_SCREEN(PreheatMenu); break;
case 4: GOTO_SCREEN(MainMenu); break;
case 5:
case 5: GOTO_SCREEN(FilesScreen); break;
case 6: GOTO_SCREEN(ConfirmStartPrintDialogBox); break;
case 7:
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::isPrintingFromMedia())
ExtUI::pausePrint();
@ -246,7 +326,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
#endif
GOTO_SCREEN(StatusScreen);
break;
case 6:
case 8:
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::isPrintingFromMedia())
ExtUI::resumePrint();
@ -255,12 +335,12 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
#endif
GOTO_SCREEN(StatusScreen);
break;
case 7:
case 9:
GOTO_SCREEN(ConfirmAbortPrintDialogBox);
current_screen.forget();
PUSH_SCREEN(StatusScreen);
break;
case 9: GOTO_SCREEN(FilesScreen); break;
case 10: GOTO_SCREEN(TemperatureScreen); break;
default: return false;
}
@ -271,7 +351,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
}
bool StatusScreen::onTouchHeld(uint8_t tag) {
if (tag == 8 && !ExtUI::isMoving()) {
if (tag == 2 && !ExtUI::isMoving()) {
LoadChocolateScreen::setManualFeedrateAndIncrement(1, increment);
UI_INCREMENT(AxisPosition_mm, E0);
current_screen.onRefresh();

View File

@ -28,17 +28,19 @@
class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE> {
private:
static void _format_time(char *outstr, uint32_t time);
static float increment;
static bool jog_xy;
static bool fine_motion;
static void draw_time(draw_mode_t what);
static void draw_progress(draw_mode_t what);
static void draw_temperature(draw_mode_t what);
static void draw_syringe(draw_mode_t what);
static void draw_arrows(draw_mode_t what);
static void draw_overlay_icons(draw_mode_t what);
static void draw_fine_motion(draw_mode_t what);
static void draw_buttons(draw_mode_t what);
static void draw_file(draw_mode_t what);
static bool isFileSelected();
public:
static void loadBitmaps();
static void unlockMotors();

View File

@ -34,7 +34,7 @@ void MaxVelocityScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(0);
w.units(GET_TEXT_F(MSG_UNITS_MM_S));
w.heading( GET_TEXT_F(MSG_MAX_SPEED));
w.heading( GET_TEXT_F(MSG_MAX_SPEED_NO_UNITS));
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_VMAX_X), getAxisMaxFeedrate_mm_s(X) );
w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_VMAX_Y), getAxisMaxFeedrate_mm_s(Y) );
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_VMAX_Z), getAxisMaxFeedrate_mm_s(Z) );

View File

@ -146,6 +146,7 @@ namespace Language_en {
LSTR MSG_PROBE_BED = u8"Probe Mesh";
LSTR MSG_PRINT_TEST = u8"Print Test (PLA)";
LSTR MSG_MOVE_Z_TO_TOP = u8"Raise Z to Top";
LSTR MSG_MAX_SPEED_NO_UNITS = u8"Max Speed";
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
LSTR MSG_MOVE_TO_HOME = u8"Move to Home";
@ -163,8 +164,9 @@ namespace Language_en {
LSTR MSG_CHOCOLATE = u8"Chocolate";
LSTR MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge";
LSTR MSG_LOAD_UNLOAD = u8"Load/Unload";
LSTR MSG_FULL_LOAD = u8"Full Load";
LSTR MSG_FULL_UNLOAD = u8"Full Unload";
LSTR MSG_START_STOP = u8"Start/Stop";
LSTR MSG_LOAD = u8"Load";
LSTR MSG_UNLOAD = u8"Unload";
LSTR MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate";
LSTR MSG_PREHEAT_FINISHED = u8"Preheat finished";
LSTR MSG_PREHEAT = u8"Preheat";

View File

@ -64,6 +64,7 @@ union screen_data_t {
DECL_DATA_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX)
DECL_DATA_IF_INCLUDED(COCOA_PREHEAT_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_LOAD_CHOCOLATE_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_FILES_SCREEN)
};
extern screen_data_t screen_data;

View File

@ -116,6 +116,8 @@ SCREEN_TABLE {
DECL_SCREEN_IF_INCLUDED(COCOA_LEVELING_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_XYZ_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_E_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_CONFIRM_START_PRINT)
DECL_SCREEN_IF_INCLUDED(COCOA_FILES_SCREEN)
};
SCREEN_TABLE_POST

View File

@ -1,4 +1,3 @@
/****************************************************************************
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *

View File

@ -1,4 +1,3 @@
/****************************************************************************
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *