code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/** * Marlin 3D Printer Firmware * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #include "../../../../inc/MarlinConfigPre.h" #if DGUS_LCD_UI_RELOADED #include "DGUS_VPList.h" #include "../config/DGUS_Addr.h" #include "../DGUSScreenHandler.h" #include "../DGUSRxHandler.h" #include "../DGUSTxHandler.h" #include "../../ui_api.h" #include "../../../../module/probe.h" #include "../../../../module/motion.h" #include "../../../../module/temperature.h" const char DGUS_MACHINENAME[] PROGMEM = MACHINE_NAME; const char DGUS_MARLINVERSION[] PROGMEM = SHORT_BUILD_VERSION; #define VP_HELPER(ADDR, SIZE, FLAGS, EXTRA, RXHANDLER, TXHANDLER) \ { .addr = ADDR, \ .size = SIZE, \ .flags = FLAGS, \ .extra = EXTRA, \ .rx_handler = RXHANDLER, \ .tx_handler = TXHANDLER } #define VP_HELPER_WORD(ADDR, FLAGS, EXTRA, RXHANDLER, TXHANDLER) \ VP_HELPER(ADDR, 2, FLAGS, EXTRA, RXHANDLER, TXHANDLER) #define VP_HELPER_DWORD(ADDR, FLAGS, EXTRA, RXHANDLER, TXHANDLER) \ VP_HELPER(ADDR, 4, FLAGS, EXTRA, RXHANDLER, TXHANDLER) #define VP_HELPER_RX(ADDR, RXHANDLER) \ VP_HELPER_WORD(ADDR, VPFLAG_NONE, nullptr, RXHANDLER, nullptr) #define VP_HELPER_RX_NODATA(ADDR, RXHANDLER) \ VP_HELPER(ADDR, 0, VPFLAG_NONE, nullptr, RXHANDLER, nullptr) #define VP_HELPER_TX(ADDR, TXHANDLER) \ VP_HELPER_WORD(ADDR, VPFLAG_NONE, nullptr, nullptr, TXHANDLER) #define VP_HELPER_TX_SIZE(ADDR, SIZE, TXHANDLER) \ VP_HELPER(ADDR, SIZE, VPFLAG_NONE, nullptr, nullptr, TXHANDLER) #define VP_HELPER_TX_EXTRA(ADDR, EXTRA, TXHANDLER) \ VP_HELPER_WORD(ADDR, VPFLAG_NONE, EXTRA, nullptr, TXHANDLER) #define VP_HELPER_TX_AUTO(ADDR, EXTRA, TXHANDLER) \ VP_HELPER_WORD(ADDR, VPFLAG_AUTOUPLOAD, EXTRA, nullptr, TXHANDLER) const struct DGUS_VP vp_list[] PROGMEM = { // READ-ONLY VARIABLES VP_HELPER_RX(DGUS_Addr::SCREENCHANGE, &DGUSRxHandler::screenChange), VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_SD, &DGUSRxHandler::screenChange), VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Idle, &DGUSRxHandler::screenChange), VP_HELPER_RX(DGUS_Addr::SCREENCHANGE_Printing, &DGUSRxHandler::screenChange), #if HAS_MEDIA VP_HELPER_RX(DGUS_Addr::SD_SelectFile, &DGUSRxHandler::selectFile), VP_HELPER_RX(DGUS_Addr::SD_Scroll, &DGUSRxHandler::scroll), VP_HELPER_RX_NODATA(DGUS_Addr::SD_Print, &DGUSRxHandler::printFile), #endif VP_HELPER_RX(DGUS_Addr::STATUS_Abort, &DGUSRxHandler::printAbort), VP_HELPER_RX(DGUS_Addr::STATUS_Pause, &DGUSRxHandler::printPause), VP_HELPER_RX(DGUS_Addr::STATUS_Resume, &DGUSRxHandler::printResume), VP_HELPER_RX(DGUS_Addr::ADJUST_SetFeedrate, &DGUSRxHandler::feedrate), VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_CUR, &DGUSRxHandler::flowrate), #if HAS_MULTI_EXTRUDER VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E0, &DGUSRxHandler::flowrate), VP_HELPER_RX(DGUS_Addr::ADJUST_SetFlowrate_E1, &DGUSRxHandler::flowrate), #endif VP_HELPER_RX(DGUS_Addr::ADJUST_SetBabystep, &DGUSRxHandler::babystepSet), VP_HELPER_RX(DGUS_Addr::ADJUST_Babystep, &DGUSRxHandler::babystep), VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::tempPreset), VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::tempTarget), VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::tempTarget), #if HAS_MULTI_HOTEND VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::tempTarget), #endif VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::tempCool), VP_HELPER_RX(DGUS_Addr::STEPPER_Control, &DGUSRxHandler::steppers), VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Set, &DGUSRxHandler::zOffset), VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_Step, &DGUSRxHandler::zOffsetStep), VP_HELPER_RX(DGUS_Addr::LEVEL_OFFSET_SetStep, &DGUSRxHandler::zOffsetSetStep), VP_HELPER_RX(DGUS_Addr::LEVEL_MANUAL_Point, &DGUSRxHandler::moveToPoint), VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Probe, &DGUSRxHandler::probe), VP_HELPER_RX_NODATA(DGUS_Addr::LEVEL_AUTO_Disable, &DGUSRxHandler::disableABL), VP_HELPER_RX(DGUS_Addr::FILAMENT_Select, &DGUSRxHandler::filamentSelect), VP_HELPER_RX(DGUS_Addr::FILAMENT_SetLength, &DGUSRxHandler::filamentLength), VP_HELPER_RX(DGUS_Addr::FILAMENT_Move, &DGUSRxHandler::filamentMove), VP_HELPER_RX(DGUS_Addr::MOVE_Home, &DGUSRxHandler::home), VP_HELPER_RX(DGUS_Addr::MOVE_SetX, &DGUSRxHandler::move), VP_HELPER_RX(DGUS_Addr::MOVE_SetY, &DGUSRxHandler::move), VP_HELPER_RX(DGUS_Addr::MOVE_SetZ, &DGUSRxHandler::move), VP_HELPER_RX(DGUS_Addr::MOVE_Step, &DGUSRxHandler::moveStep), VP_HELPER_RX(DGUS_Addr::MOVE_SetStep, &DGUSRxHandler::moveSetStep), VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Clear, &DGUSRxHandler::gcodeClear), VP_HELPER_RX_NODATA(DGUS_Addr::GCODE_Execute, &DGUSRxHandler::gcodeExecute), VP_HELPER_RX(DGUS_Addr::EEPROM_Reset, &DGUSRxHandler::resetEEPROM), VP_HELPER_RX(DGUS_Addr::SETTINGS2_Extra, &DGUSRxHandler::settingsExtra), VP_HELPER_RX(DGUS_Addr::PID_Select, &DGUSRxHandler::pidSelect), VP_HELPER_RX(DGUS_Addr::PID_SetTemp, &DGUSRxHandler::pidSetTemp), VP_HELPER_RX_NODATA(DGUS_Addr::PID_Run, &DGUSRxHandler::pidRun), #if ENABLED(POWER_LOSS_RECOVERY) VP_HELPER_RX(DGUS_Addr::POWERLOSS_Abort, &DGUSRxHandler::powerLossAbort), VP_HELPER_RX(DGUS_Addr::POWERLOSS_Resume, &DGUSRxHandler::powerLossResume), #endif VP_HELPER_RX(DGUS_Addr::WAIT_Abort, &DGUSRxHandler::waitAbort), VP_HELPER_RX_NODATA(DGUS_Addr::WAIT_Continue, &DGUSRxHandler::waitContinue), // WRITE-ONLY VARIABLES #if HAS_MEDIA VP_HELPER_TX(DGUS_Addr::SD_Type, &DGUSTxHandler::fileType), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName0, DGUS_FILENAME_LEN, &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName1, DGUS_FILENAME_LEN, &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName2, DGUS_FILENAME_LEN, &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName3, DGUS_FILENAME_LEN, &DGUSTxHandler::fileName), VP_HELPER_TX_SIZE(DGUS_Addr::SD_FileName4, DGUS_FILENAME_LEN, &DGUSTxHandler::fileName), VP_HELPER_TX(DGUS_Addr::SD_ScrollIcons, &DGUSTxHandler::scrollIcons), VP_HELPER_TX_SIZE(DGUS_Addr::SD_SelectedFileName, DGUS_FILENAME_LEN, &DGUSTxHandler::selectedFileName), #endif VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_PositionZ, nullptr, &DGUSTxHandler::zPosition), VP_HELPER(DGUS_Addr::STATUS_Elapsed, DGUS_ELAPSED_LEN, VPFLAG_AUTOUPLOAD, nullptr, nullptr, &DGUSTxHandler::elapsed), VP_HELPER_TX_AUTO(DGUS_Addr::STATUS_Percent, nullptr, &DGUSTxHandler::percent), VP_HELPER_TX(DGUS_Addr::STATUS_Icons, &DGUSTxHandler::statusIcons), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Feedrate, &feedrate_percentage, &DGUSTxHandler::extraToInteger<int16_t>), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_CUR, nullptr, &DGUSTxHandler::flowrate), #if HAS_MULTI_EXTRUDER VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E0, nullptr, &DGUSTxHandler::flowrate), VP_HELPER_TX_AUTO(DGUS_Addr::ADJUST_Flowrate_E1, nullptr, &DGUSTxHandler::flowrate), #endif VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_Bed, &thermalManager.temp_bed.celsius, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_Bed, &thermalManager.temp_bed.target, &DGUSTxHandler::extraToInteger<int16_t>), VP_HELPER_TX(DGUS_Addr::TEMP_Max_Bed, &DGUSTxHandler::tempMax), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].celsius, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H0, &thermalManager.temp_hotend[ExtUI::heater_t::H0].target, &DGUSTxHandler::extraToInteger<int16_t>), VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::tempMax), #if HAS_MULTI_HOTEND VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].celsius, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Target_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].target, &DGUSTxHandler::extraToInteger<int16_t>), VP_HELPER_TX(DGUS_Addr::TEMP_Max_H1, &DGUSTxHandler::tempMax), #endif VP_HELPER_TX_AUTO(DGUS_Addr::STEPPER_Status, nullptr, &DGUSTxHandler::stepperStatus), VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_OFFSET_Current, &probe.offset.z, (&DGUSTxHandler::extraToFixedPoint<float, 2>)), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_OFFSET_StepIcons, &DGUSScreenHandler::offset_steps, &DGUSTxHandler::stepIcons), VP_HELPER_TX_AUTO(DGUS_Addr::LEVEL_AUTO_DisableIcon, nullptr, &DGUSTxHandler::ablDisableIcon), VP_HELPER_TX(DGUS_Addr::LEVEL_AUTO_Grid, &DGUSTxHandler::ablGrid), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons1, &DGUSScreenHandler::probing_icons[0], &DGUSTxHandler::extraToInteger<uint16_t>), VP_HELPER_TX_EXTRA(DGUS_Addr::LEVEL_PROBING_Icons2, &DGUSScreenHandler::probing_icons[1], &DGUSTxHandler::extraToInteger<uint16_t>), VP_HELPER_TX(DGUS_Addr::FILAMENT_ExtruderIcons, &DGUSTxHandler::filamentIcons), VP_HELPER_TX_EXTRA(DGUS_Addr::FILAMENT_Length, &DGUSScreenHandler::filament_length, &DGUSTxHandler::extraToInteger<uint16_t>), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentX, &current_position.x, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentY, &current_position.y, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_AUTO(DGUS_Addr::MOVE_CurrentZ, &current_position.z, (&DGUSTxHandler::extraToFixedPoint<float, 1>)), VP_HELPER_TX_EXTRA(DGUS_Addr::MOVE_StepIcons, &DGUSScreenHandler::move_steps, &DGUSTxHandler::stepIcons), VP_HELPER_TX(DGUS_Addr::SETTINGS2_BLTouch, &DGUSTxHandler::blTouch), VP_HELPER_TX(DGUS_Addr::PID_HeaterIcons, &DGUSTxHandler::pidIcons), VP_HELPER_TX_EXTRA(DGUS_Addr::PID_Temp, &DGUSScreenHandler::pid_temp, &DGUSTxHandler::extraToInteger<uint16_t>), VP_HELPER_DWORD(DGUS_Addr::PID_Kp, VPFLAG_AUTOUPLOAD, nullptr, nullptr, &DGUSTxHandler::pidKp), VP_HELPER_DWORD(DGUS_Addr::PID_Ki, VPFLAG_AUTOUPLOAD, nullptr, nullptr, &DGUSTxHandler::pidKi), VP_HELPER_DWORD(DGUS_Addr::PID_Kd, VPFLAG_AUTOUPLOAD, nullptr, nullptr, &DGUSTxHandler::pidKd), VP_HELPER(DGUS_Addr::INFOS_Machine, DGUS_MACHINE_LEN, VPFLAG_NONE, (void*)DGUS_MACHINENAME, nullptr, &DGUSTxHandler::extraPGMToString), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_BuildVolume, DGUS_BUILDVOLUME_LEN, &DGUSTxHandler::buildVolume), VP_HELPER(DGUS_Addr::INFOS_Version, DGUS_VERSION_LEN, VPFLAG_NONE, (void*)DGUS_MARLINVERSION, nullptr, &DGUSTxHandler::extraPGMToString), VP_HELPER_TX(DGUS_Addr::INFOS_TotalPrints, &DGUSTxHandler::totalPrints), VP_HELPER_TX(DGUS_Addr::INFOS_FinishedPrints, &DGUSTxHandler::finishedPrints), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_PrintTime, DGUS_PRINTTIME_LEN, &DGUSTxHandler::printTime), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_LongestPrint, DGUS_LONGESTPRINT_LEN, &DGUSTxHandler::longestPrint), VP_HELPER_TX_SIZE(DGUS_Addr::INFOS_FilamentUsed, DGUS_FILAMENTUSED_LEN, &DGUSTxHandler::filamentUsed), VP_HELPER_TX(DGUS_Addr::WAIT_Icons, &DGUSTxHandler::waitIcons), // READ-WRITE VARIABLES VP_HELPER(DGUS_Addr::FAN0_Speed, 2, VPFLAG_AUTOUPLOAD, nullptr, &DGUSRxHandler::fanSpeed, &DGUSTxHandler::fanSpeed), VP_HELPER(DGUS_Addr::GCODE_Data, DGUS_GCODE_LEN, VPFLAG_RXSTRING, (void*)DGUSScreenHandler::gcode, &DGUSRxHandler::stringToExtra, &DGUSTxHandler::extraToString), VP_HELPER(DGUS_Addr::PID_Cycles, 2, VPFLAG_NONE, &DGUSScreenHandler::pid_cycles, &DGUSRxHandler::integerToExtra<uint8_t>, &DGUSTxHandler::extraToInteger<uint8_t>), VP_HELPER(DGUS_Addr::VOLUME_Level, 2, VPFLAG_NONE, nullptr, &DGUSRxHandler::volume, &DGUSTxHandler::volume), VP_HELPER(DGUS_Addr::BRIGHTNESS_Level, 2, VPFLAG_NONE, nullptr, &DGUSRxHandler::brightness, &DGUSTxHandler::brightness), // SPECIAL CASES VP_HELPER_TX(DGUS_Addr::STATUS_Percent_Complete, &DGUSTxHandler::percent), VP_HELPER_RX_NODATA(DGUS_Addr::INFOS_Debug, &DGUSRxHandler::debug), VP_HELPER((DGUS_Addr)0, 0, VPFLAG_NONE, nullptr, nullptr, nullptr) }; #endif // DGUS_LCD_UI_RELOADED
2301_81045437/Marlin
Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp
C++
agpl-3.0
14,891
/** * Marlin 3D Printer Firmware * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #pragma once #include "DGUS_VP.h" extern const struct DGUS_VP vp_list[];
2301_81045437/Marlin
Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h
C
agpl-3.0
937
/** * Marlin 3D Printer Firmware * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ /** * lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp */ #include "../../../inc/MarlinConfigPre.h" #if DGUS_LCD_UI_RELOADED #include "../ui_api.h" #include "DGUSScreenHandler.h" namespace ExtUI { void onStartup() { screen.init(); } void onIdle() { static bool processing = false; // Prevent recursion if (!processing) { processing = true; screen.loop(); processing = false; } } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { screen.printerKilled(error, component); } void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} void onMaxTempError(const heater_id_t header_id) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { screen.playTone(frequency, duration); } void onPrintTimerStarted() { screen.printTimerStarted(); } void onPrintTimerPaused() { screen.printTimerPaused(); } void onPrintTimerStopped() { screen.printTimerStopped(); } void onFilamentRunout(const extruder_t extruder) { screen.filamentRunout(extruder); } void onUserConfirmRequired(const char * const msg) { screen.userConfirmRequired(msg); } // For fancy LCDs include an icon ID, message, and translated button title void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { onUserConfirmRequired(cstr); UNUSED(icon); UNUSED(fBtn); } void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { onUserConfirmRequired(fstr); UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) void onPauseMode( const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/ ) { stdOnPauseMode(message, mode, extruder); } #endif void onStatusChanged(const char * const msg) { screen.setStatusMessage(msg); } void onHomingStart() {} void onHomingDone() {} void onPrintDone() {} void onFactoryReset() { screen.settingsReset(); } void onStoreSettings(char *buff) { screen.storeSettings(buff); } void onLoadSettings(const char *buff) { screen.loadSettings(buff); } void onPostprocessSettings() {} void onSettingsStored(const bool success) { screen.configurationStoreWritten(success); } void onSettingsLoaded(const bool success) { screen.configurationStoreRead(success); } #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} #if ENABLED(PREHEAT_BEFORE_LEVELING) celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } #endif #endif #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { screen.meshUpdate(xpos, ypos); } void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { if (state == G29_POINT_FINISH) screen.meshUpdate(xpos, ypos); } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) void onSetMinExtrusionTemp(const celsius_t) {} #endif #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled } void onPowerLoss() { // Called when power-loss state is detected } void onPowerLossResume() { // Called on resume from power-loss screen.powerLossResume(); } #endif #if HAS_PID_HEATING void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result screen.pidTuning(rst); } void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { // Called by M303 to update the UI } #endif #if ENABLED(MPC_AUTOTUNE) void onMPCTuning(const mpcresult_t rst) { // Called for temperature PID tuning result } #endif #if ENABLED(PLATFORM_M997_SUPPORT) void onFirmwareFlash() {} #endif void onSteppersDisabled() {} void onSteppersEnabled() {} void onAxisDisabled(const axis_t) {} void onAxisEnabled(const axis_t) {} } #endif // DGUS_LCD_UI_RELOADED
2301_81045437/Marlin
Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
C++
agpl-3.0
5,212
/********************* * example.cpp * *********************/ /**************************************************************************** * 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 "../../../inc/MarlinConfigPre.h" #if ALL(EXTUI_EXAMPLE, EXTENSIBLE_UI) #include "../ui_api.h" // To implement a new UI, complete the functions below and // read or update Marlin's state using the methods in the // ExtUI methods in "../ui_api.h" // // Although it may be possible to access other state // variables from Marlin, using the API here possibly // helps ensure future compatibility. namespace ExtUI { void onStartup() { /* Initialize the display module here. The following * routines are available for access to the GPIO pins: * * SET_OUTPUT(pin) * SET_INPUT_PULLUP(pin) * SET_INPUT(pin) * WRITE(pin,value) * READ(pin) */ } void onIdle() {} void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} void onMaxTempError(const heater_id_t header_id) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} void onPrintTimerStarted() {} void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout(const extruder_t extruder) {} void onUserConfirmRequired(const char * const msg) {} // For fancy LCDs include an icon ID, message, and translated button title void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) {} void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) {} #if ENABLED(ADVANCED_PAUSE_FEATURE) void onPauseMode( const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/ ) { stdOnPauseMode(message, mode, extruder); } #endif void onStatusChanged(const char * const msg) {} void onHomingStart() {} void onHomingDone() {} void onPrintDone() {} void onFactoryReset() {} void onStoreSettings(char *buff) { // Called when saving to EEPROM (i.e. M500). If the ExtUI needs // permanent data to be stored, it can write up to eeprom_data_size bytes // into buff. // Example: // static_assert(sizeof(myDataStruct) <= eeprom_data_size); // memcpy(buff, &myDataStruct, sizeof(myDataStruct)); } void onLoadSettings(const char *buff) { // Called while loading settings from EEPROM. If the ExtUI // needs to retrieve data, it should copy up to eeprom_data_size bytes // from buff // Example: // static_assert(sizeof(myDataStruct) <= eeprom_data_size); // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } void onPostprocessSettings() { // Called after loading or resetting stored settings } void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} #if ENABLED(PREHEAT_BEFORE_LEVELING) celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } #endif #endif #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { // Called when any mesh points are updated } void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { // Called to indicate a special condition } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) void onSetMinExtrusionTemp(const celsius_t) {} #endif #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled } void onPowerLoss() { // Called when power-loss state is detected } void onPowerLossResume() { // Called on resume from power-loss } #endif #if HAS_PID_HEATING void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: case PID_BED_STARTED: case PID_CHAMBER_STARTED: break; case PID_BAD_HEATER_ID: break; case PID_TEMP_TOO_HIGH: break; case PID_TUNING_TIMEOUT: break; case PID_DONE: break; } } void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { // Called by M303 to update the UI } #endif #if ENABLED(MPC_AUTOTUNE) void onMPCTuning(const mpcresult_t rst) { // Called for temperature MPC tuning result switch (rst) { case MPC_STARTED: break; case MPC_TEMP_ERROR: break; case MPC_INTERRUPTED: break; case MPC_DONE: break; } } #endif #if ENABLED(PLATFORM_M997_SUPPORT) void onFirmwareFlash() {} #endif void onSteppersDisabled() {} void onSteppersEnabled() {} void onAxisDisabled(const axis_t) {} void onAxisEnabled(const axis_t) {} } #endif // EXTUI_EXAMPLE && EXTENSIBLE_UI
2301_81045437/Marlin
Marlin/src/lcd/extui/example/example.cpp
C++
agpl-3.0
6,430
/********************* * flash_storage.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" #if ENABLED(TOUCH_UI_FTDI_EVE) #include "../ftdi_eve_lib/ftdi_eve_lib.h" #include "media_file_reader.h" #include "flash_storage.h" // The following must be changed whenever the layout of the flash // data is changed in a manner that would render the data invalid. constexpr uint32_t flash_eeprom_version = 1; /* SPI Flash Memory Map: * * The following offsets and sizes are specified in 4k erase units: * * Page Size Description * 0 16 DATA STORAGE AREA * 16 1 VERSIONING DATA * 17 inf MEDIA STORAGE AREA */ #define DATA_STORAGE_SIZE_64K using namespace FTDI::SPI; using namespace FTDI::SPI::most_significant_byte_first; bool UIFlashStorage::is_present = false; #ifdef SPI_FLASH_SS /************************** SPI Flash Chip Interface **************************/ void SPIFlash::wait_while_busy() { uint8_t status; safe_delay(1); do { spi_flash_select(); spi_write_8(READ_STATUS_1); status = spi_read_8(); spi_flash_deselect(); safe_delay(1); } while (status & 1); } void SPIFlash::erase_sector_4k(uint32_t addr) { spi_flash_select(); spi_write_8(WRITE_ENABLE); spi_flash_deselect(); spi_flash_select(); spi_write_8(ERASE_4K); spi_write_24(addr); spi_flash_deselect(); wait_while_busy(); } void SPIFlash::erase_sector_64k(uint32_t addr) { spi_flash_select(); spi_write_8(WRITE_ENABLE); spi_flash_deselect(); spi_flash_select(); spi_write_8(ERASE_64K); spi_write_24(addr); spi_flash_deselect(); wait_while_busy(); } void SPIFlash::spi_write_begin(uint32_t addr) { spi_flash_select(); spi_write_8(WRITE_ENABLE); spi_flash_deselect(); spi_flash_select(); spi_write_8(PAGE_PROGRAM); spi_write_24(addr); } void SPIFlash::spi_write_end() { spi_flash_deselect(); wait_while_busy(); } void SPIFlash::spi_read_begin(uint32_t addr) { spi_flash_select(); spi_write_8(READ_DATA); spi_write_24(addr); } void SPIFlash::spi_read_end() { spi_flash_deselect(); } void SPIFlash::erase_chip() { spi_flash_select(); spi_write_8(WRITE_ENABLE); spi_flash_deselect(); spi_flash_select(); spi_write_8(ERASE_CHIP); spi_flash_deselect(); wait_while_busy(); } void SPIFlash::read_jedec_id(uint8_t &manufacturer_id, uint8_t &device_type, uint8_t &capacity) { spi_flash_select(); spi_write_8(READ_JEDEC_ID); manufacturer_id = spi_recv(); device_type = spi_recv(); capacity = spi_recv(); spi_flash_deselect (); } /* This function writes "size" bytes from "data" starting at addr, while properly * taking into account the special case of writing across a 256 byte page boundary. * Returns the addr directly after the write. */ uint32_t SPIFlash::write(uint32_t addr, const void *_data, size_t size) { const uint8_t *data = (const uint8_t*) _data; while (size) { const uint32_t page_start = addr & 0xFFFF00ul; const uint32_t page_end = page_start + 256; const uint32_t write_size = min(page_end - addr, size); spi_write_begin(addr); spi_write_bulk<ram_write>(data, write_size); spi_write_end(); addr += write_size; size -= write_size; data += write_size; } return addr; } uint32_t SPIFlash::read(uint32_t addr, void *data, size_t size) { spi_read_begin(addr); spi_read_bulk(data, size); spi_read_end(); return addr + size; } /********************************** UTILITY ROUTINES *********************************/ bool UIFlashStorage::check_known_device() { uint8_t manufacturer_id, device_type, capacity; read_jedec_id(manufacturer_id, device_type, capacity); const bool is_known = ((manufacturer_id == 0xEF) && (device_type == 0x40) && (capacity == 0x15)) || // unknown ((manufacturer_id == 0x01) && (device_type == 0x40) && (capacity == 0x15)) || // Cypress S25FL116K ((manufacturer_id == 0xEF) && (device_type == 0x14) && (capacity == 0x15)) || // Winbond W25Q16JV ((manufacturer_id == 0x1F) && (device_type == 0x86) && (capacity == 0x01)) ; // Adesto AT255F161 if (!is_known) { SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory."); SERIAL_ECHO_MSG(" Manufacturer ID, got: ", manufacturer_id); SERIAL_ECHO_MSG(" Device Type , got: ", device_type); SERIAL_ECHO_MSG(" Capacity , got: ", capacity); } return is_known; } void UIFlashStorage::initialize() { for (uint8_t i = 0; i < 10; i++) { if (check_known_device()) { is_present = true; break; } safe_delay(1000); } } /**************************** DATA STORAGE AREA (first 4K or 64k) ********************/ #ifdef DATA_STORAGE_SIZE_64K constexpr uint32_t data_storage_area_size = 64 * 1024; // Large erase unit #else constexpr uint32_t data_storage_area_size = 4 * 1024; // Small erase unit #endif /* In order to provide some degree of wear leveling, each data write to the * SPI Flash chip is appended to data that was already written before, until * the data storage area is completely filled. New data is written preceded * with a 32-bit delimiter 'LULZ', so that we can distinguish written and * unwritten data: * * 'LULZ' <--- 1st record delimiter * <data_byte> * <data_byte> * <data_byte> * 'LULZ' <--- 2nd record delimiter * <data_byte> * <data_byte> * <data_byte> * ... * 'LULZ' <--- Last record delimiter * <data_byte> * <data_byte> * <data_byte> * 0xFF <--- Start of free space * 0xFF * ... * * This function walks down the data storage area, verifying that the * delimiters are either 'LULZ' or 0xFFFFFFFF. In the case that an invalid * delimiter is found, this function returns -1, indicating that the Flash * data is invalid (this will happen if the block_size changed with respect * to earlier firmware). Otherwise, it returns the offset of the last * valid delimiter 'LULZ', indicating the most recently written data. */ int32_t UIFlashStorage::get_config_read_offset(uint32_t block_size) { uint16_t stride = 4 + block_size; int32_t read_offset = -1; for (uint32_t offset = 0; offset < (data_storage_area_size - stride); offset += stride) { uint32_t delim; spi_read_begin(offset); spi_read_bulk (&delim, sizeof(delim)); spi_read_end(); switch (delim) { case 0xFFFFFFFFul: return read_offset; case delimiter: read_offset = offset; break; default: SERIAL_ECHO_MSG("Invalid delimiter in Flash: ", delim); return -1; } } SERIAL_ECHO_MSG("No LULZ delimiter found."); return -1; } /* This function returns the offset at which new data should be * appended, or -1 if the Flash needs to be erased */ int32_t UIFlashStorage::get_config_write_offset(uint32_t block_size) { int32_t read_offset = get_config_read_offset(block_size); if (read_offset == -1) return -1; // The SPI flash is invalid int32_t write_offset = read_offset + 4 + block_size; if ((write_offset + 4 + block_size) > data_storage_area_size) { SERIAL_ECHO_MSG("Not enough free space in Flash."); return -1; // Not enough free space } return write_offset; } bool UIFlashStorage::verify_config_data(const void *data, size_t size) { if (!is_present) return false; int32_t read_addr = get_config_read_offset(size); if (read_addr == -1) return false; uint32_t delim; spi_read_begin(read_addr); spi_read_bulk (&delim, sizeof(delim)); bool ok = spi_verify_bulk(data,size); spi_read_end(); return ok && delim == delimiter; } bool UIFlashStorage::read_config_data(void *data, size_t size) { if (!is_present) return false; int32_t read_addr = get_config_read_offset(size); if (read_addr == -1) return false; uint32_t delim; spi_read_begin(read_addr); spi_read_bulk (&delim, sizeof(delim)); spi_read_bulk (data, size); spi_read_end(); return delim == delimiter; } void UIFlashStorage::write_config_data(const void *data, size_t size) { if (!is_present) { SERIAL_ECHO_MSG("SPI Flash chip not present. Not saving UI settings."); return; } // Since Flash storage has a limited number of write cycles, // make sure that the data is different before rewriting. if (verify_config_data(data, size)) { SERIAL_ECHO_MSG("UI settings already written, skipping write."); return; } int16_t write_addr = get_config_write_offset(size); if (write_addr == -1) { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Erasing UI settings from SPI Flash... "); #ifdef DATA_STORAGE_SIZE_64K erase_sector_64k(0); #else erase_sector_4k(0); #endif write_addr = 0; SERIAL_ECHOLNPGM("DONE"); } SERIAL_ECHO_START(); SERIAL_ECHOPGM("Writing UI settings to SPI Flash (offset ", write_addr, ")..."); const uint32_t delim = delimiter; write_addr = write(write_addr, &delim, sizeof(delim)); write_addr = write(write_addr, data, size); SERIAL_ECHOLNPGM("DONE"); } /************************** VERSIONING INFO AREA ************************/ /* The version info area follows the data storage area. If the version * is incorrect, the data on the chip is invalid and format_flash should * be called. */ typedef struct { uint32_t magic; uint32_t version; } flash_version_info; constexpr uint32_t version_info_addr = data_storage_area_size; constexpr uint32_t version_info_size = 4 * 1024; // Small erase unit bool UIFlashStorage::is_valid() { flash_version_info info; spi_read_begin(version_info_addr); spi_read_bulk (&info, sizeof(flash_version_info)); spi_read_end(); return info.magic == delimiter && info.version == flash_eeprom_version; } void UIFlashStorage::write_version_info() { flash_version_info info; info.magic = delimiter; info.version = flash_eeprom_version; spi_write_begin(version_info_addr); spi_write_bulk<ram_write>(&info, sizeof(flash_version_info)); spi_write_end(); } /**************************** MEDIA STORAGE AREA *****************************/ /* The media storage area follows the versioning info area. It consists * of a file index followed by the data for one or more media files. * * The file index consists of an array of 32-bit file sizes. If a file * is not present, the file's size will be set to 0xFFFFFFFF */ constexpr uint32_t media_storage_addr = version_info_addr + version_info_size; constexpr uint8_t media_storage_slots = 4; void UIFlashStorage::format_flash() { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Erasing SPI Flash..."); SPIFlash::erase_chip(); SERIAL_ECHOLNPGM("DONE"); write_version_info(); } uint32_t UIFlashStorage::get_media_file_start(uint8_t slot) { uint32_t addr = media_storage_addr + sizeof(uint32_t) * media_storage_slots; spi_read_begin(media_storage_addr); for (uint8_t i = 0; i < slot; i++) addr += spi_read_32(); spi_read_end(); return addr; } void UIFlashStorage::set_media_file_size(uint8_t slot, uint32_t size) { spi_write_begin(media_storage_addr + sizeof(uint32_t) * slot); spi_write_32(size); spi_write_end(); } uint32_t UIFlashStorage::get_media_file_size(uint8_t slot) { spi_read_begin(media_storage_addr + sizeof(uint32_t) * slot); uint32_t size = spi_read_32(); spi_read_end(); return size; } /* Writes a media file from the SD card/USB flash drive into a slot on the SPI Flash. Media * files must be written sequentially following by a chip erase and it is not possible to * overwrite files. */ UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P filename, uint8_t slot) { #if HAS_MEDIA uint32_t addr; uint8_t buff[write_page_size]; strcpy_P((char*)buff, FTOP(filename)); MediaFileReader reader; if (!reader.open((char*) buff)) { SERIAL_ECHO_MSG("Unable to find media file"); return FILE_NOT_FOUND; } if (get_media_file_size(slot) != 0xFFFFFFFFUL) { SERIAL_ECHO_MSG("Media file already exists"); return WOULD_OVERWRITE; } SERIAL_ECHO_START(); SERIAL_ECHOPGM("Writing SPI Flash..."); set_media_file_size(slot, reader.size()); addr = get_media_file_start(slot); // Write out the file itself for (;;) { const int16_t nBytes = reader.read(buff, write_page_size); if (nBytes == -1) { SERIAL_ECHOLNPGM("Failed to read from file"); return READ_ERROR; } addr = write(addr, buff, nBytes); if (nBytes != write_page_size) break; TERN_(EXTENSIBLE_UI, ExtUI::yield()); } SERIAL_ECHOLNPGM("DONE"); SERIAL_ECHO_START(); SERIAL_ECHOPGM("Verifying SPI Flash..."); bool verifyOk = true; // Verify the file index if (get_media_file_start(slot+1) != (get_media_file_start(slot) + reader.size())) { SERIAL_ECHOLNPGM("File index verification failed. "); verifyOk = false; } // Verify the file itself addr = get_media_file_start(slot); reader.rewind(); while (verifyOk) { const int16_t nBytes = reader.read(buff, write_page_size); if (nBytes == -1) { SERIAL_ECHOPGM("Failed to read from file"); verifyOk = false; break; } spi_read_begin(addr); if (!spi_verify_bulk(buff, nBytes)) { verifyOk = false; spi_read_end(); break; } spi_read_end(); addr += nBytes; if (nBytes != write_page_size) break; TERN_(EXTENSIBLE_UI, ExtUI::yield()); }; if (verifyOk) { SERIAL_ECHOLNPGM("DONE"); return SUCCESS; } else { SERIAL_ECHOLNPGM("FAIL"); return VERIFY_ERROR; } #else return VERIFY_ERROR; #endif // HAS_MEDIA } bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t slot) { if (!is_present) return false; bytes_remaining = get_media_file_size(slot); if (bytes_remaining != 0xFFFFFFFFUL) { SERIAL_ECHO_MSG("Boot media file size:", bytes_remaining); addr = get_media_file_start(slot); return true; } return false; } int16_t UIFlashStorage::BootMediaReader::read(void *data, const size_t size) { if (bytes_remaining == 0xFFFFFFFFUL) return -1; if (size > bytes_remaining) return read(data, bytes_remaining); if (size > 0) { spi_read_begin(addr); spi_read_bulk(data, size); spi_read_end(); addr += size; bytes_remaining -= size; } return size; } int16_t UIFlashStorage::BootMediaReader::read(void *obj, void *data, const size_t size) { return reinterpret_cast<UIFlashStorage::BootMediaReader*>(obj)->read(data, size); } #else void UIFlashStorage::initialize() {} bool UIFlashStorage::is_valid() {return true;} void UIFlashStorage::write_config_data(const void *, size_t) {} bool UIFlashStorage::verify_config_data(const void *, size_t) {return false;} bool UIFlashStorage::read_config_data(void *, size_t ) {return false;} UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P, uint8_t) {return FILE_NOT_FOUND;} void UIFlashStorage::format_flash() {} bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;} int16_t UIFlashStorage::BootMediaReader::read(void *, const size_t) {return -1;} int16_t UIFlashStorage::BootMediaReader::read(void *, void *, const size_t) {return -1;} #endif // SPI_FLASH_SS #endif // TOUCH_UI_FTDI_EVE
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.cpp
C++
agpl-3.0
17,676
/******************* * flash_storage.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/>. * ****************************************************************************/ class SPIFlash { public: static constexpr uint32_t erase_unit_size = 4 * 1024; // Minimum erase unit static constexpr uint32_t write_page_size = 256; // Minimum page write unit enum { READ_STATUS_1 = 0x05, READ_STATUS_2 = 0x35, READ_STATUS_3 = 0x33, WRITE_ENABLE = 0x06, WRITE_DISABLE = 0x04, READ_ID = 0x90, READ_JEDEC_ID = 0x9F, READ_DATA = 0x03, PAGE_PROGRAM = 0x02, ERASE_4K = 0x20, ERASE_64K = 0xD8, ERASE_CHIP = 0xC7 }; static void wait_while_busy(); static void erase_sector_4k(uint32_t addr); static void erase_sector_64k(uint32_t addr); static void erase_chip (); static void read_jedec_id(uint8_t &manufacturer_id, uint8_t &device_type, uint8_t &capacity); static void spi_read_begin(uint32_t addr); static void spi_read_end(); static void spi_write_begin(uint32_t addr); static void spi_write_end(); static uint32_t write(uint32_t addr, const void *data, size_t size); static uint32_t read(uint32_t addr, void *data, size_t size); }; class UIFlashStorage : private SPIFlash { private: static bool is_present; static int32_t get_config_read_offset(uint32_t block_size); static int32_t get_config_write_offset(uint32_t block_size); static uint32_t get_media_file_start(uint8_t slot); static void set_media_file_size(uint8_t slot, uint32_t size); static uint32_t get_media_file_size(uint8_t slot); static constexpr uint32_t delimiter = 0x4D524C4E; // 'MRLN' public: enum error_t { SUCCESS, FILE_NOT_FOUND, READ_ERROR, VERIFY_ERROR, WOULD_OVERWRITE }; static void initialize (); static void format_flash (); static bool check_known_device(); static bool is_valid (); static void write_version_info(); static void write_config_data (const void *data, size_t size); static bool verify_config_data (const void *data, size_t size); static bool read_config_data (void *data, size_t size); static error_t write_media_file (FSTR_P filename, uint8_t slot = 0); class BootMediaReader; }; class UIFlashStorage::BootMediaReader { private: uint32_t addr; uint32_t bytes_remaining; public: bool isAvailable(uint32_t slot = 0); int16_t read(void *buffer, size_t const size); static int16_t read(void *obj, void *buffer, const size_t size); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/flash_storage.h
C++
agpl-3.0
3,880
/************************ * media_filereader.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" #if ENABLED(TOUCH_UI_FTDI_EVE) #include "media_file_reader.h" #if HAS_MEDIA bool MediaFileReader::open(const char *filename) { root = CardReader::getroot(); return file.open(&root, filename, O_READ); } int16_t MediaFileReader::read(void *buff, size_t bytes) { return file.read(buff, bytes); } void MediaFileReader::close() { file.close(); } uint32_t MediaFileReader::size() { return file.fileSize(); } void MediaFileReader::rewind() { file.rewind(); } int16_t MediaFileReader::read(void *obj, void *buff, size_t bytes) { return reinterpret_cast<MediaFileReader*>(obj)->read(buff, bytes); } #else bool MediaFileReader::open(const char*) {return -1;} int16_t MediaFileReader::read(void *, size_t) {return 0;} void MediaFileReader::close() {} uint32_t MediaFileReader::size() {return 0;} void MediaFileReader::rewind() {} int16_t MediaFileReader::read(void *, void *, size_t) {return 0;} #endif #endif // TOUCH_UI_FTDI_EVE
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp
C++
agpl-3.0
2,570
/********************** * media_filereader.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 #include "../../../../inc/MarlinConfigPre.h" #if HAS_MEDIA #include "../../../../sd/SdFile.h" #include "../../../../sd/cardreader.h" #endif class MediaFileReader { private: #if HAS_MEDIA MediaFile root, file; #endif public: bool open(const char *filename); int16_t read(void *buff, size_t bytes); uint32_t size(); void rewind(); void close(); static int16_t read(void *obj, void *buff, size_t bytes); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h
C++
agpl-3.0
1,870
/************************* * advanced_settings.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 FTDI_BIO_ADVANCED_SETTINGS_MENU using namespace FTDI; using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 9 void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) .tag(2) .button(BTN_POS(1,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_DISPLAY_MENU)) .enabled(ENABLED(HAS_TRINAMIC_CONFIG)) .tag(3) .button(BTN_POS(1,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_CURRENT)) .enabled(ENABLED(HAS_TRINAMIC_CONFIG)) .tag(4) .button(BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_HOMING_THRS)) .tag(5) .button(BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) .enabled(ENABLED(HAS_MULTI_HOTEND)) .tag(6) .button(BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_OFFSETS_MENU)) .tag(7) .button(BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM)) .tag(8) .button(BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_MAX_SPEED)) .tag(9) .button(BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION)) .tag(10) .button(BTN_POS(2,4), BTN_SIZE(1,1), GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) .enabled(ENABLED(BACKLASH_GCODE)) .tag(11) .button(BTN_POS(2,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACKLASH)) .enabled(ENABLED(LIN_ADVANCE)) .tag(12) .button(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_LINEAR_ADVANCE)) .tag(13) .button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(14) .button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) .tag(1) .button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { using namespace ExtUI; switch (tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: GOTO_SCREEN(DisplayTuningScreen); break; #if HAS_TRINAMIC_CONFIG case 3: GOTO_SCREEN(StepperCurrentScreen); break; case 4: GOTO_SCREEN(StepperBumpSensitivityScreen); break; #endif case 5: GOTO_SCREEN(EndstopStatesScreen); break; #if HAS_MULTI_HOTEND case 6: GOTO_SCREEN(NozzleOffsetScreen); break; #endif case 7: GOTO_SCREEN(StepsScreen); break; case 8: GOTO_SCREEN(MaxVelocityScreen); break; case 9: GOTO_SCREEN(DefaultAccelerationScreen); break; case 10: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break; #if ENABLED(BACKLASH_GCODE) case 11: GOTO_SCREEN(BacklashCompensationScreen); break; #endif #if ENABLED(LIN_ADVANCE) case 12: GOTO_SCREEN(LinearAdvanceScreen); break; #endif case 13: GOTO_SCREEN(InterfaceSettingsScreen); break; case 14: GOTO_SCREEN(RestoreFailsafeDialogBox); break; default: return false; } return true; } #endif // FTDI_BIO_ADVANCED_SETTINGS_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.cpp
C++
agpl-3.0
4,676
/*********************** * advanced_settings.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 FTDI_BIO_ADVANCED_SETTINGS_MENU #define FTDI_BIO_ADVANCED_SETTINGS_MENU_CLASS AdvancedSettingsMenu class AdvancedSettingsMenu : public BaseScreen, public CachedScreen<ADVANCED_SETTINGS_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/advanced_settings.h
C++
agpl-3.0
1,722
/************************ * confirm_home_xyz.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 FTDI_BIO_CONFIRM_HOME_E using namespace FTDI; void BioConfirmHomeE::onRedraw(draw_mode_t) { drawMessage(GET_TEXT_F(MSG_HOME_E_WARNING)); drawYesNoButtons(1); } bool BioConfirmHomeE::onTouchEnd(uint8_t tag) { switch (tag) { case 1: #if defined(AXIS_LEVELING_COMMANDS) && defined(PARK_AND_RELEASE_COMMANDS) SpinnerDialogBox::enqueueAndWait(F( "G28 E\n" AXIS_LEVELING_COMMANDS "\n" PARK_AND_RELEASE_COMMANDS )); #endif current_screen.forget(); break; case 2: GOTO_SCREEN(StatusScreen); break; default: return DialogBoxBaseClass::onTouchEnd(tag); } return true; } #endif // FTDI_BIO_CONFIRM_HOME_E
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.cpp
C++
agpl-3.0
2,171
/******************** * confirm_home_e.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 FTDI_BIO_CONFIRM_HOME_E #define FTDI_BIO_CONFIRM_HOME_E_CLASS BioConfirmHomeE class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_e.h
C++
agpl-3.0
1,665
/************************ * confirm_home_xyz.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 FTDI_BIO_CONFIRM_HOME_XYZ using namespace FTDI; void BioConfirmHomeXYZ::onRedraw(draw_mode_t) { drawMessage(GET_TEXT_F(MSG_HOME_XYZ_WARNING)); drawYesNoButtons(1); } bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) { switch (tag) { case 1: #ifdef PARK_AND_RELEASE_COMMANDS SpinnerDialogBox::enqueueAndWait(F( "G28\n" PARK_AND_RELEASE_COMMANDS )); #endif current_screen.forget(); break; case 2: GOTO_SCREEN(StatusScreen); break; default: return DialogBoxBaseClass::onTouchEnd(tag); } return true; } #endif // FTDI_BIO_CONFIRM_HOME_XYZ
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.cpp
C++
agpl-3.0
2,098
/********************** * confirm_home_xyz.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 FTDI_BIO_CONFIRM_HOME_XYZ #define FTDI_BIO_CONFIRM_HOME_XYZ_CLASS BioConfirmHomeXYZ class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/confirm_home_xyz.h
C++
agpl-3.0
1,679
/***************** * main_menu.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 FTDI_BIO_MAIN_MENU using namespace FTDI; using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 10 void MainMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)) .tag(0); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.cmd(COLOR_RGB(bg_text_enabled)) .font(font_large).text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_MAIN_MENU)) .colors(normal_btn) .font(font_medium) .tag(2).button(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_MOVE_TO_HOME)) .tag(3).button(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_RAISE_PLUNGER)) .tag(4).button(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_RELEASE_XY_AXIS)) .tag(5).button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) .tag(6).button(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BED_TEMPERATURE)) .tag(7).button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_INTERFACE)) .tag(8).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .tag(9).button(BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) .tag(1).button(BTN_POS(1,10), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } bool MainMenu::onTouchEnd(uint8_t tag) { using namespace ExtUI; const bool e_homed = isAxisPositionKnown(E0); switch (tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: GOTO_SCREEN(BioConfirmHomeXYZ); break; case 3: SpinnerDialogBox::enqueueAndWait(e_homed ? F("G0 E0 F120") : F("G112")); break; case 4: StatusScreen::unlockMotors(); break; #ifdef AXIS_LEVELING_COMMANDS case 5: SpinnerDialogBox::enqueueAndWait(F(AXIS_LEVELING_COMMANDS)); break; #endif case 6: GOTO_SCREEN(TemperatureScreen); break; case 7: GOTO_SCREEN(InterfaceSettingsScreen); break; case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; case 9: GOTO_SCREEN(AboutScreen); break; default: return false; } return true; } #endif // FTDI_BIO_MAIN_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.cpp
C++
agpl-3.0
3,847
/***************** * main_menu.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/>. * ****************************************************************************/ #pragma once #define FTDI_BIO_MAIN_MENU #define FTDI_BIO_MAIN_MENU_CLASS MainMenu class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/main_menu.h
C++
agpl-3.0
1,641
/*************************** * printing_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 FTDI_BIO_PRINTING_DIALOG_BOX using namespace FTDI; using namespace ExtUI; using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 9 void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *cmsg) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(COLOR_RGB(bg_text_enabled)) .tag(0); draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), cmsg, OPT_CENTER, font_large); } } void BioPrintingDialogBox::draw_progress(draw_mode_t what) { if (what & FOREGROUND) { CommandProcessor cmd; cmd.font(font_large) .text(BTN_POS(1,1), BTN_SIZE(2,2), isPrinting() ? F("Printing...") : F("Finished.")) .tag(1) .font(font_xlarge); draw_circular_progress(cmd, BTN_POS(1,4), BTN_SIZE(2,3), getProgress_percent(), theme_dark, theme_darkest); } } void BioPrintingDialogBox::draw_time_remaining(draw_mode_t what) { if (what & FOREGROUND) { const uint32_t elapsed = getProgress_seconds_elapsed(); const uint8_t hrs = elapsed/3600; const uint8_t min = (elapsed/60)%60; char time_str[10]; sprintf_P(time_str, PSTR("%02dh %02dm"), hrs, min); CommandProcessor cmd; cmd.font(font_large) .text(BTN_POS(1,7), BTN_SIZE(2,2), time_str); } } void BioPrintingDialogBox::draw_interaction_buttons(draw_mode_t what) { if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) .colors(isPrinting() ? action_btn : normal_btn) .tag(2).button(BTN_POS(1,9), BTN_SIZE(1,1), F("Menu")) .enabled(isPrinting() ? TERN0(HAS_MEDIA, isPrintingFromMedia()) : 1) .tag(3) .colors(isPrinting() ? normal_btn : action_btn) .button(BTN_POS(2,9), BTN_SIZE(1,1), isPrinting() ? F("Cancel") : F("Back")); } } void BioPrintingDialogBox::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { draw_progress(FOREGROUND); draw_time_remaining(FOREGROUND); draw_interaction_buttons(FOREGROUND); } } bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_SCREEN(FeedratePercentScreen); break; case 2: GOTO_SCREEN(TuneMenu); break; case 3: if (isPrinting()) GOTO_SCREEN(ConfirmAbortPrintDialogBox); else GOTO_SCREEN(StatusScreen); break; default: return false; } return true; } void BioPrintingDialogBox::setStatusMessage(FSTR_P fmsg) { #ifdef __AVR__ char buff[strlen_P(FTOP(fmsg)) + 1]; strcpy_P(buff, FTOP(fmsg)); setStatusMessage(buff); #else setStatusMessage(FTOP(fmsg)); #endif } void BioPrintingDialogBox::setStatusMessage(const char *cmsg) { CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)); draw_status_message(BACKGROUND, cmsg); draw_progress(BACKGROUND); draw_time_remaining(BACKGROUND); draw_interaction_buttons(BACKGROUND); storeBackground(); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("New status message: ", cmsg); #endif if (AT_SCREEN(BioPrintingDialogBox)) current_screen.onRefresh(); } void BioPrintingDialogBox::onIdle() { reset_menu_timeout(); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); } BaseScreen::onIdle(); } void BioPrintingDialogBox::show() { GOTO_SCREEN(BioPrintingDialogBox); } #endif // FTDI_BIO_PRINTING_DIALOG_BOX
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.cpp
C++
agpl-3.0
4,860
/************************* * printing_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 FTDI_BIO_PRINTING_DIALOG_BOX #define FTDI_BIO_PRINTING_DIALOG_BOX_CLASS BioPrintingDialogBox class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCREEN_CACHE,PRINTING_SCREEN_DL_SIZE> { private: static void draw_status_message(draw_mode_t, const char * const); static void draw_progress(draw_mode_t); static void draw_time_remaining(draw_mode_t); static void draw_interaction_buttons(draw_mode_t); public: static void onRedraw(draw_mode_t); static void show(); static void setStatusMessage(const char *); static void setStatusMessage(FSTR_P); static void onIdle(); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/printing_dialog_box.h
C++
agpl-3.0
2,110
/************* * screens.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/>. * ****************************************************************************/ /********************************* DL CACHE SLOTS ******************************/ // In order to reduce SPI traffic, we cache display lists (DL) in RAMG. This // is done using the CLCD::DLCache class, which takes a unique ID for each // cache location. These IDs are defined here: enum { STATUS_SCREEN_CACHE, MENU_SCREEN_CACHE, TUNE_SCREEN_CACHE, ALERT_BOX_CACHE, SPINNER_CACHE, ADVANCED_SETTINGS_SCREEN_CACHE, TEMPERATURE_SCREEN_CACHE, STEPS_SCREEN_CACHE, MAX_FEEDRATE_SCREEN_CACHE, MAX_VELOCITY_SCREEN_CACHE, MAX_ACCELERATION_SCREEN_CACHE, DEFAULT_ACCELERATION_SCREEN_CACHE, FLOW_PERCENT_SCREEN_CACHE, ZOFFSET_SCREEN_CACHE, STEPPER_CURRENT_SCREEN_CACHE, STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE, PRINTING_SCREEN_CACHE, FILES_SCREEN_CACHE, INTERFACE_SETTINGS_SCREEN_CACHE, INTERFACE_SOUNDS_SCREEN_CACHE, LOCK_SCREEN_CACHE, DISPLAY_TIMINGS_SCREEN_CACHE }; // To save MCU RAM, the status message is "baked" in to the status screen // cache, so we reserve a large chunk of memory for the DL cache #define STATUS_SCREEN_DL_SIZE 4096 #define ALERT_BOX_DL_SIZE 3072 #define SPINNER_DL_SIZE 3072 #define FILE_SCREEN_DL_SIZE 4160 #define PRINTING_SCREEN_DL_SIZE 2048 /************************* MENU SCREEN DECLARATIONS *************************/ #include "../generic/base_screen.h" #include "../generic/base_numeric_adjustment_screen.h" #include "../generic/dialog_box_base_class.h" #include "../generic/boot_screen.h" #include "../generic/about_screen.h" #include "../generic/kill_screen.h" #include "../generic/alert_dialog_box.h" #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" #include "../generic/move_axis_screen.h" #include "../generic/steps_screen.h" #include "../generic/feedrate_percent_screen.h" #include "../generic/max_velocity_screen.h" #include "../generic/max_acceleration_screen.h" #include "../generic/default_acceleration_screen.h" #include "../generic/temperature_screen.h" #include "../generic/interface_sounds_screen.h" #include "../generic/interface_settings_screen.h" #include "../generic/lock_screen.h" #include "../generic/endstop_state_screen.h" #include "../generic/display_tuning_screen.h" #include "../generic/media_player_screen.h" #include "../generic/statistics_screen.h" #include "../generic/stepper_current_screen.h" #include "../generic/stepper_bump_sensitivity_screen.h" #include "../generic/leveling_menu.h" #include "../generic/z_offset_screen.h" #include "../generic/files_screen.h" #include "status_screen.h" #include "main_menu.h" #include "tune_menu.h" #include "advanced_settings.h" #include "printing_dialog_box.h" #include "confirm_home_xyz.h" #include "confirm_home_e.h"
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/screens.h
C
agpl-3.0
4,389
/********************* * status_screen.cpp * *********************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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 FTDI_BIO_STATUS_SCREEN #if ENABLED(TOUCH_UI_PORTRAIT) #include "ui_portrait.h" #else #include "ui_landscape.h" #endif #define GRID_COLS 2 #define GRID_ROWS 9 #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) const uint8_t shadow_depth = 5; const float max_speed = 1.00; const float min_speed = 0.02; const float emax_speed = 2.00; const float emin_speed = 0.70; using namespace FTDI; using namespace Theme; using namespace ExtUI; float StatusScreen::increment; bool StatusScreen::jog_xy; bool StatusScreen::fine_motion; void StatusScreen::unlockMotors() { injectCommands(F("M84 XY")); jog_xy = false; } void StatusScreen::draw_temperature(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); int16_t x, y, h, v; cmd.tag(15); if (what & BACKGROUND) { cmd.cmd(COLOR_RGB(bg_color)); // The LulzBot Bio shows the temperature for // the bed. #if ENABLED(TOUCH_UI_PORTRAIT) // Draw touch surfaces ui.bounds(POLY(target_temp), x, y, h, v); cmd.rectangle(x, y, h, v); ui.bounds(POLY(actual_temp), x, y, h, v); cmd.rectangle(x, y, h, v); #else ui.bounds(POLY(bed_temp), x, y, h, v); cmd.rectangle(x, y, h, v); #endif ui.bounds(POLY(bed_icon), x, y, h, v); cmd.rectangle(x, y, h, v); // Draw bed icon cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info)) .cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info)) .cmd(BITMAP_SIZE (Bed_Heat_Icon_Info)) .cmd(COLOR_RGB(shadow_rgb)) .icon (x + 2, y + 2, h, v, Bed_Heat_Icon_Info, icon_scale * 2) .cmd(COLOR_RGB(bg_text_enabled)) .icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2); #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); // Restore font bitmap handles #endif } if (what & FOREGROUND) { char str[15]; cmd.cmd(COLOR_RGB(bg_text_enabled)); cmd.font(font_medium); #if ENABLED(TOUCH_UI_PORTRAIT) if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) format_temp(str, getTargetTemp_celsius(BED)); else strcpy_P(str, GET_TEXT(MSG_BED)); ui.bounds(POLY(target_temp), x, y, h, v); cmd.text(x, y, h, v, str); format_temp(str, getActualTemp_celsius(BED)); ui.bounds(POLY(actual_temp), x, y, h, v); cmd.text(x, y, h, v, str); #else if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) format_temp_and_temp(str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED)); else format_temp_and_idle(str, getActualTemp_celsius(BED)); ui.bounds(POLY(bed_temp), x, y, h, v); cmd.text(x, y, h, v, str); #endif } } void StatusScreen::draw_syringe(draw_mode_t what) { int16_t x, y, h, v; const float fill_level = ( #ifdef E_MAX_POS 1.0 - min(1.0, max(0.0, getAxisPosition_mm(E0) / E_MAX_POS)) #else 0.75 #endif ); const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)); 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 && e_homed) { // 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 StatusScreen::draw_arrows(draw_mode_t what) { const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)), z_homed = isAxisPositionKnown(Z); CommandProcessor cmd; PolyUI ui(cmd, what); ui.button_fill (fill_rgb); ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); constexpr uint8_t style = PolyUI::REGULAR; if ((what & BACKGROUND) || jog_xy) { ui.button(1, POLY(x_neg), style); ui.button(2, POLY(x_pos), style); ui.button(3, POLY(y_neg), style); ui.button(4, POLY(y_pos), style); } if ((what & BACKGROUND) || z_homed) { ui.button(5, POLY(z_neg), style); ui.button(6, POLY(z_pos), style); } if ((what & BACKGROUND) || e_homed) { ui.button(7, POLY(e_neg), style); ui.button(8, POLY(e_pos), style); } } void StatusScreen::draw_fine_motion(draw_mode_t what) { int16_t x, y, h, v; CommandProcessor cmd; PolyUI ui(cmd, what); cmd.font( #if ENABLED(TOUCH_UI_PORTRAIT) font_medium #else font_small #endif ) .tag(16); if (what & BACKGROUND) { ui.bounds(POLY(fine_label), x, y, h, v); cmd.cmd(COLOR_RGB(bg_text_enabled)) .text(x, y, h, v, GET_TEXT_F(MSG_FINE_MOTION)); } if (what & FOREGROUND) { ui.bounds(POLY(fine_toggle), x, y, h, v); cmd.colors(ui_toggle) .toggle2(x, y, h, v, GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), fine_motion); } } void StatusScreen::draw_overlay_icons(draw_mode_t what) { const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)), z_homed = isAxisPositionKnown(Z); CommandProcessor cmd; PolyUI ui(cmd, what); if (what & FOREGROUND) { ui.button_fill (fill_rgb); ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); constexpr uint8_t style = PolyUI::REGULAR; if (!jog_xy) ui.button(12, POLY(padlock), style); if (!e_homed) ui.button(13, POLY(home_e), style); if (!z_homed) ui.button(14, POLY(home_z), style); } } void StatusScreen::draw_buttons(draw_mode_t what) { int16_t x, y, h, v; const bool has_media = isMediaInserted() && !isPrintingFromMedia(); CommandProcessor cmd; PolyUI ui(cmd, what); ui.bounds(POLY(usb_btn), x, y, h, v); cmd.font(font_medium) .colors(normal_btn) .enabled(has_media) .colors(has_media ? action_btn : normal_btn) .tag(9).button(x, y, h, v, isPrintingFromMedia() ? GET_TEXT_F(MSG_PRINTING) : GET_TEXT_F(MSG_BUTTON_MEDIA) ); ui.bounds(POLY(menu_btn), x, y, h, v); cmd.colors(!has_media ? action_btn : normal_btn).tag(10).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_MENU)); } void StatusScreen::loadBitmaps() { // Load the bitmaps for the status screen constexpr uint32_t base = ftdi_memory_map::RAM_G; CLCD::mem_write_pgm(base + Bed_Heat_Icon_Info.RAMG_offset, Bed_Heat_Icon, sizeof(Bed_Heat_Icon)); // Load fonts for internationalization #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_data(base + UTF8_FONT_OFFSET); #endif } void StatusScreen::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .tag(0); } draw_syringe(what); draw_temperature(what); draw_arrows(what); draw_overlay_icons(what); draw_buttons(what); draw_fine_motion(what); } bool StatusScreen::onTouchStart(uint8_t) { increment = 0; return true; } bool StatusScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: case 2: case 3: case 4: case 12: if (!jog_xy) { jog_xy = true; injectCommands(F("M17")); } jog({ 0, 0, 0 }); break; case 5: case 6: jog({ 0, 0, 0 }); break; case 9: GOTO_SCREEN(FilesScreen); break; case 10: GOTO_SCREEN(MainMenu); break; case 13: GOTO_SCREEN(BioConfirmHomeE); break; case 14: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break; case 15: GOTO_SCREEN(TemperatureScreen); break; case 16: fine_motion = !fine_motion; break; default: return false; } // If a passcode is enabled, the LockScreen will prevent the // user from proceeding. LockScreen::check_passcode(); return true; } bool StatusScreen::onTouchHeld(uint8_t tag) { if (tag >= 1 && tag <= 4 && !jog_xy) return false; const float s = min_speed + (fine_motion ? 0 : (max_speed - min_speed) * sq(increment)); switch (tag) { case 1: jog({-s, 0, 0}); break; case 2: jog({ s, 0, 0}); break; case 4: jog({ 0, -s, 0}); break; // NOTE: Y directions inverted because bed rather than needle moves case 3: jog({ 0, s, 0}); break; case 5: jog({ 0, 0, -s}); break; case 6: jog({ 0, 0, s}); break; case 7: case 8: { if (ExtUI::isMoving()) return false; const feedRate_t feedrate = emin_speed + (fine_motion ? 0 : (emax_speed - emin_speed) * sq(increment)); const float increment = 0.25 * feedrate * (tag == 7 ? -1 : 1); MoveAxisScreen::setManualFeedrate(E0, feedrate); UI_INCREMENT(AxisPosition_mm, E0); current_screen.onRefresh(); break; } default: return false; } increment = min(1.0f, increment + 0.1f); return false; } void StatusScreen::setStatusMessage(FSTR_P fstr) { BioPrintingDialogBox::setStatusMessage(fstr); } void StatusScreen::setStatusMessage(const char * const str) { BioPrintingDialogBox::setStatusMessage(str); } void StatusScreen::onIdle() { reset_menu_timeout(); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); if (isPrintingFromMedia()) BioPrintingDialogBox::show(); refresh_timer.start(); } } #endif // FTDI_BIO_STATUS_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.cpp
C++
agpl-3.0
10,962
/********************* * status_screen.cpp * *********************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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 FTDI_BIO_STATUS_SCREEN #define FTDI_BIO_STATUS_SCREEN_CLASS StatusScreen class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE> { private: static float increment; static bool jog_xy; static bool fine_motion; 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); public: static void loadBitmaps(); static void unlockMotors(); static void setStatusMessage(const char *); static void setStatusMessage(FSTR_P); static void onRedraw(draw_mode_t); static bool onTouchStart(uint8_t tag); static bool onTouchHeld(uint8_t tag); static bool onTouchEnd(uint8_t tag); static void onIdle(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/status_screen.h
C++
agpl-3.0
2,462
/***************** * tune_menu.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 FTDI_BIO_TUNE_MENU using namespace FTDI; using namespace Theme; using namespace ExtUI; #define GRID_COLS 2 #define GRID_ROWS 8 void TuneMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0) .font(font_large) .text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_MENU)); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) .enabled( isPrinting()).tag(2).button(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_SPEED)) .tag(3).button(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_BED_TEMPERATURE)) .enabled(TERN_(BABYSTEPPING, true)) .tag(4).button(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_NUDGE_NOZZLE)) .enabled(!isPrinting()).tag(5).button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_MOVE_TO_HOME)) .enabled(!isPrinting()).tag(6).button(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_RAISE_PLUNGER)) .enabled(!isPrinting()).tag(7).button(BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_RELEASE_XY_AXIS)) .colors(action_btn) .tag(1).button(BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } bool TuneMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; case 2: GOTO_SCREEN(FeedratePercentScreen); break; case 3: GOTO_SCREEN(TemperatureScreen); break; case 4: GOTO_SCREEN(NudgeNozzleScreen); break; case 5: GOTO_SCREEN(BioConfirmHomeXYZ); break; case 6: SpinnerDialogBox::enqueueAndWait(F("G0 E0 F120")); break; case 7: StatusScreen::unlockMotors(); break; default: return false; } return true; } #endif // FTDI_BIO_TUNE_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.cpp
C++
agpl-3.0
3,434
/*************** * tune_menu.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 FTDI_BIO_TUNE_MENU #define FTDI_BIO_TUNE_MENU_CLASS TuneMenu class TuneMenu : public BaseScreen, public CachedScreen<TUNE_SCREEN_CACHE> { private: static void pausePrint(); static void resumePrint(); public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/tune_menu.h
C++
agpl-3.0
1,707
/****************** * ui_landscape.h * ******************/ /**************************************************************************** * 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/>. * ****************************************************************************/ /** * This file was auto-generated using "svg2cpp.py" * * The encoding consists of x,y pairs with the min and max scaled to * 0x0000 and 0xFFFE. A single 0xFFFF in the data stream indicates the * start of a new closed path. */ #pragma once constexpr float x_min = 0.000000; constexpr float x_max = 480.000000; constexpr float y_min = 0.000000; constexpr float y_max = 272.000000; const PROGMEM uint16_t z_neg[] = {0x7950, 0x51EA, 0x824E, 0x51EA, 0x824E, 0x71E2, 0x86CD, 0x71E2, 0x7DCF, 0x81DF, 0x74D1, 0x71E2, 0x7950, 0x71E2, 0x7950, 0x51EA}; const PROGMEM uint16_t z_pos[] = {0x7950, 0x41EE, 0x824E, 0x41EE, 0x824E, 0x21F5, 0x86CD, 0x21F5, 0x7DCF, 0x11F9, 0x74D0, 0x21F5, 0x7950, 0x21F5, 0x7950, 0x41EE}; const PROGMEM uint16_t y_neg[] = {0x3479, 0x56CF, 0x3EC6, 0x56CF, 0x3747, 0x7281, 0x3C6D, 0x7281, 0x2E61, 0x8059, 0x27D4, 0x7281, 0x2CFA, 0x7281, 0x3479, 0x56CF}; const PROGMEM uint16_t y_pos[] = {0x3BF9, 0x3B1D, 0x4645, 0x3B1D, 0x4DC4, 0x1F6B, 0x52EB, 0x1F6B, 0x4C5E, 0x1192, 0x3E52, 0x1F6B, 0x4378, 0x1F6B, 0x3BF9, 0x3B1D}; const PROGMEM uint16_t x_neg[] = {0x350E, 0x4209, 0x314E, 0x4FE2, 0x1CB5, 0x4FE2, 0x1AD6, 0x56CF, 0x1449, 0x48F6, 0x2255, 0x3B1D, 0x2075, 0x4209, 0x350E, 0x4209}; const PROGMEM uint16_t x_pos[] = {0x498C, 0x4209, 0x45CC, 0x4FE2, 0x5A65, 0x4FE2, 0x5885, 0x56CF, 0x6691, 0x48F6, 0x6004, 0x3B1D, 0x5E25, 0x4209, 0x498C, 0x4209}; const PROGMEM uint16_t syringe_fluid[] = {0xB4E9, 0x78BE, 0xBB12, 0x7C44, 0xBDE3, 0x7C44, 0xC426, 0x78BE, 0xC426, 0x250D, 0xB4E9, 0x250D, 0xB4E9, 0x78BE}; const PROGMEM uint16_t syringe[] = {0xB8AD, 0x6BB1, 0xB8AD, 0x6E0C, 0xBE02, 0x6E0C, 0xBE02, 0x6BB1, 0xFFFF, 0xB8AD, 0x6248, 0xB8AD, 0x64A2, 0xBE02, 0x64A2, 0xBE02, 0x6248, 0xFFFF, 0xB8AD, 0x58DF, 0xB8AD, 0x5B39, 0xBE02, 0x5B39, 0xBE02, 0x58DF, 0xFFFF, 0xB8AD, 0x4F75, 0xB8AD, 0x51D0, 0xBE02, 0x51D0, 0xBE02, 0x4F75, 0xFFFF, 0xB8AD, 0x460C, 0xB8AD, 0x4866, 0xBE02, 0x4866, 0xBE02, 0x460C, 0xFFFF, 0xB8AD, 0x3CA3, 0xB8AD, 0x3EFD, 0xBE02, 0x3EFD, 0xBE02, 0x3CA3, 0xFFFF, 0xB8AD, 0x3339, 0xB8AD, 0x3594, 0xBE02, 0x3594, 0xBE02, 0x3339, 0xFFFF, 0xB396, 0x110A, 0xB396, 0x1818, 0xB995, 0x1818, 0xB995, 0x22AD, 0xB396, 0x22AD, 0xB396, 0x7ADA, 0xB995, 0x7E61, 0xB995, 0x88F5, 0xBB95, 0x88F5, 0xBB95, 0xA8B4, 0xBD94, 0xAC3B, 0xBD94, 0x88F5, 0xBF94, 0x88F5, 0xBF94, 0x7E61, 0xC593, 0x7ADA, 0xC593, 0x22AD, 0xBF94, 0x22AD, 0xBF94, 0x1818, 0xC593, 0x1818, 0xC593, 0x110A, 0xFFFF, 0xBB95, 0x1818, 0xBD94, 0x1818, 0xBD94, 0x22AD, 0xBB95, 0x22AD, 0xBB95, 0x1818, 0xFFFF, 0xB596, 0x2634, 0xC393, 0x2634, 0xC393, 0x7753, 0xBD94, 0x7ADA, 0xBB95, 0x7ADA, 0xB596, 0x7753, 0xB596, 0x2634}; const PROGMEM uint16_t syringe_outline[] = {0xB396, 0x110A, 0xB396, 0x1818, 0xB995, 0x1818, 0xB995, 0x22AD, 0xB396, 0x22AD, 0xB396, 0x7ADA, 0xB995, 0x7E61, 0xB995, 0x88F5, 0xBB95, 0x88F5, 0xBB95, 0xA8B4, 0xBD94, 0xAC3B, 0xBD94, 0x88F5, 0xBF94, 0x88F5, 0xBF94, 0x7E61, 0xC593, 0x7ADA, 0xC593, 0x22AD, 0xBF94, 0x22AD, 0xBF94, 0x1818, 0xC593, 0x1818, 0xC593, 0x110A, 0xB396, 0x110A}; const PROGMEM uint16_t padlock[] = {0x3FE3, 0x2A04, 0x3D34, 0x2AF9, 0x3AFF, 0x2D93, 0x397D, 0x316D, 0x38E8, 0x3626, 0x38E8, 0x3A14, 0x39B3, 0x3C8F, 0x3B50, 0x3C8F, 0x3C1C, 0x3A14, 0x3C1C, 0x363C, 0x3C6B, 0x33A9, 0x3D3A, 0x3193, 0x3E6C, 0x302D, 0x3FE3, 0x2FAA, 0x415A, 0x302D, 0x428C, 0x3192, 0x435B, 0x33A8, 0x43AB, 0x363C, 0x43AB, 0x4492, 0x38C3, 0x4492, 0x3741, 0x45AC, 0x36A1, 0x4856, 0x36A1, 0x5C41, 0x3741, 0x5EEC, 0x38C3, 0x6005, 0x4703, 0x6005, 0x4886, 0x5EEC, 0x4925, 0x5C41, 0x4925, 0x4856, 0x4886, 0x45AC, 0x4703, 0x4492, 0x46DE, 0x362B, 0x4649, 0x316D, 0x44C7, 0x2D92, 0x4292, 0x2AF9}; const PROGMEM uint16_t home_z[] = {0x80BB, 0x2B43, 0x712C, 0x46B9, 0x750F, 0x46B9, 0x750F, 0x622F, 0x7CD7, 0x622F, 0x7CD7, 0x5474, 0x849F, 0x5474, 0x849F, 0x622F, 0x8C67, 0x622F, 0x8C67, 0x46B9, 0x904B, 0x46B9, 0x8A48, 0x3C1D, 0x8A48, 0x2ECD, 0x8664, 0x2ECD, 0x8664, 0x3540}; const PROGMEM uint16_t usb_btn[] = {0x0558, 0xC0D6, 0x3BDB, 0xC0D6, 0x3BDB, 0xF431, 0x0558, 0xF431, 0x0558, 0xC0D6}; const PROGMEM uint16_t menu_btn[] = {0x416B, 0xC0D6, 0x77EE, 0xC0D6, 0x77EE, 0xF431, 0x416B, 0xF431, 0x416B, 0xC0D6}; const PROGMEM uint16_t e_pos[] = {0xE04E, 0x5E7B, 0xE94C, 0x5E7B, 0xE94C, 0x7E74, 0xEDCB, 0x7E74, 0xE4CD, 0x8E70, 0xDBCF, 0x7E74, 0xE04E, 0x7E74, 0xE04E, 0x5E7B}; const PROGMEM uint16_t e_neg[] = {0xE04E, 0x4E7F, 0xE94C, 0x4E7F, 0xE94C, 0x2E87, 0xEDCB, 0x2E87, 0xE4CD, 0x1E8A, 0xDBCF, 0x2E87, 0xE04E, 0x2E87, 0xE04E, 0x4E7F}; const PROGMEM uint16_t home_e[] = {0xD705, 0x3885, 0xC775, 0x53FB, 0xCB59, 0x53FB, 0xCB59, 0x6F71, 0xD321, 0x6F71, 0xD321, 0x61B6, 0xDAE9, 0x61B6, 0xDAE9, 0x6F71, 0xE2B1, 0x6F71, 0xE2B1, 0x53FB, 0xE695, 0x53FB, 0xE092, 0x495F, 0xE092, 0x3C0E, 0xDCAE, 0x3C0E, 0xDCAE, 0x4281}; const PROGMEM uint16_t fine_label[] = {0x0D92, 0x9444, 0x5211, 0x9444, 0x5211, 0xA9EA, 0x0D92, 0xA9EA}; const PROGMEM uint16_t fine_toggle[] = {0x56E7, 0x9444, 0x8007, 0x9444, 0x8007, 0xA9EA, 0x56E7, 0xA9EA}; const PROGMEM uint16_t h1_temp[] = {0x9C2B, 0xDD3B, 0xBBDE, 0xDD3B, 0xBBDE, 0xFA57, 0x9C2B, 0xFA57}; const PROGMEM uint16_t h1_label[] = {0x9C2B, 0xBE8F, 0xBBDC, 0xBE8F, 0xBBDC, 0xDBAA, 0x9C2B, 0xDBAA}; const PROGMEM uint16_t h0_temp[] = {0x7BD0, 0xDD3B, 0x9B83, 0xDD3B, 0x9B83, 0xFA57, 0x7BD0, 0xFA57}; const PROGMEM uint16_t h0_label[] = {0x7BD0, 0xBE8F, 0x9B83, 0xBE8F, 0x9B83, 0xDBAA, 0x7BD0, 0xDBAA}; const PROGMEM uint16_t h2_temp[] = {0xBC86, 0xDD3B, 0xDC39, 0xDD3B, 0xDC39, 0xFA57, 0xBC86, 0xFA57}; const PROGMEM uint16_t h2_label[] = {0xBC86, 0xBE8F, 0xDC37, 0xBE8F, 0xDC37, 0xDBAA, 0xBC86, 0xDBAA}; const PROGMEM uint16_t h3_temp[] = {0xDCE2, 0xDD0D, 0xFC95, 0xDD0D, 0xFC95, 0xFA28, 0xDCE2, 0xFA28}; const PROGMEM uint16_t h3_label[] = {0xDCE2, 0xBE60, 0xFC92, 0xBE60, 0xFC92, 0xDB7C, 0xDCE2, 0xDB7C}; const PROGMEM uint16_t actual_temp[] = {0xCDF6, 0xD037, 0xF7CA, 0xD037, 0xF7CA, 0xF424, 0xCDF6, 0xF424}; const PROGMEM uint16_t bed_icon[] = {0xCDF6, 0xA5CC, 0xF7CA, 0xA5CC, 0xF7CA, 0xC9B9, 0xCDF6, 0xC9B9};
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/ui_landscape.h
C++
agpl-3.0
7,065
/***************** * ui_portrait.h * *****************/ /**************************************************************************** * 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/>. * ****************************************************************************/ /** * This file was auto-generated using "svg2cpp.py" * * The encoding consists of x,y pairs with the min and max scaled to * 0x0000 and 0xFFFE. A single 0xFFFF in the data stream indicates the * start of a new closed path. */ #pragma once constexpr float x_min = 0.000000; constexpr float x_max = 272.000000; constexpr float y_min = 0.000000; constexpr float y_max = 480.000000; const PROGMEM uint16_t z_neg[] = {0xC9B1, 0x96B3, 0xD990, 0x96B3, 0xD990, 0xA8D0, 0xE17F, 0xA8D0, 0xD1A0, 0xB1DF, 0xC1C2, 0xA8D0, 0xC9B1, 0xA8D0, 0xC9B1, 0x96B3}; const PROGMEM uint16_t z_pos[] = {0xC9B1, 0x8DA4, 0xD990, 0x8DA4, 0xD990, 0x7B86, 0xE17F, 0x7B86, 0xD1A0, 0x7277, 0xC1C2, 0x7B86, 0xC9B1, 0x7B86, 0xC9B1, 0x8DA4}; const PROGMEM uint16_t y_neg[] = {0x5037, 0x9979, 0x6264, 0x9979, 0x5529, 0xA92A, 0x5E3F, 0xA92A, 0x4575, 0xB103, 0x39E6, 0xA92A, 0x42FC, 0xA92A, 0x5037, 0x9979}; const PROGMEM uint16_t y_pos[] = {0x5D72, 0x89C7, 0x6F9F, 0x89C7, 0x7CDA, 0x7A15, 0x85F0, 0x7A15, 0x7A61, 0x723D, 0x6197, 0x7A15, 0x6AAD, 0x7A15, 0x5D72, 0x89C7}; const PROGMEM uint16_t x_neg[] = {0x513D, 0x8DB3, 0x4AA0, 0x958C, 0x2647, 0x958C, 0x22F8, 0x9979, 0x1769, 0x91A0, 0x3033, 0x89C7, 0x2CE4, 0x8DB3, 0x513D, 0x8DB3}; const PROGMEM uint16_t x_pos[] = {0x7566, 0x8DB3, 0x6EC9, 0x958C, 0x9322, 0x958C, 0x8FD4, 0x9979, 0xA89E, 0x91A0, 0x9D0E, 0x89C7, 0x99C0, 0x8DB3, 0x7566, 0x8DB3}; const PROGMEM uint16_t syringe_fluid[] = {0x7D1D, 0x4A0F, 0x87FC, 0x4C0E, 0x8CF4, 0x4C0E, 0x9801, 0x4A0F, 0x9801, 0x1AA2, 0x7D1D, 0x1AA2, 0x7D1D, 0x4A0F}; const PROGMEM uint16_t syringe[] = {0x83C2, 0x42AA, 0x83C2, 0x43FF, 0x8D2C, 0x43FF, 0x8D2C, 0x42AA, 0xFFFF, 0x83C2, 0x3D54, 0x83C2, 0x3EAA, 0x8D2C, 0x3EAA, 0x8D2C, 0x3D54, 0xFFFF, 0x83C2, 0x37FF, 0x83C2, 0x3954, 0x8D2C, 0x3954, 0x8D2C, 0x37FF, 0xFFFF, 0x83C2, 0x32AA, 0x83C2, 0x33FF, 0x8D2C, 0x33FF, 0x8D2C, 0x32AA, 0xFFFF, 0x83C2, 0x2D54, 0x83C2, 0x2EAA, 0x8D2C, 0x2EAA, 0x8D2C, 0x2D54, 0xFFFF, 0x83C2, 0x27FF, 0x83C2, 0x2955, 0x8D2C, 0x2955, 0x8D2C, 0x27FF, 0xFFFF, 0x83C2, 0x22AA, 0x83C2, 0x23FF, 0x8D2C, 0x23FF, 0x8D2C, 0x22AA, 0xFFFF, 0x7AC7, 0x0F4B, 0x7AC7, 0x134A, 0x855B, 0x134A, 0x855B, 0x1949, 0x7AC7, 0x1949, 0x7AC7, 0x4B40, 0x855B, 0x4D40, 0x855B, 0x533F, 0x88E2, 0x533F, 0x88E2, 0x653C, 0x8C69, 0x673C, 0x8C69, 0x533F, 0x8FF0, 0x533F, 0x8FF0, 0x4D40, 0x9A85, 0x4B40, 0x9A85, 0x1949, 0x8FF0, 0x1949, 0x8FF0, 0x134A, 0x9A85, 0x134A, 0x9A85, 0x0F4B, 0xFFFF, 0x88E2, 0x134A, 0x8C69, 0x134A, 0x8C69, 0x1949, 0x88E2, 0x1949, 0x88E2, 0x134A, 0xFFFF, 0x7E4D, 0x1B49, 0x96FE, 0x1B49, 0x96FE, 0x4941, 0x8C69, 0x4B40, 0x88E2, 0x4B40, 0x7E4D, 0x4941, 0x7E4D, 0x1B49}; const PROGMEM uint16_t syringe_outline[] = {0x7AC7, 0x0F4B, 0x7AC7, 0x134A, 0x855B, 0x134A, 0x855B, 0x1949, 0x7AC7, 0x1949, 0x7AC7, 0x4B40, 0x855B, 0x4D40, 0x855B, 0x533F, 0x88E2, 0x533F, 0x88E2, 0x653C, 0x8C69, 0x673C, 0x8C69, 0x533F, 0x8FF0, 0x533F, 0x8FF0, 0x4D40, 0x9A85, 0x4B40, 0x9A85, 0x1949, 0x8FF0, 0x1949, 0x8FF0, 0x134A, 0x9A85, 0x134A, 0x9A85, 0x0F4B, 0x7AC7, 0x0F4B}; const PROGMEM uint16_t padlock[] = {0x645A, 0x8017, 0x5F9E, 0x80A1, 0x5BBA, 0x821B, 0x5911, 0x844A, 0x580A, 0x86F7, 0x580A, 0x8931, 0x5970, 0x8A98, 0x5C49, 0x8A98, 0x5DB0, 0x8931, 0x5DB0, 0x8703, 0x5E3C, 0x858E, 0x5FAA, 0x845F, 0x61C5, 0x8394, 0x645A, 0x834A, 0x66F0, 0x8394, 0x690C, 0x845F, 0x6A7A, 0x858D, 0x6B07, 0x8703, 0x6B07, 0x8F23, 0x57C8, 0x8F23, 0x551E, 0x8FC3, 0x5404, 0x9145, 0x5404, 0x9C8F, 0x551E, 0x9E11, 0x57C8, 0x9EB1, 0x70EE, 0x9EB1, 0x7398, 0x9E11, 0x74B2, 0x9C8F, 0x74B2, 0x9145, 0x7398, 0x8FC3, 0x70EE, 0x8F23, 0x70AC, 0x86FA, 0x6FA5, 0x844A, 0x6CFD, 0x821B, 0x6917, 0x80A1}; const PROGMEM uint16_t home_z[] = {0xD6C9, 0x80CC, 0xBB53, 0x905B, 0xC231, 0x905B, 0xC231, 0x9FEB, 0xCFEC, 0x9FEB, 0xCFEC, 0x9823, 0xDDA7, 0x9823, 0xDDA7, 0x9FEB, 0xEB62, 0x9FEB, 0xEB62, 0x905B, 0xF240, 0x905B, 0xE7A3, 0x8A58, 0xE7A3, 0x82CD, 0xE0C6, 0x82CD, 0xE0C6, 0x8674}; const PROGMEM uint16_t home_e[] = {0xB94F, 0x25AA, 0x9DD8, 0x353A, 0xA4B6, 0x353A, 0xA4B6, 0x44C9, 0xB271, 0x44C9, 0xB271, 0x3D02, 0xC02C, 0x3D02, 0xC02C, 0x44C9, 0xCDE7, 0x44C9, 0xCDE7, 0x353A, 0xD4C5, 0x353A, 0xCA28, 0x2F36, 0xCA28, 0x27AB, 0xC34B, 0x27AB, 0xC34B, 0x2B53}; const PROGMEM uint16_t bed_icon[] = {0x1764, 0x2C4C, 0x6135, 0x2C4C, 0x6135, 0x40A8, 0x1764, 0x40A8}; const PROGMEM uint16_t actual_temp[] = {0x1764, 0x466F, 0x6135, 0x466F, 0x6135, 0x5ACB, 0x1764, 0x5ACB}; const PROGMEM uint16_t target_temp[] = {0x1764, 0x1228, 0x6135, 0x1228, 0x6135, 0x2684, 0x1764, 0x2684}; const PROGMEM uint16_t fine_label[] = {0x1AA7, 0xC6D2, 0x9387, 0xC6D2, 0x9387, 0xD316, 0x1AA7, 0xD316}; const PROGMEM uint16_t fine_toggle[] = {0x9C10, 0xC6D2, 0xE4A3, 0xC6D2, 0xE4A3, 0xD316, 0x9C10, 0xD316}; const PROGMEM uint16_t usb_btn[] = {0x0B68, 0xE880, 0x7B1A, 0xE880, 0x7B1A, 0xF94B, 0x0B68, 0xF94B, 0x0B68, 0xE880}; const PROGMEM uint16_t menu_btn[] = {0x84E3, 0xE880, 0xF495, 0xE880, 0xF495, 0xF94B, 0x84E3, 0xF94B, 0x84E3, 0xE880}; const PROGMEM uint16_t e_pos[] = {0xC9B1, 0x3B2D, 0xD990, 0x3B2D, 0xD990, 0x4D4B, 0xE17F, 0x4D4B, 0xD1A0, 0x565A, 0xC1C2, 0x4D4B, 0xC9B1, 0x4D4B, 0xC9B1, 0x3B2D}; const PROGMEM uint16_t e_neg[] = {0xC9B1, 0x321E, 0xD990, 0x321E, 0xD990, 0x2000, 0xE17F, 0x2000, 0xD1A0, 0x16F1, 0xC1C2, 0x2000, 0xC9B1, 0x2000, 0xC9B1, 0x321E};
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/bioprinter/ui_portrait.h
C++
agpl-3.0
6,355
/**************************************************************************** * 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: <http://www.gnu.org/licenses/>. * ****************************************************************************/ /** * This file was auto-generated using "svg2cpp.pl" * * The encoding consists of x,y pairs with the min and max scaled to * 0x0000 and 0xFFFE. A single 0xFFFF in the data stream indicates the * start of a new closed path. */ #pragma once constexpr float x_min = 0.000000; constexpr float x_max = 480.000000; constexpr float y_min = 0.000000; constexpr float y_max = 272.000000; const PROGMEM uint16_t outline[] = { 0x8278, 0xC8E7, 0x7714, 0xC659, 0x6D20, 0xC0EF, 0x64D1, 0xB8D4, 0x5E5F, 0xAE2F, 0x5AF5, 0xA493, 0x58F2, 0x99F6, 0x5886, 0x8B4E, 0x590F, 0x7956, 0x5997, 0x69F3, 0x5B46, 0x5E96, 0x5E92, 0x5430, 0x6363, 0x4AF8, 0x69A4, 0x4327, 0x6F5B, 0x3E4A, 0x7871, 0x3979, 0x82A1, 0x371E, 0x8CBB, 0x3756, 0x95A1, 0x3997, 0x9D90, 0x3D88, 0xA50B, 0x43B6, 0xA6BC, 0x46C9, 0xA776, 0x4A42, 0xA669, 0x6D96, 0xA54B, 0x71E5, 0xA030, 0x7B45, 0x9ECB, 0x7CC5, 0x9B2C, 0x7E1D, 0x9717, 0x7C80, 0x9521, 0x7B11, 0x8FAD, 0x77D6, 0x8A1D, 0x7607, 0x82E0, 0x7609, 0x7CDD, 0x7812, 0x77F3, 0x7C15, 0x75EF, 0x7EC5, 0x7830, 0x8278, 0x7D94, 0x8772, 0x847F, 0x8A0B, 0x8B98, 0x89F7, 0x9127, 0x8806, 0x96AB, 0x849C, 0x9C6D, 0x81F2, 0x9F8E, 0x82E5, 0xA22C, 0x85FF, 0xA63C, 0x8D9E, 0xA78B, 0x931F, 0xA68F, 0xB5E2, 0xA5D0, 0xB944, 0xA430, 0xBC3E, 0x9E55, 0xC146, 0x94CA, 0xC660, 0x8A75, 0xC8DB, 0x8278, 0xC8E7, 0x8278, 0xC8E7 }; const PROGMEM uint16_t shadow[] = { 0x8699, 0x52F4, 0x807A, 0x5409, 0x7A89, 0x576A, 0x7583, 0x5D79, 0x7227, 0x6695, 0x714B, 0x70C7, 0x71C8, 0x75DB, 0x730A, 0x7A69, 0x7496, 0x7A0E, 0x7601, 0x787F, 0x78EF, 0x7565, 0x80E9, 0x7178, 0x8924, 0x7108, 0x914E, 0x7393, 0x9914, 0x789A, 0x9B62, 0x792D, 0x9D8A, 0x7823, 0xA0FE, 0x72DA, 0xA34C, 0x6DC9, 0xA3D7, 0x6766, 0xA42B, 0x5E98, 0xA3FD, 0x55F8, 0xA279, 0x55CE, 0xA12E, 0x578E, 0x9FE2, 0x59BB, 0x9E59, 0x5AD8, 0x9AAC, 0x5AE1, 0x9728, 0x58ED, 0x9019, 0x54A3, 0x8699, 0x52F4, 0x8699, 0x52F4, 0xFFFF, 0x5CA3, 0x849F, 0x5B93, 0x8686, 0x5B52, 0x896F, 0x5B3F, 0x8FA9, 0x5C60, 0x9D67, 0x6003, 0xA994, 0x6582, 0xB393, 0x6C3B, 0xBAC7, 0x7604, 0xC0E2, 0x8047, 0xC3D1, 0x8AB3, 0xC3DC, 0x94FB, 0xC14A, 0x9C85, 0xBD52, 0xA35D, 0xB6C2, 0xA41B, 0xABC2, 0xA460, 0xA092, 0xA416, 0x9C7C, 0xA33E, 0x9B91, 0xA20E, 0x9C3C, 0x9618, 0xA353, 0x8992, 0xA62E, 0x7CED, 0xA4E9, 0x7097, 0x9FA2, 0x6ADE, 0x9B4F, 0x65A4, 0x9557, 0x6117, 0x8DDF, 0x5D63, 0x850D, 0x5CA3, 0x849F, 0x5CA3, 0x849F }; const PROGMEM uint16_t highlight[] = { 0x861C, 0x5348, 0x8243, 0x53C6, 0x7EBF, 0x5693, 0x7C12, 0x5B55, 0x7ABE, 0x61B3, 0x7AFC, 0x6656, 0x7C42, 0x6A49, 0x7FB1, 0x7163, 0x862A, 0x7090, 0x8C99, 0x717A, 0x92E2, 0x740A, 0x98E8, 0x782A, 0x9AB3, 0x7852, 0x9C22, 0x7665, 0x9E0C, 0x7087, 0x9E69, 0x65BE, 0x9C07, 0x5BDE, 0x9319, 0x568D, 0x8E92, 0x544E, 0x89E2, 0x534D, 0x861C, 0x5348, 0x861C, 0x5348, 0xFFFF, 0x6B6A, 0x9CA0, 0x69D9, 0x9F11, 0x695E, 0xA2AD, 0x6A25, 0xAA51, 0x6DB0, 0xBBAA, 0x785A, 0xC170, 0x8372, 0xC3D0, 0x8E9F, 0xC2E2, 0x9987, 0xBEBD, 0x9CAB, 0xBCE9, 0x9EFE, 0xB9D2, 0x9E63, 0xB379, 0x9CE9, 0xAD92, 0x98DE, 0xA2B8, 0x8D7F, 0xA5FA, 0x81FE, 0xA636, 0x76A6, 0xA32E, 0x6BC5, 0x9CA0, 0x6B6A, 0x9CA0, 0x6B6A, 0x9CA0 }; const PROGMEM uint16_t stroke[] = { 0x8282, 0xC890, 0x7A14, 0xC6FB, 0x7257, 0xC3D9, 0x6B6A, 0xBF38, 0x6569, 0xB928, 0x5E84, 0xADEC, 0x5B1E, 0xA460, 0x5926, 0x99F8, 0x58A5, 0x90C0, 0x59B6, 0x6B3D, 0x5B4C, 0x5F6C, 0x5EA3, 0x549E, 0x63A2, 0x4B13, 0x6A2E, 0x430B, 0x71D8, 0x3D0C, 0x7A7A, 0x3923, 0x83D5, 0x3761, 0x8DAA, 0x37DB, 0x98A8, 0x3B38, 0xA283, 0x4193, 0xA638, 0x4620, 0xA741, 0x4B64, 0xA6C5, 0x5D20, 0xA613, 0x6E81, 0xA43A, 0x738A, 0xA01F, 0x7AE8, 0x9DE9, 0x7D0E, 0x9B69, 0x7DBD, 0x9629, 0x7B6D, 0x905C, 0x77C9, 0x8A94, 0x75BF, 0x8402, 0x7587, 0x7E52, 0x76FE, 0x79CA, 0x79CE, 0x75B1, 0x7EC7, 0x780B, 0x82C0, 0x7C5E, 0x8702, 0x8193, 0x89A9, 0x8702, 0x8AA4, 0x8C76, 0x8A18, 0x91F2, 0x8803, 0x977B, 0x8464, 0x9C8C, 0x825E, 0x9EAF, 0x82C4, 0xA0FC, 0x84BC, 0xA3C6, 0x8965, 0xA6CF, 0x8FEF, 0xA756, 0x9463, 0xA6DA, 0xA612, 0xA5DF, 0xB86B, 0xA414, 0xBBE7, 0xA03D, 0xBF7C, 0x9648, 0xC56A, 0x8B45, 0xC86E, 0x8282, 0xC890, 0x8282, 0xC890, 0xFFFF, 0x89EE, 0xC221, 0x9395, 0xBFE8, 0x9C6D, 0xBB4F, 0xA047, 0xB837, 0xA298, 0xB561, 0xA30A, 0xAA1F, 0xA34B, 0x9D6D, 0xA204, 0x9E54, 0x9820, 0xA474, 0x960F, 0xA542, 0x886E, 0xA808, 0x803F, 0xA783, 0x785E, 0xA57C, 0x703C, 0xA168, 0x691E, 0x9BB9, 0x623D, 0x92BA, 0x5D27, 0x8795, 0x5C9D, 0x868D, 0x5C4D, 0x90BE, 0x5DBC, 0x9E89, 0x6126, 0xA944, 0x6630, 0xB207, 0x6CB0, 0xB914, 0x6E6F, 0xBA8C, 0x7080, 0xBC05, 0x78E3, 0xC016, 0x8263, 0xC21E, 0x89EE, 0xC221, 0x89EE, 0xC221, 0xFFFF, 0x8CBB, 0xA14B, 0x9726, 0x9E32, 0xA086, 0x9855, 0xA324, 0x95C0, 0xA39A, 0x92E9, 0xA121, 0x8DC2, 0x9E86, 0x8984, 0x9C63, 0x88AD, 0x98A6, 0x8A73, 0x8FB6, 0x8F97, 0x86EE, 0x90FB, 0x804C, 0x8FBC, 0x7A84, 0x8C98, 0x7476, 0x85CD, 0x706D, 0x7C88, 0x6EAA, 0x7064, 0x6EFF, 0x6929, 0x7056, 0x624A, 0x73DB, 0x59D0, 0x76F3, 0x5586, 0x7AA5, 0x523E, 0x83F8, 0x4E97, 0x8B83, 0x4EA9, 0x9221, 0x50DF, 0x98F7, 0x552D, 0x9C44, 0x56AE, 0x9DAF, 0x5652, 0xA12C, 0x5116, 0xA370, 0x4C6E, 0xA381, 0x4A6D, 0xA10D, 0x4772, 0x985F, 0x41B3, 0x8EB8, 0x3E71, 0x8631, 0x3DA9, 0x7DFC, 0x3EA4, 0x7645, 0x4159, 0x6F3D, 0x45BB, 0x6952, 0x4B6F, 0x646A, 0x529B, 0x60B0, 0x5AA7, 0x5E57, 0x6375, 0x5D39, 0x6ED1, 0x5E1E, 0x7B35, 0x6120, 0x8666, 0x6620, 0x9016, 0x6D01, 0x97F7, 0x7747, 0x9E7A, 0x83D9, 0xA18C, 0x8CBB, 0xA14B, 0x8CBB, 0xA14B, 0xFFFF, 0x7481, 0x77DA, 0x793F, 0x7317, 0x7EE3, 0x701D, 0x8044, 0x6FBD, 0x81B4, 0x6F76, 0x846C, 0x6F18, 0x8E1D, 0x7044, 0x97FF, 0x75D2, 0x9B2B, 0x772F, 0x9DAF, 0x75F3, 0xA26D, 0x6D0E, 0xA2E9, 0x62B8, 0xA33C, 0x583A, 0xA31E, 0x573E, 0xA252, 0x5871, 0x9FC0, 0x5BDB, 0x9CD5, 0x5D2A, 0x9751, 0x5AEC, 0x914A, 0x5720, 0x8B83, 0x5519, 0x83E3, 0x5506, 0x7ECB, 0x56B4, 0x7A0F, 0x59E9, 0x765D, 0x5E9D, 0x73CE, 0x64A3, 0x727C, 0x6BCF, 0x7286, 0x72FD, 0x73A3, 0x78D6, 0x7481, 0x77DA, 0x7481, 0x77DA }; const PROGMEM uint16_t surface[] = { 0x8CBB, 0xA14B, 0x9726, 0x9E32, 0xA086, 0x9855, 0xA324, 0x95C0, 0xA39A, 0x92E9, 0xA121, 0x8DC2, 0x9E86, 0x8984, 0x9C63, 0x88AD, 0x98A6, 0x8A73, 0x8FB6, 0x8F97, 0x86EE, 0x90FB, 0x804C, 0x8FBC, 0x7A84, 0x8C98, 0x7476, 0x85CD, 0x706D, 0x7C88, 0x6EAA, 0x7064, 0x6EFF, 0x6929, 0x7056, 0x624A, 0x73DB, 0x59D0, 0x76F3, 0x5586, 0x7AA5, 0x523E, 0x83F8, 0x4E97, 0x8B83, 0x4EA9, 0x9221, 0x50DF, 0x98F7, 0x552D, 0x9C44, 0x56AE, 0x9DAF, 0x5652, 0xA12C, 0x5116, 0xA370, 0x4C6E, 0xA381, 0x4A6D, 0xA10D, 0x4772, 0x985F, 0x41B3, 0x8EB8, 0x3E71, 0x8631, 0x3DA9, 0x7DFC, 0x3EA4, 0x7645, 0x4159, 0x6F3D, 0x45BB, 0x6952, 0x4B6F, 0x646A, 0x529B, 0x60B0, 0x5AA7, 0x5E57, 0x6375, 0x5D39, 0x6ED1, 0x5E1E, 0x7B35, 0x6120, 0x8666, 0x6620, 0x9016, 0x6D01, 0x97F7, 0x7747, 0x9E7A, 0x83D9, 0xA18C, 0x8CBB, 0xA14B, 0x8CBB, 0xA14B }; //#define LOGO_BACKGROUND 0xF05A22 #define LOGO_BACKGROUND 0xFFFFFF #define LOGO_PAINT_PATHS \ LOGO_PAINT_PATH(0xF27121, surface) \ LOGO_PAINT_PATH(0x6B2C1B, shadow) \ LOGO_PAINT_PATH(0xBC3E26, highlight) \ LOGO_PAINT_PATH(0x3C2215, stroke)
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/_bootscreen_landscape.h
C++
agpl-3.0
8,092
/******************** * about_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" #ifdef COCOA_ABOUT_SCREEN #define GRID_COLS 4 #define GRID_ROWS 8 using namespace FTDI; using namespace Theme; using namespace ExtUI; void AboutScreen::onEntry() { BaseScreen::onEntry(); sound.play(chimes, PLAY_ASYNCHRONOUS); } void AboutScreen::onRedraw(draw_mode_t) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); #define HEADING_POS BTN_POS(1,1), BTN_SIZE(4,2) #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1) #define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1) #define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,3) #define STATS_POS BTN_POS(1,8), BTN_SIZE(2,1) #define BACK_POS BTN_POS(3,8), BTN_SIZE(2,1) char about_str[1 + strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)) #ifdef TOOLHEAD_NAME + strlen_P(TOOLHEAD_NAME) #endif ]; #ifdef TOOLHEAD_NAME // If MSG_ABOUT_TOUCH_PANEL_2 has %s, substitute in the toolhead name. // But this is optional, so squelch the compiler warning here. #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-extra-args" sprintf_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2), TOOLHEAD_NAME); #pragma GCC diagnostic pop #else strcpy_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2)); #endif draw_text_box(cmd, HEADING_POS, #ifdef MACHINE_NAME F(MACHINE_NAME) #else GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_1) #endif , OPT_CENTER, font_xlarge ); #if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) cmd.tag(3); #endif draw_text_box(cmd, FW_VERS_POS, #ifdef TOUCH_UI_VERSION F(TOUCH_UI_VERSION) #else FPSTR(getFirmwareName_str()) #endif , OPT_CENTER, font_medium); cmd.tag(0); draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium); draw_text_box(cmd, LICENSE_POS, GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny); cmd.font(font_medium); #if ENABLED(PRINTCOUNTER) cmd.colors(normal_btn) .tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU)); #endif cmd.colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } bool AboutScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; #if ENABLED(PRINTCOUNTER) case 2: GOTO_SCREEN(StatisticsScreen); break; #endif #if ALL(TOUCH_UI_DEVELOPER_MENU, FTDI_DEVELOPER_MENU) case 3: GOTO_SCREEN(DeveloperMenu); break; #endif default: return false; } return true; } #endif // COCOA_ABOUT_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/about_screen.cpp
C++
agpl-3.0
3,974
/****************** * about_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_ABOUT_SCREEN #define COCOA_ABOUT_SCREEN_CLASS AboutScreen class AboutScreen : public BaseScreen, public UncachedScreen { public: static void onEntry(); static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/about_screen.h
C++
agpl-3.0
1,660
/***************************************** * cocoa_press/advance_settings_menu.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_ADVANCED_SETTINGS_MENU using namespace FTDI; using namespace ExtUI; using namespace Theme; #define GRID_COLS 3 #define GRID_ROWS 4 #define STEPS_PER_MM_POS BTN_POS(1,1), BTN_SIZE(1,1) #define TMC_CURRENT_POS BTN_POS(2,1), BTN_SIZE(1,1) #define LIN_ADVANCE_POS BTN_POS(3,1), BTN_SIZE(1,1) #define VELOCITY_POS BTN_POS(1,2), BTN_SIZE(1,1) #define ACCELERATION_POS BTN_POS(2,2), BTN_SIZE(1,1) #define JERK_POS BTN_POS(3,2), BTN_SIZE(1,1) #define DISPLAY_POS BTN_POS(1,3), BTN_SIZE(1,1) #define INTERFACE_POS BTN_POS(2,3), BTN_SIZE(1,1) #define ENDSTOPS_POS BTN_POS(3,3), BTN_SIZE(1,1) #define RESTORE_DEFAULTS_POS BTN_POS(1,4), BTN_SIZE(2,1) #define BACK_POS BTN_POS(3,4), BTN_SIZE(1,1) void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) .tag(2) .button(STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM)) .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_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)) .tag(9) .button(INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE)) .tag(10).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) .tag(11).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: GOTO_SCREEN(StepsScreen); break; #if HAS_TRINAMIC_CONFIG case 3: GOTO_SCREEN(StepperCurrentScreen); break; #endif #if ENABLED(LIN_ADVANCE) case 4: GOTO_SCREEN(LinearAdvanceScreen); break; #endif case 5: GOTO_SCREEN(MaxVelocityScreen); break; case 6: GOTO_SCREEN(DefaultAccelerationScreen); break; case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break; case 8: GOTO_SCREEN(EndstopStatesScreen); break; case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break; case 10: GOTO_SCREEN(DisplayTuningScreen); break; case 11: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break; default: return false; } return true; } #endif // COCOA_ADVANCED_SETTINGS_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.cpp
C++
agpl-3.0
4,609
/*************************************** * cocoa_press/advance_settings_menu.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_ADVANCED_SETTINGS_MENU #define COCOA_ADVANCED_SETTINGS_MENU_CLASS AdvancedSettingsMenu class AdvancedSettingsMenu : public BaseScreen, public CachedScreen<ADVANCED_SETTINGS_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/advanced_settings_menu.h
C++
agpl-3.0
1,765
const unsigned char cocoa_press_ui[2941] PROGMEM = { 0x78, 0x9C, 0xED, 0xDD, 0x3B, 0x96, 0xA3, 0xC8, 0xB6, 0x00, 0xD0, 0xC9, 0x68, 0x28, 0x1A, 0x0A, 0x06, 0x3D, 0x8F, 0x34, 0x24, 0x83, 0x59, 0x94, 0x91, 0x8E, 0x0C, 0x30, 0x34, 0x86, 0x32, 0xCA, 0x2A, 0x03, 0x23, 0x99, 0x42, 0x8D, 0xE0, 0x62, 0xE8, 0x0A, 0x21, 0x20, 0x22, 0xF8, 0x54, 0xF6, 0xBA, 0x6F, 0x3D, 0xA5, 0x52, 0x7B, 0x1B, 0xDD, 0x29, 0x50, 0xA0, 0xA0, 0xD7, 0x39, 0xC4, 0x0F, 0xE8, 0xCB, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x48, 0x5B, 0xFF, 0x2E, 0xCB, 0xBA, 0x6E, 0x1F, 0x5D, 0x0F, 0xF8, 0x62, 0xDA, 0xF2, 0xB0, 0xDF, 0xEF, 0x06, 0xFB, 0xBC, 0xA8, 0x1F, 0x5D, 0x23, 0xF8, 0x2A, 0xCA, 0xEC, 0x96, 0x15, 0xFB, 0x2C, 0x3B, 0x1C, 0xB2, 0xAC, 0x4F, 0x94, 0xFD, 0x41, 0x8A, 0xC0, 0xE5, 0x72, 0xDA, 0x77, 0xD9, 0xF0, 0xFE, 0xEB, 0xCF, 0xE4, 0xFD, 0xD0, 0x65, 0xCC, 0xBE, 0x7C, 0x74, 0xD5, 0xE0, 0xC1, 0xEA, 0x6B, 0x76, 0x64, 0x3F, 0xFF, 0xCC, 0xBD, 0x5F, 0x77, 0xE4, 0x8F, 0xAE, 0x1D, 0x3C, 0x54, 0x71, 0xCD, 0x8E, 0x5F, 0x0B, 0xD9, 0x71, 0xCF, 0x90, 0xD3, 0xA3, 0xEB, 0x07, 0x0F, 0x94, 0xEF, 0xF6, 0xEF, 0x2B, 0xD9, 0xD1, 0x25, 0xC8, 0xEE, 0xB0, 0x5E, 0xB4, 0x29, 0x8F, 0x79, 0x96, 0xE5, 0xC7, 0x72, 0x71, 0x9C, 0x52, 0x17, 0xC7, 0xEC, 0x3A, 0x9C, 0x29, 0xAA, 0xD5, 0xD9, 0xB0, 0xA6, 0xDA, 0x2C, 0x7F, 0xEA, 0xF7, 0xAE, 0x96, 0xAF, 0xCA, 0xAB, 0x8F, 0x8D, 0x53, 0xBB, 0x1D, 0xA5, 0x1C, 0x54, 0xE9, 0xB4, 0x5C, 0x53, 0x0D, 0x7B, 0x66, 0xBB, 0x2E, 0x6D, 0x55, 0x06, 0xAA, 0xF4, 0xCC, 0xAE, 0x15, 0xCB, 0x96, 0xAA, 0x5D, 0x75, 0xA7, 0x9C, 0x6F, 0x9C, 0x32, 0x4F, 0xE6, 0xB0, 0xDB, 0x4F, 0x8D, 0xC7, 0xAF, 0xF7, 0x6E, 0x6C, 0xBE, 0xCF, 0xDE, 0x86, 0xA1, 0xC8, 0xAF, 0xFD, 0xAE, 0x58, 0x2B, 0x59, 0x77, 0x41, 0x32, 0xA8, 0xD2, 0xBD, 0x65, 0xB0, 0xF3, 0xD8, 0xFC, 0xFB, 0xF2, 0xD5, 0x5F, 0xCB, 0x1F, 0xFB, 0x9D, 0xDB, 0x09, 0x72, 0xCE, 0xB2, 0xD5, 0x03, 0x45, 0xBB, 0x92, 0x1A, 0xC4, 0xFB, 0xB2, 0xF0, 0x3F, 0xC2, 0x47, 0xBE, 0x56, 0x28, 0x38, 0xE7, 0x42, 0x86, 0x7C, 0x0B, 0x45, 0x90, 0x1E, 0xEF, 0xD3, 0xF4, 0x6E, 0x37, 0x5C, 0xEF, 0xB6, 0x5F, 0xB7, 0xAC, 0xE5, 0xC7, 0x31, 0x8E, 0xA0, 0x3C, 0x0A, 0xBD, 0x3A, 0x89, 0xAF, 0x85, 0x4E, 0xDA, 0x66, 0xF9, 0x8F, 0x8D, 0xF8, 0xBC, 0x6B, 0xD7, 0x77, 0x05, 0x4E, 0xC9, 0x81, 0x82, 0x80, 0x4E, 0xEB, 0x18, 0x1E, 0xA8, 0x4D, 0xF6, 0x05, 0x8D, 0x68, 0xB5, 0x5A, 0x28, 0x3E, 0xA3, 0xC5, 0x9C, 0xE6, 0xB9, 0x7C, 0xEC, 0xA7, 0xF4, 0xD8, 0xDF, 0xE6, 0x77, 0x7F, 0x74, 0xDE, 0xB2, 0xEE, 0x43, 0x76, 0xE8, 0x12, 0x66, 0x79, 0xFC, 0xD1, 0x64, 0xA9, 0x70, 0x20, 0x5F, 0xCD, 0xF6, 0x1E, 0x93, 0xF2, 0x6D, 0x3E, 0xFB, 0x4A, 0xB0, 0xF7, 0xFC, 0xD7, 0xF2, 0xC1, 0x6F, 0x6C, 0x9E, 0x60, 0x91, 0x1E, 0x68, 0xEA, 0x13, 0xA5, 0xF9, 0x11, 0xC6, 0x7A, 0x9A, 0x1F, 0xF9, 0x6A, 0xA9, 0xA9, 0x4C, 0x92, 0xF0, 0xDB, 0x79, 0xCB, 0x53, 0xC8, 0x77, 0xC3, 0xD8, 0xE3, 0xDA, 0x93, 0x1A, 0xB2, 0xA3, 0xD7, 0xA5, 0xC8, 0x75, 0xD3, 0x6E, 0x71, 0x86, 0x37, 0x8D, 0x9F, 0x38, 0x52, 0x66, 0x91, 0x37, 0x0F, 0xF0, 0x7F, 0x5D, 0x7E, 0x36, 0x0C, 0x3A, 0xCC, 0x23, 0x7E, 0xC1, 0x2C, 0x3F, 0xA6, 0x9F, 0x99, 0xFF, 0xCA, 0x74, 0xA4, 0xF4, 0xFC, 0xA6, 0xDA, 0xA7, 0x79, 0xBD, 0x7A, 0xB8, 0x59, 0x8F, 0x91, 0xA7, 0xD3, 0xEE, 0xF6, 0x53, 0xEB, 0xB1, 0xCF, 0xB2, 0xB7, 0x1F, 0xA1, 0xB7, 0xEB, 0x96, 0x95, 0xFC, 0x38, 0x64, 0x33, 0xD3, 0xF7, 0xE6, 0x6D, 0x4B, 0x27, 0x6A, 0x87, 0x8E, 0x5B, 0xFB, 0x97, 0x92, 0x6F, 0x76, 0x3D, 0x6E, 0xD7, 0x76, 0xC4, 0xE6, 0xF9, 0x31, 0xC6, 0xED, 0x3C, 0x3F, 0xA6, 0x23, 0xA5, 0x55, 0xA8, 0xD7, 0x0A, 0x4D, 0x59, 0x90, 0x9E, 0xD2, 0x56, 0xAD, 0x78, 0x0E, 0xC5, 0xD8, 0x7C, 0xBC, 0x77, 0xE9, 0x91, 0xFD, 0x88, 0xBD, 0x75, 0xF9, 0xF1, 0x7B, 0xA1, 0xDC, 0xD0, 0xB7, 0xC9, 0x6F, 0x13, 0x35, 0x75, 0x11, 0xC7, 0xC3, 0x10, 0x29, 0xC7, 0x2E, 0xAA, 0x9A, 0x71, 0xD0, 0xDA, 0xFC, 0x8F, 0xE5, 0xE3, 0x81, 0x78, 0xD0, 0x85, 0xDB, 0x3C, 0xC3, 0x31, 0xF0, 0xDB, 0xFB, 0x81, 0xC6, 0xAE, 0x52, 0x3D, 0x96, 0x6E, 0xAB, 0xF4, 0x48, 0xED, 0xDA, 0x91, 0x4F, 0x63, 0xBE, 0xB4, 0xE7, 0x3C, 0xFA, 0xC6, 0x3D, 0xC5, 0xAE, 0x27, 0xD4, 0x14, 0x99, 0xE6, 0xE3, 0x5B, 0xC8, 0x76, 0x51, 0xF3, 0x91, 0xE6, 0xC7, 0x8F, 0x2E, 0x3F, 0x96, 0xBA, 0x2F, 0xF7, 0x70, 0x1A, 0x2F, 0xF9, 0x4D, 0x11, 0xCC, 0x0C, 0x0D, 0x97, 0xD8, 0x21, 0x42, 0x86, 0xA1, 0x46, 0x31, 0x2B, 0x3F, 0x6E, 0x69, 0x8B, 0xE0, 0x56, 0x96, 0x66, 0xA5, 0x7C, 0xDC, 0x43, 0xBB, 0x25, 0x51, 0x35, 0x04, 0xEB, 0xAA, 0x22, 0xA8, 0x68, 0x19, 0x07, 0x7D, 0x1D, 0x7C, 0xBC, 0x27, 0xC8, 0x38, 0xE9, 0xB4, 0x9A, 0x1F, 0xC7, 0xB0, 0x6A, 0x75, 0x39, 0x9D, 0x75, 0x5C, 0xA2, 0x92, 0x1E, 0xDF, 0xC1, 0x7E, 0xEC, 0x5E, 0xDD, 0xD2, 0x23, 0xE9, 0x5F, 0xAD, 0xE6, 0x47, 0x35, 0x0B, 0xF8, 0xD0, 0x31, 0x0E, 0xEF, 0xCB, 0x98, 0x0E, 0x63, 0xF4, 0x9D, 0x37, 0xCB, 0x17, 0x6B, 0xE5, 0xC3, 0x19, 0xA1, 0x3E, 0x1C, 0x3F, 0x8E, 0x1B, 0xC7, 0x09, 0x0E, 0x76, 0x0A, 0xCA, 0x8C, 0x87, 0x09, 0xF3, 0x23, 0xD9, 0xF5, 0xB7, 0xFC, 0x58, 0xE8, 0x73, 0x36, 0x6B, 0x25, 0x78, 0x5A, 0xF5, 0x2E, 0xBB, 0xA7, 0xC7, 0xCF, 0x3E, 0x3F, 0xD2, 0x06, 0xA4, 0xCB, 0x8F, 0x85, 0x89, 0xFC, 0xE3, 0x66, 0x2C, 0xCC, 0xAF, 0xF6, 0x75, 0x12, 0xF1, 0xC5, 0x27, 0xCA, 0x87, 0xD3, 0x61, 0x69, 0xF9, 0xCB, 0x90, 0xA2, 0xC3, 0xBF, 0xD6, 0x85, 0xF9, 0x71, 0x3F, 0xF2, 0x90, 0xF0, 0x61, 0x7E, 0x5C, 0x3E, 0x9B, 0x1F, 0x45, 0x7C, 0x8C, 0x49, 0x3B, 0x3F, 0x6D, 0x9E, 0xDC, 0xEF, 0x31, 0x3F, 0xDE, 0xEF, 0xF9, 0xD1, 0xFF, 0x73, 0x6C, 0x47, 0xAE, 0xE9, 0xB1, 0x5F, 0x28, 0x97, 0xAD, 0x5D, 0x44, 0x3B, 0xF5, 0x42, 0x04, 0x25, 0xED, 0xC5, 0x66, 0xF3, 0xF1, 0xB1, 0x50, 0x3E, 0x9F, 0xC5, 0xDE, 0xB1, 0xDF, 0x50, 0xAF, 0x44, 0xEB, 0x68, 0x21, 0x3F, 0x86, 0x71, 0x4C, 0x98, 0x1F, 0x51, 0xAE, 0x5C, 0x36, 0xF2, 0x63, 0x18, 0xA9, 0x14, 0xB3, 0xE5, 0x8D, 0xFB, 0x0E, 0x03, 0x8F, 0xEF, 0xA3, 0x8C, 0xDB, 0x8F, 0xE0, 0xF1, 0x8F, 0xDD, 0x6D, 0xAA, 0xB7, 0x9B, 0xE2, 0x5D, 0x88, 0xBD, 0x66, 0xED, 0x1A, 0x7A, 0x53, 0x2D, 0x84, 0x56, 0xDC, 0x60, 0xB4, 0x9B, 0xE5, 0xCF, 0x0B, 0xE5, 0xCB, 0xD9, 0xB6, 0x21, 0x43, 0xB7, 0x32, 0x6D, 0xFA, 0xE5, 0x53, 0x78, 0xE4, 0xA1, 0x41, 0x0C, 0x73, 0xA2, 0x6F, 0x11, 0xA7, 0x36, 0x2B, 0x9E, 0xBF, 0x0A, 0x6B, 0x3A, 0x6E, 0x3C, 0x26, 0xF5, 0x9F, 0x26, 0x0C, 0x4A, 0x6B, 0xE7, 0xDF, 0xC3, 0x69, 0x9A, 0xDE, 0xDD, 0xED, 0x6E, 0x4B, 0x82, 0xF9, 0xA9, 0xAA, 0xEB, 0xDF, 0xE5, 0xF1, 0xB6, 0xF6, 0xD1, 0x6D, 0x59, 0x6A, 0x24, 0xD2, 0x8B, 0x6D, 0xAC, 0x4C, 0x42, 0xAD, 0x13, 0xE7, 0x4C, 0x13, 0xC7, 0x69, 0x62, 0x29, 0xBF, 0x66, 0xBF, 0x38, 0x0E, 0xCC, 0x8F, 0x5B, 0x55, 0xB9, 0x44, 0xF9, 0x31, 0x8C, 0xFB, 0x93, 0x83, 0xD6, 0x75, 0x5D, 0xE5, 0xE9, 0xA5, 0x3F, 0xCE, 0x8F, 0xB0, 0xE1, 0x0A, 0x96, 0x2E, 0xF3, 0x38, 0x43, 0x82, 0x39, 0x6F, 0x6B, 0x83, 0xDF, 0xC2, 0x69, 0x17, 0xCC, 0x5F, 0xC5, 0x0F, 0x7B, 0x34, 0xC5, 0xAD, 0x31, 0x59, 0x5C, 0x3C, 0xDF, 0xCE, 0x8F, 0x62, 0x16, 0x52, 0x69, 0x89, 0xED, 0xF2, 0xA7, 0x85, 0xFC, 0x9A, 0x95, 0x18, 0xD3, 0xA2, 0x4F, 0x94, 0xF5, 0x7B, 0xB0, 0xFA, 0xDA, 0xE4, 0x45, 0x51, 0x0C, 0xB3, 0xC6, 0x63, 0xEC, 0xCE, 0xD7, 0x3F, 0xA6, 0x62, 0x71, 0x7E, 0x44, 0x95, 0x09, 0xEF, 0x0D, 0x88, 0xF3, 0x20, 0x5C, 0x3A, 0xF4, 0x64, 0xD9, 0x37, 0x50, 0xEC, 0x82, 0xF5, 0x8F, 0xD9, 0x93, 0x1E, 0x75, 0x51, 0x2C, 0xC7, 0xDD, 0x67, 0xE2, 0x3B, 0x5E, 0xEE, 0x8E, 0xFB, 0x4C, 0xF7, 0xF2, 0x2B, 0xED, 0xC7, 0xBC, 0x2F, 0xB5, 0xF0, 0x8B, 0x63, 0x74, 0xF6, 0x8D, 0xC2, 0xFA, 0x3D, 0xF8, 0xF3, 0xF5, 0xC1, 0x71, 0xE0, 0x30, 0xCB, 0x8F, 0x20, 0xA6, 0x37, 0xF2, 0x23, 0x2A, 0x17, 0xEF, 0x09, 0x7F, 0xCC, 0x30, 0xE4, 0xF9, 0x1D, 0x76, 0xE3, 0x00, 0xE4, 0x4F, 0xB6, 0xDB, 0xA7, 0x43, 0xCE, 0xBA, 0xFE, 0xCF, 0x62, 0xB1, 0x8F, 0x24, 0xD0, 0x62, 0x4B, 0xFD, 0xA3, 0x38, 0xE6, 0xFF, 0xFD, 0xF8, 0x25, 0xDD, 0x76, 0x9E, 0x42, 0x70, 0x33, 0x57, 0x17, 0xF2, 0x63, 0x4A, 0xA5, 0x34, 0x3F, 0xCE, 0x41, 0xB1, 0x38, 0x3F, 0xD2, 0xEE, 0x52, 0xB5, 0xB6, 0xAB, 0x09, 0x16, 0xD1, 0xDD, 0x9F, 0xF8, 0xF4, 0x8E, 0xBB, 0xA9, 0x01, 0xE9, 0x56, 0x08, 0xC3, 0xC1, 0x46, 0x7B, 0xEB, 0x60, 0x2D, 0x3E, 0x3D, 0xD8, 0x6E, 0x5E, 0x21, 0xCF, 0x0B, 0xE1, 0xD1, 0x87, 0xCD, 0xD8, 0xA6, 0x6C, 0x96, 0xAF, 0x17, 0xCA, 0x17, 0xC9, 0xC5, 0xBA, 0x3F, 0x5E, 0xD1, 0x3D, 0x9A, 0xF1, 0x97, 0x60, 0x4C, 0xF3, 0x23, 0xE8, 0xF7, 0x25, 0xF9, 0x11, 0x45, 0xFA, 0xFD, 0x14, 0xCB, 0xEA, 0x66, 0x7E, 0xD8, 0x29, 0x43, 0x92, 0x5F, 0x6E, 0x8A, 0x85, 0x5F, 0xE2, 0x39, 0xFD, 0xB3, 0xDB, 0x4F, 0x23, 0xF4, 0x3F, 0xD7, 0xD6, 0x64, 0x7F, 0xAC, 0xBA, 0x26, 0xA3, 0xAD, 0x4F, 0xDD, 0xC3, 0xE7, 0xDD, 0xFD, 0xBB, 0x8B, 0x09, 0x92, 0xC5, 0xE1, 0x1E, 0x1B, 0x42, 0x6B, 0x63, 0x53, 0x96, 0x84, 0xFB, 0xD2, 0xD1, 0x4F, 0xF3, 0x4D, 0x45, 0xF2, 0x39, 0xB0, 0xFA, 0x98, 0x7C, 0x92, 0x1F, 0xE1, 0x51, 0xD3, 0xF6, 0x23, 0xEC, 0xEF, 0xAD, 0xCE, 0xEF, 0x8E, 0x86, 0x0C, 0x99, 0x25, 0x4F, 0x3B, 0xFC, 0xE4, 0x46, 0x61, 0x9E, 0x42, 0xDE, 0xDD, 0x9F, 0x3B, 0x25, 0xC8, 0xAF, 0x6C, 0xE1, 0xF9, 0x8F, 0xA5, 0x28, 0x5E, 0x5D, 0x24, 0xEB, 0x8F, 0x3A, 0x0B, 0x8F, 0xF4, 0xFB, 0xF7, 0xCF, 0xE7, 0x85, 0xC2, 0x97, 0x71, 0x1E, 0x28, 0x08, 0xD7, 0xB4, 0xFC, 0xC2, 0xFD, 0xBD, 0x6B, 0xA7, 0x18, 0xE6, 0x47, 0xF2, 0x24, 0xE2, 0x30, 0x0C, 0x6A, 0x9B, 0x34, 0xFD, 0x3E, 0x93, 0x1F, 0xC3, 0x57, 0x16, 0xA6, 0xAA, 0xFE, 0xD6, 0xA6, 0xF1, 0x24, 0xF2, 0xDB, 0x1C, 0xEE, 0x94, 0x20, 0x7F, 0x7E, 0xBD, 0xBF, 0x75, 0xCF, 0x0F, 0xEE, 0xB3, 0xC3, 0xCF, 0xF1, 0xAE, 0xF7, 0x85, 0x4B, 0xF3, 0x10, 0x9F, 0x53, 0xB8, 0xB5, 0xC5, 0x74, 0x1D, 0xBD, 0x87, 0xC7, 0xD4, 0xBF, 0x18, 0xA6, 0x44, 0x67, 0xE5, 0x83, 0xBB, 0x97, 0x4E, 0x53, 0xF9, 0x2A, 0x2D, 0x5F, 0xA7, 0xE5, 0xE7, 0x83, 0xEE, 0xD5, 0x60, 0x8C, 0xD6, 0x07, 0x17, 0xCF, 0x62, 0xFA, 0xC5, 0x60, 0x36, 0x62, 0x23, 0x3F, 0xEA, 0xE1, 0xA7, 0xCA, 0x34, 0x3F, 0xC6, 0xFC, 0x9D, 0x1D, 0x8E, 0xA7, 0xF4, 0xCF, 0x6D, 0x55, 0x30, 0x7C, 0xC0, 0x76, 0xE6, 0x7D, 0xB1, 0x01, 0x19, 0x66, 0x32, 0x87, 0x88, 0xE8, 0x42, 0x65, 0x0A, 0xF0, 0xE1, 0x72, 0x7D, 0x4F, 0x9F, 0x85, 0x9E, 0xC8, 0x21, 0x29, 0xDF, 0x7D, 0xA5, 0x4C, 0xCB, 0x1F, 0x56, 0xCB, 0xCF, 0xD3, 0x63, 0xB5, 0x83, 0xF5, 0xA9, 0xFC, 0x98, 0xDF, 0x12, 0xB3, 0x9E, 0x1F, 0xE5, 0xF8, 0x94, 0xEE, 0x74, 0x6B, 0xF0, 0x58, 0xAB, 0x2A, 0x2C, 0x6C, 0x95, 0xF0, 0xD9, 0x1D, 0x6F, 0x77, 0x95, 0x5C, 0xC7, 0xE1, 0x87, 0xB5, 0xF4, 0xF8, 0xB9, 0xDC, 0xC1, 0x1A, 0x17, 0xC9, 0x0E, 0x55, 0x5D, 0x9F, 0x8B, 0x24, 0x1E, 0xC6, 0x3B, 0xD2, 0x8B, 0x73, 0x5D, 0x97, 0xE3, 0xAA, 0x40, 0x50, 0x7E, 0xEC, 0x20, 0xE5, 0x41, 0xF9, 0xB1, 0x09, 0xA8, 0xFE, 0x52, 0xBE, 0x2F, 0x9D, 0xDF, 0xDF, 0x9D, 0x90, 0x8E, 0xDD, 0x63, 0x9F, 0xCB, 0x8F, 0x2A, 0x4E, 0xD7, 0x31, 0xC4, 0xAF, 0xBF, 0xDF, 0x1B, 0x77, 0xF4, 0x7D, 0xB1, 0xE3, 0xB5, 0xDA, 0xE9, 0x6D, 0x94, 0xF7, 0x5F, 0x3A, 0xD7, 0xB3, 0x9B, 0xE5, 0x79, 0x52, 0x55, 0x7F, 0xD7, 0xD5, 0x7E, 0x18, 0x6D, 0xCC, 0x1A, 0x8F, 0x6E, 0x0A, 0xEB, 0x9F, 0xA5, 0x92, 0x0B, 0x3D, 0x9C, 0x20, 0x08, 0x17, 0x9E, 0x7E, 0x5A, 0x9C, 0x90, 0x8A, 0x15, 0xDB, 0xE5, 0xEB, 0xA4, 0xF0, 0x18, 0x98, 0x0B, 0x87, 0x4F, 0x7F, 0xE8, 0xAF, 0xCB, 0x9C, 0xFD, 0x9F, 0xD3, 0x8C, 0xC3, 0xEC, 0x11, 0xAD, 0x61, 0xC7, 0xEC, 0xC1, 0xB0, 0xE4, 0x6E, 0x95, 0xA5, 0xD3, 0xE1, 0x49, 0xB5, 0xF7, 0xBB, 0x12, 0x6F, 0x77, 0x5E, 0xED, 0x0F, 0xD1, 0x6B, 0x7E, 0x7E, 0xBE, 0xDF, 0xF2, 0x66, 0xBF, 0x5B, 0x9E, 0xA7, 0x9C, 0x3F, 0x3E, 0x1E, 0x06, 0xE1, 0x42, 0x78, 0x27, 0xF3, 0x3C, 0x0B, 0x0F, 0x20, 0x16, 0x9B, 0x47, 0x9F, 0xDD, 0xEE, 0x3E, 0x26, 0x44, 0x91, 0xEE, 0x0F, 0x7D, 0x32, 0x3F, 0xD2, 0x06, 0x64, 0x96, 0x1F, 0xF5, 0xCA, 0xF6, 0xB1, 0xD2, 0xE9, 0x8B, 0x20, 0x0C, 0xCF, 0xBF, 0x81, 0xFD, 0x78, 0x5B, 0x7B, 0xD6, 0xBF, 0x71, 0x37, 0xCB, 0xDE, 0x0E, 0xB7, 0x17, 0xF0, 0xEE, 0xEE, 0xAF, 0xE3, 0x5D, 0x7D, 0xBF, 0xCF, 0xEC, 0x1A, 0x1F, 0xE5, 0xD1, 0x2C, 0xC0, 0x67, 0x73, 0x5D, 0xB3, 0xF2, 0x87, 0xCD, 0xBD, 0xF3, 0xF7, 0x8E, 0x8C, 0x9F, 0xFB, 0xD8, 0x5E, 0xE9, 0x60, 0x7D, 0x32, 0x3F, 0xD2, 0x29, 0xE7, 0xB5, 0xFC, 0x98, 0xBD, 0x75, 0x65, 0x3C, 0x5A, 0xFA, 0xC6, 0x15, 0xEB, 0xE7, 0xDF, 0x40, 0x15, 0x3C, 0xF6, 0xF1, 0x36, 0x64, 0xC5, 0x90, 0x1A, 0x37, 0xEB, 0xEF, 0xBF, 0x2A, 0x37, 0xE3, 0x21, 0xEE, 0x40, 0x1D, 0x16, 0x2E, 0xA6, 0x49, 0xF9, 0x64, 0x80, 0x1D, 0x5F, 0x8E, 0xA3, 0x3B, 0x01, 0xD3, 0x79, 0xA3, 0xCD, 0xB9, 0xD8, 0x72, 0xE9, 0xE0, 0xBD, 0x8F, 0x30, 0xC2, 0xD3, 0x06, 0x64, 0x2D, 0x3F, 0xE2, 0x8A, 0xE5, 0xC1, 0x18, 0xBC, 0x89, 0xAE, 0x09, 0xDE, 0x5B, 0xFC, 0x2D, 0xDC, 0x1B, 0x90, 0xE9, 0x89, 0xF3, 0xBB, 0xFB, 0xD3, 0x51, 0xAB, 0xEF, 0x67, 0xE8, 0xB4, 0xC5, 0x56, 0x38, 0x04, 0x7B, 0xD3, 0x3B, 0xC1, 0x07, 0xA7, 0x4F, 0x96, 0x3F, 0xC4, 0xB9, 0xD7, 0x5F, 0xF7, 0x83, 0xC8, 0x3C, 0x05, 0x71, 0x9E, 0xEA, 0xC7, 0xD3, 0xCB, 0x7D, 0x9D, 0x5B, 0x40, 0x0F, 0xC7, 0x3E, 0xC6, 0x5F, 0x5C, 0x6D, 0x27, 0x2E, 0xED, 0x54, 0xED, 0xA4, 0xD6, 0xF5, 0x58, 0xC8, 0x8B, 0xEF, 0xBF, 0x89, 0xBA, 0x4F, 0x90, 0xF4, 0xB9, 0xDA, 0xF1, 0xF1, 0xC1, 0x6B, 0x7E, 0x6C, 0x75, 0x14, 0x9A, 0xAA, 0x2C, 0x8A, 0x53, 0xB5, 0xD2, 0xD5, 0xAE, 0xAF, 0x7B, 0x4F, 0xD5, 0x56, 0xA8, 0x6C, 0x97, 0xFF, 0xE8, 0xCB, 0xCF, 0xE7, 0x49, 0x9B, 0x26, 0x2E, 0xD1, 0xA6, 0x1B, 0xB6, 0xBE, 0x1C, 0xEF, 0x0A, 0x96, 0x70, 0xE2, 0x2F, 0x36, 0x91, 0x85, 0x6A, 0x2F, 0xBE, 0x14, 0xB5, 0xAE, 0x4E, 0xEB, 0xE7, 0xC3, 0xF3, 0x29, 0x76, 0x8B, 0x2F, 0x66, 0xF8, 0x64, 0x7E, 0xC0, 0x37, 0xD7, 0x27, 0xC8, 0x72, 0x7E, 0xBC, 0xAD, 0xBD, 0xBF, 0x04, 0x5E, 0x45, 0x97, 0x20, 0xFB, 0xB5, 0x0E, 0xD6, 0x75, 0xC4, 0xFE, 0xE8, 0xFA, 0xC1, 0x43, 0x75, 0xFF, 0x7B, 0x9C, 0xE5, 0x04, 0xC9, 0x36, 0x5E, 0x4F, 0x0D, 0xAF, 0xA2, 0xB8, 0xBD, 0x8D, 0x3A, 0x4E, 0x91, 0xB7, 0xFE, 0xFD, 0xBB, 0x46, 0x1F, 0x70, 0xE9, 0x9F, 0x36, 0x1F, 0x16, 0x3D, 0xEE, 0x2B, 0x21, 0xFB, 0xDC, 0xD8, 0x03, 0x6E, 0x9A, 0x22, 0x0F, 0xFF, 0xF7, 0x1F, 0xBB, 0xFD, 0x3F, 0x9A, 0x0E, 0x88, 0xD4, 0x65, 0x51, 0x1C, 0x8B, 0xA2, 0xD8, 0x5C, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0x8A, 0xB6, 0x69, 0xDA, 0x47, 0xD7, 0x01, 0xBE, 0xA2, 0xB6, 0x3A, 0x66, 0x37, 0x87, 0xB2, 0x79, 0x74, 0x5D, 0xE0, 0x6B, 0x69, 0x8B, 0x2C, 0x3B, 0x56, 0xF5, 0x55, 0xD5, 0xFD, 0xA5, 0x15, 0x81, 0x49, 0x99, 0x65, 0xD5, 0xF4, 0xE9, 0x9C, 0x65, 0xA7, 0xC7, 0xD5, 0x05, 0xBE, 0x98, 0x63, 0x56, 0xC6, 0x1B, 0xAA, 0xEC, 0xF8, 0x98, 0x9A, 0xC0, 0x97, 0x73, 0xC8, 0xEA, 0x74, 0x53, 0x93, 0xE5, 0xFA, 0x58, 0x70, 0xE9, 0x5A, 0x8F, 0x71, 0x40, 0x7E, 0xCE, 0xF3, 0x7B, 0xC3, 0xD1, 0xE6, 0x87, 0x47, 0xD5, 0x07, 0xBE, 0x90, 0x32, 0x68, 0x3D, 0xBA, 0xF9, 0xAB, 0xA2, 0xFF, 0xB3, 0x19, 0xFE, 0x80, 0x17, 0xD6, 0x04, 0x23, 0xF3, 0xFA, 0x36, 0xBF, 0x7B, 0xFF, 0x70, 0x9E, 0xF7, 0xBA, 0xE0, 0xD5, 0x1C, 0xF3, 0xE9, 0xEF, 0xA6, 0xCB, 0x8F, 0x71, 0x64, 0x7E, 0xD4, 0xC3, 0xE2, 0xD5, 0x7D, 0x44, 0xAD, 0x44, 0x91, 0x05, 0xE3, 0xF2, 0x0F, 0x0D, 0x08, 0xAF, 0xAE, 0xC8, 0xA3, 0x8F, 0x4D, 0x98, 0x12, 0x47, 0x23, 0x10, 0x5E, 0x5C, 0xBA, 0xF2, 0x11, 0xAA, 0xB2, 0xFF, 0xBF, 0x7A, 0xC0, 0x17, 0xD4, 0x64, 0x1F, 0xD3, 0xDF, 0x1F, 0x75, 0x5D, 0x55, 0x55, 0xB8, 0x53, 0x07, 0x8B, 0x97, 0x76, 0x9E, 0x9A, 0x88, 0xA6, 0xBF, 0x3D, 0x31, 0x5C, 0x38, 0x0F, 0x6F, 0x3A, 0x81, 0xD7, 0x53, 0x4E, 0xC3, 0x8F, 0x2A, 0xCF, 0xBB, 0xFC, 0x08, 0x53, 0xC2, 0x00, 0x84, 0xD7, 0x76, 0x0A, 0x9B, 0x8B, 0x8F, 0x2E, 0x3F, 0xC2, 0xDB, 0x4A, 0x0A, 0xF9, 0xC1, 0x4B, 0x2B, 0xC2, 0xFC, 0x28, 0xAF, 0xE9, 0x11, 0x4D, 0x67, 0xC9, 0x0F, 0x5E, 0x5B, 0x19, 0xE6, 0xC3, 0x61, 0xBA, 0xBB, 0xA4, 0xA7, 0x7F, 0xC5, 0x6B, 0x8B, 0xA6, 0x70, 0xBB, 0xF1, 0x47, 0x34, 0x63, 0xB5, 0x35, 0xF9, 0x0B, 0xDF, 0x5F, 0x1D, 0x8C, 0x37, 0xEA, 0xB4, 0x7B, 0x75, 0x31, 0xBF, 0xCB, 0x8B, 0x0B, 0xE6, 0xAB, 0x8A, 0xE0, 0xE6, 0xC4, 0x9B, 0xDA, 0xFA, 0x20, 0x2F, 0xEE, 0x38, 0x0D, 0xD0, 0xBB, 0xEE, 0x55, 0x79, 0x39, 0x4F, 0x0B, 0x86, 0x85, 0x87, 0x08, 0x79, 0x71, 0xE7, 0xB1, 0x83, 0xD5, 0x76, 0xB3, 0xBB, 0xCD, 0x25, 0x9B, 0x1A, 0x0D, 0xCB, 0x83, 0xBC, 0xBC, 0x71, 0xC6, 0xAA, 0x1F, 0x7E, 0x04, 0x8F, 0xA2, 0x9F, 0x74, 0xAF, 0x78, 0x79, 0xE7, 0xE1, 0xE9, 0xDA, 0x6E, 0xF5, 0xE3, 0x50, 0x4C, 0x23, 0xF4, 0x56, 0xF3, 0x01, 0x97, 0xC3, 0x3D, 0x23, 0xAA, 0xDB, 0xED, 0x57, 0xF9, 0x6C, 0x3B, 0xBC, 0xB2, 0x76, 0xB8, 0x25, 0xB1, 0x1B, 0x9F, 0x1F, 0xC6, 0xE9, 0xDE, 0x22, 0xF3, 0x1A, 0x45, 0xE8, 0x06, 0x1E, 0x7D, 0x82, 0xB4, 0xA7, 0x62, 0x5A, 0xEF, 0x28, 0xAC, 0x7D, 0xC0, 0x4D, 0x9D, 0xE5, 0x49, 0x5B, 0xD1, 0x1E, 0xA5, 0x07, 0xDC, 0x35, 0x79, 0xFC, 0x42, 0xD1, 0x32, 0xD3, 0xB9, 0x82, 0xC9, 0x75, 0x70, 0x3E, 0x74, 0xAE, 0xEA, 0x22, 0x73, 0xDF, 0x15, 0xC4, 0xCA, 0x6C, 0x54, 0x7A, 0xB5, 0x28, 0xA4, 0xDA, 0xBA, 0x3A, 0x9D, 0xCA, 0x5A, 0xCF, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x57, 0xF4, 0x5F, 0xC3, 0x54, 0x94, 0x5A };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_bitmap.h
C
agpl-3.0
18,193
const PROGMEM uint16_t menu_btn[] = {0x0AAC, 0x0DF3, 0x6D54, 0x0DF3, 0x6D54, 0x2E89, 0x0AAC, 0x2E89, 0x0AAC, 0x0DF3}; const PROGMEM uint16_t print_btn[] = {0x4800, 0xCCCC, 0x7FFF, 0xCCCC, 0x7FFF, 0xED62, 0x4800, 0xED62, 0x4800, 0xCCCC}; const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAC, 0x37D8, 0x6D54, 0x37D8, 0x6D54, 0x586E, 0x0AAC, 0x586E, 0x0AAC, 0x37D8}; const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAC, 0x5D15, 0x6D54, 0x5D15, 0x6D54, 0x7DAB, 0x0AAC, 0x7DAB, 0x0AAC, 0x5D15}; const PROGMEM uint16_t extrude_btn[] = {0x0AAC, 0x8252, 0x6D54, 0x8252, 0x6D54, 0xA2E8, 0x0AAC, 0xA2E8, 0x0AAC, 0x8252}; const PROGMEM uint16_t media_btn[] = {0x0AAC, 0xCCCC, 0x42AA, 0xCCCC, 0x42AA, 0xED62, 0x0AAC, 0xED62, 0x0AAC, 0xCCCC}; const PROGMEM uint16_t pause_btn[] = {0x8554, 0xCCCC, 0xBD53, 0xCCCC, 0xBD53, 0xED62, 0x8554, 0xED62, 0x8554, 0xCCCC}; const PROGMEM uint16_t print_time_hms[] = {0xAB02, 0x82EE, 0xE4F8, 0x82EE, 0xE4F8, 0xA24C, 0xAB02, 0xA24C, 0xAB02, 0x82EE}; const PROGMEM uint16_t print_time_pct[] = {0x7386, 0x82E2, 0xA500, 0x82E2, 0xA500, 0xA258, 0x7386, 0xA258, 0x7386, 0x82E2}; const PROGMEM uint16_t file_name[] = {0x0B08, 0xA830, 0xF4F5, 0xA830, 0xF4F5, 0xC784, 0x0B08, 0xC784, 0x0B08, 0xA830}; const PROGMEM uint16_t h0_label[] = {0x85B6, 0x3884, 0xAF9B, 0x3884, 0xAF9B, 0x57C1, 0x85B6, 0x57C1, 0x85B6, 0x3884}; const PROGMEM uint16_t h0_temp[] = {0x85B6, 0x5DC1, 0xAF9B, 0x5DC1, 0xAF9B, 0x7CFF, 0x85B6, 0x7CFF, 0x85B6, 0x5DC1}; const PROGMEM uint16_t h1_label[] = {0xBB0B, 0x3884, 0xE4EF, 0x3884, 0xE4EF, 0x57C1, 0xBB0B, 0x57C1, 0xBB0B, 0x3884}; const PROGMEM uint16_t h1_temp[] = {0xBB0B, 0x5DC1, 0xE4EF, 0x5DC1, 0xE4EF, 0x7CFF, 0xBB0B, 0x7CFF, 0xBB0B, 0x5DC1}; const PROGMEM uint16_t stop_btn[] = {0xC2A8, 0xCCCC, 0xF551, 0xCCCC, 0xF551, 0xED62, 0xC2A8, 0xED62, 0xC2A8, 0xCCCC}; const PROGMEM uint16_t z_wizard_heading[] = {0x5332, 0x0FFF, 0xB331, 0x0FFF, 0xB331, 0x2AAA, 0x5332, 0x2AAA, 0x5332, 0x0FFF}; const PROGMEM uint16_t z_wizard_plus_btn[] = {0x9CCB, 0x3AAA, 0xAFFE, 0x3AAA, 0xAFFE, 0x5554, 0x9CCB, 0x5554, 0x9CCB, 0x3AAA}; const PROGMEM uint16_t z_wizard_edit_box[] = {0x0CCC, 0x9FFE, 0x5332, 0x9FFE, 0x5332, 0xC553, 0x0CCC, 0xC553, 0x0CCC, 0x9FFE}; const PROGMEM uint16_t z_wizard_inc1_btn[] = {0x5998, 0xA016, 0x8998, 0xA016, 0x8998, 0xC553, 0x5998, 0xC553, 0x5998, 0xA016}; const PROGMEM uint16_t z_wizard_inc2_btn[] = {0x8FFE, 0xA016, 0xBFFE, 0xA016, 0xBFFE, 0xC553, 0x8FFE, 0xC553, 0x8FFE, 0xA016}; const PROGMEM uint16_t z_wizard_inc3_btn[] = {0xC664, 0xA016, 0xF664, 0xA016, 0xF664, 0xC553, 0xC664, 0xC553, 0xC664, 0xA016}; const PROGMEM uint16_t z_wizard_done_btn[] = {0xBFFE, 0xCFFE, 0xF664, 0xCFFE, 0xF664, 0xF553, 0xBFFE, 0xF553, 0xBFFE, 0xCFFE}; const PROGMEM uint16_t z_wizard_neg_btn[] = {0x9CCB, 0x5FFF, 0xAFFE, 0x5FFF, 0xAFFE, 0x7AA9, 0x9CCB, 0x7AA9, 0x9CCB, 0x5FFF}; const PROGMEM uint16_t z_wizard_diagram[] = {0x6D65, 0x4DBE, 0x6D65, 0x6015, 0x7ADB, 0x6015, 0x7F1F, 0x6C6A, 0x8303, 0x6C6A, 0x8747, 0x6015, 0x94BE, 0x6015, 0x94BE, 0x4DBE, 0x6D65, 0x4DBE, 0xFFFF, 0x0D06, 0x8527, 0x0D06, 0x9554, 0xF664, 0x9554, 0xF664, 0x8527, 0x0D06, 0x8527}; const PROGMEM uint16_t load_screen_extrude[] = {0x382D, 0x897E, 0x4189, 0x897E, 0x4189, 0xAA6A, 0x4638, 0xAA6A, 0x3CDB, 0xBAE0, 0x337F, 0xAA6A, 0x382D, 0xAA6A, 0x382D, 0x897E}; const PROGMEM uint16_t load_screen_retract[] = {0x382D, 0x7908, 0x4189, 0x7908, 0x4189, 0x581C, 0x4638, 0x581C, 0x3CDB, 0x47A6, 0x337F, 0x581C, 0x382D, 0x581C, 0x382D, 0x7908}; const PROGMEM uint16_t load_screen_back_btn[] = {0x1556, 0xC825, 0xEAA7, 0xC825, 0xEAA7, 0xED62, 0x1556, 0xED62, 0x1556, 0xC825}; const PROGMEM uint16_t load_screen_unload_btn[] = {0x67FF, 0x6FB4, 0xEAA7, 0x6FB4, 0xEAA7, 0x94F1, 0x67FF, 0x94F1, 0x67FF, 0x6FB4}; const PROGMEM uint16_t load_screen_start_stop_btn[] = {0x67FF, 0x9998, 0xEAA7, 0x9998, 0xEAA7, 0xBED6, 0x67FF, 0xBED6, 0x67FF, 0x9998}; const PROGMEM uint16_t load_screen_load_btn[] = {0x67FF, 0x45CF, 0xEAA7, 0x45CF, 0xEAA7, 0x6B0C, 0x67FF, 0x6B0C, 0x67FF, 0x45CF}; const PROGMEM uint16_t load_screen_continuous[] = {0x67FF, 0x1743, 0xEAA7, 0x1743, 0xEAA7, 0x3C80, 0x67FF, 0x3C80, 0x67FF, 0x1743}; const PROGMEM uint16_t load_screen_increment[] = {0x1556, 0x1743, 0x62AA, 0x1743, 0x62AA, 0x3C80, 0x1556, 0x3C80, 0x1556, 0x1743};
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/cocoa_press_ui.h
C
agpl-3.0
4,247
/************************************** * 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
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.cpp
C++
agpl-3.0
2,348
/************************************ * 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); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/confirm_start_print_dialog_box.h
C++
agpl-3.0
1,735
/******************** * 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) .tag(mydata.flags.is_root ? 240 : 245).button(BTN2_POS, F("Back")) .colors(action_btn); 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: // Back button card.filename[0] = card.longFilename[0] = '\0'; // Clear file selection 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
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.cpp
C++
agpl-3.0
9,050
/****************** * 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(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/files_screen.h
C++
agpl-3.0
2,907
/********************************* * cocoa_press/leveling_menu.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" #if ENABLED(COCOA_LEVELING_MENU) using namespace FTDI; using namespace ExtUI; using namespace Theme; #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #define GRID_COLS 3 #define GRID_ROWS 6 #define BED_MESH_TITLE_POS BTN_POS(1,1), BTN_SIZE(3,1) #define WARNING_POS BTN_POS(1,2), BTN_SIZE(3,2) #define PROBE_BED_POS BTN_POS(1,4), BTN_SIZE(1,1) #define SHOW_MESH_POS BTN_POS(2,4), BTN_SIZE(1,1) #define EDIT_MESH_POS BTN_POS(3,4), BTN_SIZE(1,1) #define BACK_POS BTN_POS(1,6), BTN_SIZE(3,1) #else #define GRID_COLS 2 #define GRID_ROWS 6 #define BED_MESH_TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) #define WARNING_POS BTN_POS(1,2), BTN_SIZE(2,2) #define PROBE_BED_POS BTN_POS(1,4), BTN_SIZE(1,1) #define SHOW_MESH_POS BTN_POS(2,4), BTN_SIZE(1,1) #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) // Hide the editor button if motion to grid point not supported #define EDIT_MESH_POS BTN_POS(4,7), BTN_SIZE(1,1) #endif void LevelingMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)) .tag(0); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.font(font_large) .cmd(COLOR_RGB(bg_text_enabled)) .text(BED_MESH_TITLE_POS, GET_TEXT_F(MSG_BED_LEVELING)) .font(font_medium).colors(normal_btn) .tag(2).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED)) .enabled(ENABLED(HAS_MESH)) .tag(3).button(SHOW_MESH_POS, GET_TEXT_F(MSG_MESH_VIEW)) .enabled(ENABLED(HAS_MESH)) .tag(4).button(EDIT_MESH_POS, GET_TEXT_F(MSG_EDIT_MESH)) .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); draw_text_box(cmd, WARNING_POS, F("Remove chocolate cartridge before probing. This reduces the possibility of damaging a part."), OPT_CENTER, font_medium); } } bool LevelingMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; case 2: SaveSettingsDialogBox::settingsChanged(); injectCommands(F(BED_LEVELING_COMMANDS)); break; case 3: BedMeshViewScreen::show(); break; case 4: SaveSettingsDialogBox::settingsChanged(); BedMeshEditScreen::show(); break; default: return false; } return true; } #endif // COCOA_LEVELING_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp
C++
agpl-3.0
3,920
/******************************* * cocoa_press/leveling_menu.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_LEVELING_MENU #define COCOA_LEVELING_MENU_CLASS LevelingMenu class LevelingMenu : public BaseScreen, public CachedScreen<LEVELING_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.h
C++
agpl-3.0
1,696
/********************************** * cocoa_press/load_chocolate.cpp * **********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2020 - Cocoa Press * * * * 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_LOAD_CHOCOLATE_SCREEN #include "cocoa_press_ui.h" #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) const uint8_t shadow_depth = 5; using namespace ExtUI; using namespace FTDI; using namespace Theme; constexpr static LoadChocolateScreenData &mydata = screen_data.LoadChocolateScreen; void LoadChocolateScreen::draw_buttons(draw_mode_t what) { int16_t x, y, h, v; CommandProcessor cmd; PolyUI ui(cmd, what); cmd.font(font_medium).colors(normal_btn); ui.bounds(POLY(load_screen_unload_btn), x, y, h, v); 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).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)); } void LoadChocolateScreen::draw_text(draw_mode_t what) { if (what & BACKGROUND) { int16_t x, y, h, v; CommandProcessor cmd; PolyUI ui(cmd, what); cmd.font(font_medium).cmd(COLOR_RGB(bg_text_enabled)); 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)); } } void LoadChocolateScreen::draw_arrows(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); ui.button_fill (fill_rgb); ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); constexpr uint8_t style = PolyUI::REGULAR; 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; } void LoadChocolateScreen::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .tag(0); } draw_arrows(what); draw_buttons(what); draw_text(what); } bool LoadChocolateScreen::onTouchStart(uint8_t tag) { if (tag != 4) mydata.repeating = false; return true; } bool LoadChocolateScreen::onTouchEnd(uint8_t tag) { using namespace ExtUI; switch (tag) { case 2: mydata.repeat_tag = 5; break; case 3: mydata.repeat_tag = 6; break; case 4: mydata.repeating = !mydata.repeating; break; case 1: GOTO_PREVIOUS(); break; } return true; } void LoadChocolateScreen::setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment_mm) { // Compute increment so feedrate so that the tool lags the adjuster when it is // being held down, this allows enough margin for the planner to // connect segments and even out the motion. ExtUI::setFeedrate_mm_s(feedrate_mm_s); increment_mm = feedrate_mm_s / ((TOUCH_REPEATS_PER_SECOND) * 0.80f); } bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { if (ExtUI::isMoving()) return false; // Don't allow moves to accumulate float increment; setManualFeedrateAndIncrement(20, increment); #define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); #define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); switch (tag) { case 5: UI_INCREMENT_AXIS(E0); break; case 6: UI_DECREMENT_AXIS(E0); break; default: return false; } #undef UI_DECREMENT_AXIS #undef UI_INCREMENT_AXIS return false; } void LoadChocolateScreen::onIdle() { reset_menu_timeout(); if (mydata.repeating) onTouchHeld(mydata.repeat_tag); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); refresh_timer.start(); } BaseScreen::onIdle(); } #endif // COCOA_LOAD_CHOCOLATE_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.cpp
C++
agpl-3.0
5,706
/******************************** * cocoa_press/load_chocolate.h * ********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2020 - Cocoa Press * * * * 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_LOAD_CHOCOLATE_SCREEN #define COCOA_LOAD_CHOCOLATE_SCREEN_CLASS LoadChocolateScreen struct LoadChocolateScreenData { uint8_t repeat_tag; bool repeating; }; class LoadChocolateScreen : public BaseScreen, public CachedScreen<LOAD_CHOCOLATE_SCREEN_CACHE> { private: static void draw_arrows(draw_mode_t what); static void draw_buttons(draw_mode_t what); static void draw_text(draw_mode_t what); public: static void setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment); static void onEntry(); static void onIdle(); static void onRedraw(draw_mode_t); static bool onTouchStart(uint8_t tag); static bool onTouchEnd(uint8_t tag); static bool onTouchHeld(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/load_chocolate.h
C++
agpl-3.0
2,267
/***************************** * cocoa_press/main_menu.cpp * *****************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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 "../../../../module/stepper.h" #ifdef COCOA_MAIN_MENU using namespace FTDI; using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 6 #define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1) #define MOVE_XYZ_POS BTN_POS(1,2), BTN_SIZE(1,1) #define LEVELING_POS BTN_POS(2,1), BTN_SIZE(1,1) #define MOVE_E_POS BTN_POS(2,2), BTN_SIZE(1,1) #define SPEED_POS BTN_POS(1,3), BTN_SIZE(1,1) #define FLOW_POS BTN_POS(2,3), BTN_SIZE(1,1) #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(1,1) #define DISABLE_STEPPERS_POS BTN_POS(2,4), BTN_SIZE(1,1) #define ADVANCED_SETTINGS_POS BTN_POS(1,5), BTN_SIZE(1,1) #define ABOUT_PRINTER_POS BTN_POS(2,5), BTN_SIZE(1,1) #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) void MainMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) .tag( 2).button(MOVE_XYZ_POS, GET_TEXT_F(MSG_XYZ_MOVE)) .tag( 3).button(TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) .enabled(ALL(HAS_LEVELING, HAS_BED_PROBE)) .tag( 4).button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) .tag( 5).button(MOVE_E_POS, GET_TEXT_F(MSG_E_MOVE)) .tag( 6).button(SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) .tag( 7).button(FLOW_POS, GET_TEXT_F(MSG_FLOW)) .tag( 8).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .enabled(stepper.axis_is_enabled(X_AXIS) || stepper.axis_is_enabled(Y_AXIS) || stepper.axis_is_enabled(Z_AXIS) || stepper.axis_is_enabled(E0_AXIS)) .tag( 9).button(DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS)) .enabled(ENABLED(HAS_LEVELING)) .tag(10).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) .tag(11).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } bool MainMenu::onTouchEnd(uint8_t tag) { using namespace ExtUI; switch (tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: GOTO_SCREEN(MoveXYZScreen); break; case 3: GOTO_SCREEN(TemperatureScreen); break; #if ALL(HAS_LEVELING, HAS_BED_PROBE) case 4: GOTO_SCREEN(ZOffsetScreen); break; #endif case 5: GOTO_SCREEN(MoveEScreen); break; case 6: GOTO_SCREEN(FeedratePercentScreen); break; case 7: GOTO_SCREEN(FlowPercentScreen); break; case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; case 9: injectCommands(F("M84")); break; #if HAS_LEVELING case 10: GOTO_SCREEN(LevelingMenu); break; #endif case 11: GOTO_SCREEN(AboutScreen); break; default: return false; } return true; } void MainMenu::onIdle() { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); refresh_timer.start(); } } #endif // COCOA_MAIN_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp
C++
agpl-3.0
4,983
/*************************** * cocoa_press/main_menu.h * ***************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_MAIN_MENU #define COCOA_MAIN_MENU_CLASS MainMenu class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); static void onIdle(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.h
C++
agpl-3.0
1,770
/********************************* * cocoa_press/move_e_screen.cpp * *********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_MOVE_E_SCREEN using namespace FTDI; using namespace ExtUI; constexpr static MoveAxisScreenData &mydata = screen_data.MoveAxisScreen; void MoveEScreen::onRedraw(draw_mode_t what) { widgets_t w(what); w.precision(1, DEFAULT_MIDRANGE); w.units(GET_TEXT_F(MSG_UNITS_MM)); w.heading( GET_TEXT_F(MSG_E_MOVE)); w.color(Theme::e_axis); #if EXTRUDERS == 1 w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), mydata.e_rel[0], canMove(E0)); #elif HAS_MULTI_EXTRUDER w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), mydata.e_rel[0], canMove(E0)); w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), mydata.e_rel[1], canMove(E1)); #if EXTRUDERS > 2 w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), mydata.e_rel[2], canMove(E2)); #endif #if EXTRUDERS > 3 w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3)); #endif #endif w.increments(); } void MoveEScreen::onIdle() { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); } BaseScreen::onIdle(); } #endif // COCOA_MOVE_E_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/move_e_screen.cpp
C++
agpl-3.0
2,686
/******************************* * cocoa_press/move_e_screen.h * *******************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_MOVE_E_SCREEN #define COCOA_MOVE_E_SCREEN_CLASS MoveEScreen class MoveEScreen : public BaseMoveAxisScreen, public CachedScreen<MOVE_E_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static void onIdle(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/move_e_screen.h
C++
agpl-3.0
1,765
/*********************************** * cocoa_press/move_xyz_screen.cpp * ***********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_MOVE_XYZ_SCREEN using namespace FTDI; using namespace ExtUI; void MoveXYZScreen::onRedraw(draw_mode_t what) { widgets_t w(what); w.precision(1); w.units(GET_TEXT_F(MSG_UNITS_MM)); w.heading( GET_TEXT_F(MSG_XYZ_MOVE)); w.home_buttons(20); w.color(Theme::x_axis).adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getAxisPosition_mm(X), canMove(X)); w.color(Theme::y_axis).adjuster( 4, GET_TEXT_F(MSG_AXIS_Y), getAxisPosition_mm(Y), canMove(Y)); w.color(Theme::z_axis).adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisPosition_mm(Z), canMove(Z)); w.increments(); } void MoveXYZScreen::onIdle() { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); } BaseScreen::onIdle(); } #endif // COCOA_MOVE_XYZ_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/move_xyz_screen.cpp
C++
agpl-3.0
2,398
/********************************* * cocoa_press/move_xyz_screen.h * *********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_MOVE_XYZ_SCREEN #define COCOA_MOVE_XYZ_SCREEN_CLASS MoveXYZScreen class MoveXYZScreen : public BaseMoveAxisScreen, public CachedScreen<MOVE_XYZ_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static void onIdle(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/move_xyz_screen.h
C++
agpl-3.0
1,781
/******************************** * cocoa_press/preheat_menu.cpp * ********************************/ /**************************************************************************** * Written By Marcio Teixeira 2020 - Cocoa Press * * * * 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_PREHEAT_MENU using namespace FTDI; using namespace ExtUI; using namespace Theme; #define GRID_COLS 2 #define GRID_ROWS 5 void PreheatMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .font(Theme::font_medium) .tag(0).text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_SELECT_CHOCOLATE_TYPE)); } if (what & FOREGROUND) { CommandProcessor cmd; cmd.font(Theme::font_medium) .colors(normal_btn) .tag(2).button(BTN_POS(1,2), BTN_SIZE(2,1), F("Dark Chocolate")) .tag(3).button(BTN_POS(1,3), BTN_SIZE(2,1), F("Milk Chocolate")) .tag(4).button(BTN_POS(1,4), BTN_SIZE(2,1), F("White Chocolate")) .colors(action_btn) .tag(1).button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } bool PreheatMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; case 2: #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT injectCommands(F(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; case 3: #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT injectCommands(F(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; case 4: #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT injectCommands(F(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; default: return false; } return true; } #endif // COCOA_PREHEAT_MENU
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.cpp
C++
agpl-3.0
3,135
/****************************** * cocoa_press/preheat_menu.h * ******************************/ /**************************************************************************** * Written By Marcio Teixeira 2020 - Cocoa Press * * * * 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_PREHEAT_MENU #define COCOA_PREHEAT_MENU_CLASS PreheatMenu class PreheatMenu : public BaseScreen, public CachedScreen<PREHEAT_MENU_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_menu.h
C++
agpl-3.0
1,609
/*************************************** * cocoapress/preheat_timer_screen.cpp * ***************************************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_PREHEAT_SCREEN using namespace FTDI; using namespace ExtUI; using namespace Theme; constexpr static PreheatTimerScreenData &mydata = screen_data.PreheatTimerScreen; #define GRID_COLS 2 #define GRID_ROWS 8 #define HEADER_POS BTN_POS(2,1), BTN_SIZE(1,2) #define NOZZLE_ADJ_POS BTN_POS(2,3), BTN_SIZE(1,2) #define BODY_ADJ_POS BTN_POS(2,5), BTN_SIZE(1,2) #define CHAMBER_ADJ_POS BTN_POS(2,7), BTN_SIZE(1,2) #define PROGRESS_POS BTN_POS(1,1), BTN_SIZE(1,7) #define BACK_POS BTN_POS(1,8), BTN_SIZE(1,1) void PreheatTimerScreen::draw_message(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); draw_text_box(cmd, HEADER_POS, GET_TEXT_F(MSG_HEATING), OPT_CENTER, font_large); } } uint16_t PreheatTimerScreen::secondsRemaining() { const uint32_t elapsed_sec = (millis() - mydata.start_ms) / 1000; return (COCOA_PRESS_PREHEAT_SECONDS > elapsed_sec) ? COCOA_PRESS_PREHEAT_SECONDS - elapsed_sec : 0; } void PreheatTimerScreen::draw_time_remaining(draw_mode_t what) { if (what & FOREGROUND) { const uint16_t elapsed_sec = secondsRemaining(); const uint8_t min = elapsed_sec / 60, sec = elapsed_sec % 60; char str[10]; sprintf_P(str, PSTR("%02d:%02d"), min, sec); CommandProcessor cmd; cmd.font(font_xlarge); draw_circular_progress(cmd, PROGRESS_POS, float(secondsRemaining()) * 100 / COCOA_PRESS_PREHEAT_SECONDS, str, theme_dark, theme_darkest); } } void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) { if (what & FOREGROUND) { CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE)); } } void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h) { #define SUB_COLS 9 #define SUB_ROWS 2 CommandProcessor cmd; cmd.tag(0) .font(font_small); if (what & BACKGROUND) { cmd.text( SUB_POS(1,1), SUB_SIZE(9,1), label) .button(SUB_POS(1,2), SUB_SIZE(5,1), F(""), OPT_FLAT); } if (what & FOREGROUND) { char str[32]; dtostrf(value, 5, 1, str); strcat_P(str, PSTR(" ")); strcat_P(str, (const char*) GET_TEXT_F(MSG_UNITS_C)); cmd.text(SUB_POS(1,2), SUB_SIZE(5,1), str) .font(font_medium) .tag(tag ).button(SUB_POS(6,2), SUB_SIZE(2,1), F("-")) .tag(tag+1).button(SUB_POS(8,2), SUB_SIZE(2,1), F("+")); } } void PreheatTimerScreen::onEntry() { mydata.start_ms = millis(); } void PreheatTimerScreen::onRedraw(draw_mode_t what) { draw_message(what); draw_time_remaining(what); draw_interaction_buttons(what); draw_adjuster(what, 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0), NOZZLE_ADJ_POS); draw_adjuster(what, 4, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1), BODY_ADJ_POS); #if HAS_HEATED_CHAMBER draw_adjuster(what, 6, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER), CHAMBER_ADJ_POS); #endif } bool PreheatTimerScreen::onTouchHeld(uint8_t tag) { const float increment = (tag == 6 || tag == 7) ? 1 : 0.1; switch (tag) { case 2: UI_DECREMENT(TargetTemp_celsius, E0); break; case 3: UI_INCREMENT(TargetTemp_celsius, E0); break; case 4: UI_DECREMENT(TargetTemp_celsius, E1); break; case 5: UI_INCREMENT(TargetTemp_celsius, E1); break; #if HAS_HEATED_CHAMBER case 6: UI_DECREMENT(TargetTemp_celsius, CHAMBER); break; case 7: UI_INCREMENT(TargetTemp_celsius, CHAMBER); break; #endif default: return false; } return true; } bool PreheatTimerScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); return true; default: return current_screen.onTouchHeld(tag); } return false; } void PreheatTimerScreen::onIdle() { if (secondsRemaining() == 0) { AlertDialogBox::show(GET_TEXT_F(MSG_PREHEAT_FINISHED)); // Remove SaveSettingsDialogBox from the stack // so the alert box doesn't return to me. current_screen.forget(); } reset_menu_timeout(); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); } BaseScreen::onIdle(); } #endif // COCOA_PREHEAT_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.cpp
C++
agpl-3.0
5,860
/********************************* * cocoapress/preheat_screen.cpp * *********************************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_PREHEAT_SCREEN #define COCOA_PREHEAT_SCREEN_CLASS PreheatTimerScreen struct PreheatTimerScreenData { uint32_t start_ms; }; class PreheatTimerScreen : public BaseScreen, public CachedScreen<PREHEAT_TIMER_SCREEN_CACHE> { private: static uint16_t secondsRemaining(); static void draw_message(draw_mode_t); static void draw_time_remaining(draw_mode_t); static void draw_interaction_buttons(draw_mode_t); static void draw_adjuster(draw_mode_t, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h); public: static void onRedraw(draw_mode_t); static void onEntry(); static void onIdle(); static bool onTouchHeld(uint8_t tag); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/preheat_screen.h
C++
agpl-3.0
2,127
/************* * screens.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 /********************************* DL CACHE SLOTS ******************************/ // In order to reduce SPI traffic, we cache display lists (DL) in RAMG. This // is done using the CLCD::DLCache class, which takes a unique ID for each // cache location. These IDs are defined here: enum { STATUS_SCREEN_CACHE, MENU_SCREEN_CACHE, TUNE_SCREEN_CACHE, ALERT_BOX_CACHE, SPINNER_CACHE, ADVANCED_SETTINGS_SCREEN_CACHE, MOVE_AXIS_SCREEN_CACHE, TEMPERATURE_SCREEN_CACHE, STEPS_SCREEN_CACHE, MAX_FEEDRATE_SCREEN_CACHE, MAX_VELOCITY_SCREEN_CACHE, MAX_ACCELERATION_SCREEN_CACHE, DEFAULT_ACCELERATION_SCREEN_CACHE, FLOW_PERCENT_SCREEN_CACHE, LEVELING_SCREEN_CACHE, ZOFFSET_SCREEN_CACHE, BED_MESH_VIEW_SCREEN_CACHE, BED_MESH_EDIT_SCREEN_CACHE, STEPPER_CURRENT_SCREEN_CACHE, #if HAS_JUNCTION_DEVIATION JUNC_DEV_SCREEN_CACHE, #else JERK_SCREEN_CACHE, #endif CASE_LIGHT_SCREEN_CACHE, FILAMENT_MENU_CACHE, LINEAR_ADVANCE_SCREEN_CACHE, PREHEAT_MENU_CACHE, PREHEAT_TIMER_SCREEN_CACHE, LOAD_CHOCOLATE_SCREEN_CACHE, MOVE_XYZ_SCREEN_CACHE, MOVE_E_SCREEN_CACHE, FILES_SCREEN_CACHE, INTERFACE_SETTINGS_SCREEN_CACHE, INTERFACE_SOUNDS_SCREEN_CACHE, LOCK_SCREEN_CACHE, DISPLAY_TIMINGS_SCREEN_CACHE }; // To save MCU RAM, the status message is "baked" in to the status screen // cache, so we reserve a large chunk of memory for the DL cache #define STATUS_SCREEN_DL_SIZE 4096 #define ALERT_BOX_DL_SIZE 3072 #define SPINNER_DL_SIZE 3072 #define FILE_SCREEN_DL_SIZE 4160 #define PRINTING_SCREEN_DL_SIZE 2048 /************************* MENU SCREEN DECLARATIONS *************************/ #include "../generic/base_screen.h" #include "../generic/base_numeric_adjustment_screen.h" #include "../generic/dialog_box_base_class.h" #include "../generic/boot_screen.h" #include "../generic/kill_screen.h" #include "../generic/alert_dialog_box.h" #include "../generic/spinner_dialog_box.h" #include "../generic/restore_failsafe_dialog_box.h" #include "../generic/save_settings_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" #include "../generic/move_axis_screen.h" #include "../generic/steps_screen.h" #include "../generic/feedrate_percent_screen.h" #include "../generic/max_velocity_screen.h" #include "../generic/max_acceleration_screen.h" #include "../generic/default_acceleration_screen.h" #include "../generic/temperature_screen.h" #include "../generic/interface_sounds_screen.h" #include "../generic/interface_settings_screen.h" #include "../generic/lock_screen.h" #include "../generic/endstop_state_screen.h" #include "../generic/display_tuning_screen.h" #include "../generic/stepper_current_screen.h" #include "../generic/bed_mesh_base.h" #include "../generic/bed_mesh_view_screen.h" #include "../generic/bed_mesh_edit_screen.h" #include "../generic/linear_advance_screen.h" #include "../generic/move_axis_screen.h" #include "../generic/flow_percent_screen.h" #if HAS_JUNCTION_DEVIATION #include "../generic/junction_deviation_screen.h" #else #include "../generic/jerk_screen.h" #endif #include "status_screen.h" #include "main_menu.h" #include "advanced_settings_menu.h" #include "preheat_menu.h" #include "preheat_screen.h" #include "load_chocolate.h" #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" #include "z_offset_screen.h" #include "z_offset_wizard.h" #include "about_screen.h" #include "statistics_screen.h"
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/screens.h
C
agpl-3.0
5,037
/************************* * statistics_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" #ifdef COCOA_STATISTICS_SCREEN using namespace FTDI; using namespace ExtUI; using namespace Theme; #define GRID_COLS 4 #define GRID_ROWS 7 void StatisticsScreen::onRedraw(draw_mode_t what) { CommandProcessor cmd; if (what & BACKGROUND) { char buffer[21]; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0) .font(Theme::font_medium) .text(BTN_POS(1,1), BTN_SIZE(4,1), GET_TEXT_F(MSG_INFO_STATS_MENU)) .font(Theme::font_small) .tag(0) .text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_PRINT_COUNT), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_PRINT_TIME), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_PRINT_LONGEST), OPT_RIGHTX | OPT_CENTERY) .text(BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), OPT_RIGHTX | OPT_CENTERY); // Don't chain the following, it causes strange issues with evaluation ordering! cmd.text(BTN_POS(3,2), BTN_SIZE(2,1), getTotalPrints_str(buffer)); cmd.text(BTN_POS(3,3), BTN_SIZE(2,1), getFinishedPrints_str(buffer)); cmd.text(BTN_POS(3,4), BTN_SIZE(2,1), getTotalPrintTime_str(buffer)); cmd.text(BTN_POS(3,5), BTN_SIZE(2,1), getLongestPrint_str(buffer)); // Express in grams of chocolate rather than mm const printStatistics stats = print_job_timer.getStats(); const long gramsChocolate = stats.filamentUsed * 0.53; // 1mm of extrusion is 0.53g sprintf_P(buffer, PSTR("%ldg"), gramsChocolate); cmd.text(BTN_POS(3,6), BTN_SIZE(2,1), buffer); } if (what & FOREGROUND) { cmd.font(Theme::font_medium) .colors(action_btn) .tag(1).button(BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE)); } } bool StatisticsScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); return true; default: return false; } } #endif // COCOA_STATISTICS_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/statistics_screen.cpp
C++
agpl-3.0
3,650
/*********************** * statistics_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_STATISTICS_SCREEN #define COCOA_STATISTICS_SCREEN_CLASS StatisticsScreen class StatisticsScreen : public BaseScreen, public UncachedScreen { public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/statistics_screen.h
C++
agpl-3.0
1,668
/********************************* * cocoa_press/status_screen.cpp * *********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_STATUS_SCREEN #include "cocoa_press_ui.h" #include "cocoa_press_bitmap.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 using namespace FTDI; using namespace Theme; using namespace ExtUI; const uint8_t shadow_depth = 5; constexpr static StatusScreenData &mydata = screen_data.StatusScreen; // Format for background image constexpr uint8_t format = RGB332; constexpr uint16_t bitmap_w = 800; constexpr uint16_t bitmap_h = 480; 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) load_utf8_data(base + UTF8_FONT_OFFSET); #endif } void StatusScreen::draw_bkgnd(draw_mode_t what) { if (what & BACKGROUND) { constexpr float scale_w = float(FTDI::display_width)/bitmap_w; constexpr float scale_h = float(FTDI::display_height)/bitmap_h; uint16_t linestride; uint32_t color; switch (format) { case RGB565: linestride = bitmap_w * 2; color = 0xFFFFFF; break; case RGB332: linestride = bitmap_w ; color = 0xFFFFFF; break; case L1: linestride = bitmap_w/8 ; color = 0x000000; break; case L2: linestride = bitmap_w/4 ; color = 0x000000; break; case L4: linestride = bitmap_w/2 ; color = 0x000000; break; case L8: linestride = bitmap_w ; color = 0x000000; break; } CommandProcessor cmd; cmd.cmd(COLOR_RGB(color)) .cmd(BITMAP_SOURCE(BACKGROUND_OFFSET)) .tag(0) .bitmap_layout(format, linestride, bitmap_h) .bitmap_size(NEAREST, BORDER, BORDER, bitmap_w*scale_w, bitmap_h*scale_h) .cmd(BITMAP_TRANSFORM_A(uint32_t(float(256)/scale_w))) .cmd(BITMAP_TRANSFORM_E(uint32_t(float(256)/scale_h))) .cmd(BEGIN(BITMAPS)) .cmd(VERTEX2II(0, 0, 0, 0)) .cmd(BITMAP_TRANSFORM_A(256)) .cmd(BITMAP_TRANSFORM_E(256)) .cmd(COLOR_RGB(bg_text_enabled)); } } void StatusScreen::send_buffer(CommandProcessor &cmd, const void *data, uint16_t len) { const char *ptr = (const char*) data; constexpr uint16_t block_size = 512; char block[block_size]; for (;len > 0;) { const uint16_t nBytes = min(len, block_size); memcpy_P(block, ptr, nBytes); cmd.write((const void*)block, nBytes); cmd.execute(); if(cmd.has_fault()) { SERIAL_ECHOLNPGM("Recovering from fault: "); cmd.reset(); delay(1000); return; } ptr += nBytes; len -= nBytes; } } void StatusScreen::load_background(const void *data, uint16_t len) { CommandProcessor cmd; cmd.inflate(BACKGROUND_OFFSET) .execute(); send_buffer(cmd, data, len); cmd.wait(); } void StatusScreen::draw_time(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); int16_t x, y, w, h; ui.bounds(POLY(print_time_hms), x, y, w, h); if (what & BACKGROUND) { 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(); char elapsed_str[10]; _format_time(elapsed_str, elapsed); cmd.font(font_medium) .cmd(COLOR_RGB(bg_text_enabled)) .text(TEXT_POS(x, y, w, h), elapsed_str); } } void StatusScreen::draw_percent(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); int16_t x, y, w, h; ui.bounds(POLY(print_time_pct), x, y, w, h); if (what & FOREGROUND) { const uint16_t current_progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, getProgress_permyriad(), getProgress_percent() * 100); char progress_str[10]; sprintf_P(progress_str, #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS) PSTR("%3d.%02d%%"), uint8_t(current_progress / 100), current_progress % 100 #else PSTR("%3d%%"), uint8_t(current_progress / 100) #endif ); cmd.font(font_medium) .cmd(COLOR_RGB(bg_text_enabled)) .text(TEXT_POS(x, y, w, h), progress_str); } } void StatusScreen::draw_temperature(draw_mode_t what) { CommandProcessor cmd; PolyUI ui(cmd, what); int16_t x, y, w, h; if (what & BACKGROUND) { cmd.cmd(COLOR_RGB(bg_text_enabled)); cmd.font(font_medium).tag(0); 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(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); // Restore font bitmap handles #endif } if (what & FOREGROUND) { char str[15]; cmd.font(font_medium).colors(normal_btn).tag(10); // Show the actual temperatures format_temp(str, getActualTemp_celsius(E0)); ui.bounds(POLY(h0_temp), x, y, w, h); cmd.button(x, y, w, h, str); format_temp(str, getActualTemp_celsius(E1)); ui.bounds(POLY(h1_temp), x, y, w, h); cmd.button(x, y, w, h, str); } } void StatusScreen::draw_buttons(draw_mode_t what) { if (what & FOREGROUND) { int16_t x, y, w, h; const bool can_print = !isPrinting() && isMediaInserted() && isFileSelected(); const bool can_select = !isPrinting() && isMediaInserted(); const bool sdOrHostPrinting = ExtUI::isPrinting(); const bool sdOrHostPaused = ExtUI::isPrintingPaused(); CommandProcessor cmd; PolyUI ui(cmd, what); cmd.font(font_medium).colors(normal_btn); 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(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, w, h); cmd.tag(3).button(x, y, w, h, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE)); 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(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(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(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(stop_btn), x, y, w, h); cmd.tag(9).enabled(sdOrHostPrinting).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_STOP)); } } // When visible, the file name occupies the same space as the status // message and must be drawn opaque. void StatusScreen::draw_file(draw_mode_t what) { if (mydata.gotMessage) return; if (what & FOREGROUND) { int16_t x, y, w, h; CommandProcessor cmd; PolyUI ui(cmd, what); ui.bounds(POLY(file_name), x, y, w, h); cmd.tag(5) .cmd (COLOR_RGB(bg_color)) .rectangle(x, y, w, h) .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 (!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); } } // The message will be drawn on the background and may be obscured by // the filename. void StatusScreen::draw_message(draw_mode_t what, const char *message) { if (what & BACKGROUND) { int16_t x, y, w, h; CommandProcessor cmd; PolyUI ui(cmd, what); ui.bounds(POLY(file_name), x, y, w, h); cmd.cmd(COLOR_RGB(bg_text_enabled)); draw_text_box(cmd, TEXT_POS(x, y, w, h), message, 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) { if (what & FOREGROUND) { draw_bkgnd(what); draw_file(what); draw_time(what); draw_percent(what); draw_temperature(what); draw_buttons(what); } } bool StatusScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_SCREEN(LoadChocolateScreen); break; case 3: GOTO_SCREEN(PreheatMenu); break; case 4: GOTO_SCREEN(MainMenu); break; case 5: GOTO_SCREEN(FilesScreen); break; case 6: GOTO_SCREEN(ConfirmStartPrintDialogBox); break; case 7: sound.play(twinkle, PLAY_ASYNCHRONOUS); if (ExtUI::isPrintingFromMedia()) ExtUI::pausePrint(); #ifdef ACTION_ON_PAUSE else hostui.pause(); #endif GOTO_SCREEN(StatusScreen); break; case 8: sound.play(twinkle, PLAY_ASYNCHRONOUS); if (ExtUI::isPrintingFromMedia()) ExtUI::resumePrint(); #ifdef ACTION_ON_RESUME else hostui.resume(); #endif GOTO_SCREEN(StatusScreen); break; case 9: GOTO_SCREEN(ConfirmAbortPrintDialogBox); current_screen.forget(); PUSH_SCREEN(StatusScreen); break; case 10: GOTO_SCREEN(TemperatureScreen); break; default: return false; } // If a passcode is enabled, the LockScreen will prevent the // user from proceeding. LockScreen::check_passcode(); return true; } bool StatusScreen::onTouchHeld(uint8_t tag) { if (tag == 2 && !ExtUI::isMoving()) { float increment; LoadChocolateScreen::setManualFeedrateAndIncrement(0.25, increment); UI_INCREMENT(AxisPosition_mm, E0); } return false; } void StatusScreen::setStatusMessage(FSTR_P message) { char buff[strlen_P((const char * const)message)+1]; strcpy_P(buff, (const char * const) message); setStatusMessage((const char *) buff); } void StatusScreen::setStatusMessage(const char * const message) { if (CommandProcessor::is_processing()) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Cannot update status message, command processor busy"); #endif return; } CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)); const draw_mode_t what = BACKGROUND; draw_bkgnd(what); draw_message(what, message); draw_time(what); draw_percent(what); draw_temperature(what); draw_buttons(what); storeBackground(); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("New status message: ", message); #endif mydata.gotMessage = true; if (AT_SCREEN(StatusScreen)) current_screen.onRefresh(); } void StatusScreen::onEntry() { mydata.gotMessage = false; load_background(cocoa_press_ui, sizeof(cocoa_press_ui)); } void StatusScreen::onIdle() { reset_menu_timeout(); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); refresh_timer.start(); } } void StatusScreen::onMediaInserted() { if (AT_SCREEN(StatusScreen)) setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED)); } void StatusScreen::onMediaRemoved() { if (AT_SCREEN(StatusScreen) || ExtUI::isPrintingFromMedia()) setStatusMessage(GET_TEXT_F(MSG_MEDIA_REMOVED)); } #endif // COCOA_STATUS_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp
C++
agpl-3.0
14,448
/******************************* * cocoa_press/status_screen.h * *******************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - Cocoa Press * * * * 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_STATUS_SCREEN #define COCOA_STATUS_SCREEN_CLASS StatusScreen struct StatusScreenData { bool gotMessage; }; class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE, STATUS_SCREEN_DL_SIZE> { private: static void _format_time(char *outstr, uint32_t time); static void draw_time(draw_mode_t what); static void draw_percent(draw_mode_t what); static void draw_temperature(draw_mode_t what); static void draw_buttons(draw_mode_t what); static void draw_file(draw_mode_t what); static void draw_message(draw_mode_t what, const char *message); static void draw_bkgnd(draw_mode_t what); static void send_buffer(CommandProcessor &cmd, const void *data, uint16_t len); static void load_background(const void *data, uint16_t len); static bool isFileSelected(); public: static void loadBitmaps(); static void setStatusMessage(const char *); static void setStatusMessage(FSTR_P); static void onRedraw(draw_mode_t); static void onEntry(); static bool onTouchHeld(uint8_t tag); static bool onTouchEnd(uint8_t tag); static void onIdle(); static void onMediaInserted(); static void onMediaRemoved(); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.h
C++
agpl-3.0
2,742
/*********************** * z_offset_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_Z_OFFSET_SCREEN #include "z_offset_wizard.h" using namespace FTDI; using namespace ExtUI; using namespace Theme; void ZOffsetScreen::onRedraw(draw_mode_t what) { widgets_t w(what); w.precision(2, BaseNumericAdjustmentScreen::DEFAULT_MIDRANGE).units(GET_TEXT_F(MSG_UNITS_MM)); w.heading( GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); w.color(z_axis).adjuster(4, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), getZOffset_mm()); w.increments(); w.button(2, GET_TEXT_F(MSG_PROBE_WIZARD), !isPrinting()); } bool ZOffsetScreen::onTouchHeld(uint8_t tag) { const int16_t steps = TERN(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z), 0); const float increment = TERN(BABYSTEPPING, mmFromWholeSteps(steps, Z), getIncrement()); switch (tag) { case 2: ZOffsetWizard::runWizard(); break; case 4: UI_DECREMENT(ZOffset_mm); TERN(BABYSTEPPING, babystepAxis_steps(-steps, Z), UNUSED(steps)); break; case 5: UI_INCREMENT(ZOffset_mm); TERN(BABYSTEPPING, babystepAxis_steps( steps, Z), UNUSED(steps)); break; default: return false; } SaveSettingsDialogBox::settingsChanged(); return true; } #endif // COCOA_Z_OFFSET_SCREEN
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.cpp
C++
agpl-3.0
2,640
/*********************** * z_offset_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_Z_OFFSET_SCREEN #define COCOA_Z_OFFSET_SCREEN_CLASS ZOffsetScreen class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> { public: static void onRedraw(draw_mode_t); static bool onTouchHeld(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_screen.h
C++
agpl-3.0
1,694
/*********************** * z_offset_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_Z_OFFSET_WIZARD #include "cocoa_press_ui.h" using namespace FTDI; using namespace ExtUI; using namespace Theme; #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) #define SHEET_THICKNESS 0.1 constexpr static ZOffsetWizardData &mydata = screen_data.ZOffsetWizard; void ZOffsetWizard::onEntry() { mydata.increment = 242; mydata.softEndstopState = getSoftEndstopState(); BaseNumericAdjustmentScreen::onEntry(); setSoftEndstopState(false); } void ZOffsetWizard::onExit() { setSoftEndstopState(mydata.softEndstopState); } void ZOffsetWizard::onRedraw(draw_mode_t what) { int16_t x, y, w, h; CommandProcessor cmd; PolyUI ui(cmd, what); cmd.cmd(CLEAR_COLOR_RGB(bg_color)) .cmd(CLEAR(true,true,true)) .tag(0) .font(font_medium).colors(normal_btn); char b[32]; dtostrf(getZOffset_mm(), 5, 2, b); strcat_P(b, PSTR(" mm")); ui.bounds(POLY(z_wizard_edit_box), x, y, w, h); cmd.tag(0).fgcolor(z_axis).button(x, y, w, h, b); #define PREAMBLE(TAG) cmd.tag(TAG).colors(mydata.increment == TAG ? action_btn : normal_btn) ui.bounds(POLY(z_wizard_inc1_btn), x, y, w, h); PREAMBLE(241).button(x, y, w, h, F("0.01")); ui.bounds(POLY(z_wizard_inc2_btn), x, y, w, h); PREAMBLE(242).button(x, y, w, h, F("0.1")); ui.bounds(POLY(z_wizard_inc3_btn), x, y, w, h); PREAMBLE(243).button(x, y, w, h, F("1.0")); ui.bounds(POLY(z_wizard_neg_btn), x, y, w, h); cmd.tag(4).colors(action_btn).button(x, y, w, h, F("")); drawArrow(x, y, w, h, DOWN); ui.bounds(POLY(z_wizard_plus_btn), x, y, w, h); cmd.tag(5).colors(action_btn).button(x, y, w, h, F("")); drawArrow(x, y, w, h, UP); ui.bounds(POLY(z_wizard_done_btn), x, y, w, h); cmd.tag(1).colors(action_btn).button(x, y, w, h, GET_TEXT_F(MSG_BUTTON_DONE)); cmd.tag(0); ui.color(bg_text_enabled); ui.fill(POLY(z_wizard_diagram)); ui.bounds(POLY(z_wizard_heading), x, y, w, h); cmd.font(font_large) .text(x, y, w, h, F("Z Probe Wizard")); } float ZOffsetWizard::getIncrement() { switch (mydata.increment) { case 241: return 0.01; case 242: return 0.1; case 243: return 1.0; default: return 0.0; } } void ZOffsetWizard::runWizard() { // Restore the default Z offset constexpr float offset[] = NOZZLE_TO_PROBE_OFFSET; setZOffset_mm(offset[Z_AXIS]); // Move above probe point char cmd[64], str[10]; strcpy_P(cmd, PSTR("G28 Z\nG0 F1000 X")); dtostrf(TERN(Z_SAFE_HOMING,Z_SAFE_HOMING_X_POINT,X_CENTER), 3, 1, str); strcat(cmd, str); strcat_P(cmd, PSTR("Y")); dtostrf(TERN(Z_SAFE_HOMING,Z_SAFE_HOMING_Y_POINT,Y_CENTER), 3, 1, str); strcat(cmd, str); strcat_P(cmd, PSTR("Z")); dtostrf(SHEET_THICKNESS, 3, 1, str); strcat(cmd, str); injectCommands(cmd); // Show instructions for user. AlertDialogBox::show(F("\nOn the next screen, adjust the Z Offset so that a sheet of paper can pass between the nozzle and bed with slight resistance.\n\nOnce the printer stops moving, press Okay to begin.\n")); // Set the destination screen after the dialog box. current_screen.forget(); PUSH_SCREEN(ZOffsetWizard); } bool ZOffsetWizard::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; case 4: case 5: return onTouchHeld(tag); case 241 ... 243: mydata.increment = tag; break; default: return false; } return true; } bool ZOffsetWizard::onTouchHeld(uint8_t tag) { const float increment = TERN(BABYSTEPPING, mmFromWholeSteps(mmToWholeSteps(getIncrement(), Z), Z), // Round increment to nearest steps getIncrement() ); switch (tag) { case 4: UI_DECREMENT(ZOffset_mm); UI_DECREMENT(AxisPosition_mm, Z); break; case 5: UI_INCREMENT(ZOffset_mm); UI_INCREMENT(AxisPosition_mm, Z); break; default: return false; } SaveSettingsDialogBox::settingsChanged(); return true; } #endif // COCOA_Z_OFFSET_WIZARD
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_wizard.cpp
C++
agpl-3.0
5,392
/*********************** * z_offset_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_Z_OFFSET_WIZARD #define COCOA_Z_OFFSET_WIZARD_CLASS ZOffsetWizard struct ZOffsetWizardData : public BaseNumericAdjustmentScreenData { uint8_t increment; bool softEndstopState; }; class ZOffsetWizard : public BaseScreen, public UncachedScreen { private: static float getIncrement(); public: static void runWizard(); static void onEntry(); static void onExit(); static void onRedraw(draw_mode_t); static bool onTouchHeld(uint8_t tag); static bool onTouchEnd(uint8_t tag); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/z_offset_wizard.h
C++
agpl-3.0
1,942
/************ * compat.h * ************/ /**************************************************************************** * 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 /** * This following provides compatibility whether compiling * as a part of Marlin or outside it */ #ifdef __has_include #if __has_include("../ui_api.h") #include "../ui_api.h" #endif #else #include "../ui_api.h" #endif #ifdef __MARLIN_FIRMWARE__ // __MARLIN_FIRMWARE__ exists when compiled within Marlin. #include "pin_mappings.h" #undef max #define max(a,b) ((a)>(b)?(a):(b)) #undef min #define min(a,b) ((a)<(b)?(a):(b)) #else namespace UI { static uint32_t safe_millis() { return millis(); } static void yield() {} }; #endif class __FlashStringHelper; typedef const __FlashStringHelper *FSTR_P; extern const char G28_STR[];
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/compat.h
C++
agpl-3.0
1,987
/************ * config.h * ************/ /**************************************************************************** * 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 // Configure this display with options in Configuration_adv.h #include "../../../inc/MarlinConfigPre.h" #if ENABLED(TOUCH_UI_FTDI_EVE) #include "compat.h" #endif
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/config.h
C
agpl-3.0
1,472
/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ /** * lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp */ #include "../../../inc/MarlinConfigPre.h" #if ENABLED(TOUCH_UI_FTDI_EVE) #include "screens.h" namespace ExtUI { using namespace Theme; using namespace FTDI; void onStartup() { EventLoop::setup(); } void onIdle() { EventLoop::loop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { char str[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3]; sprintf_P(str, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component)); KillScreen::show(str); } void onMediaInserted() { #if HAS_MEDIA sound.play(media_inserted, PLAY_ASYNCHRONOUS); StatusScreen::onMediaInserted(); #endif } void onMediaError() { sound.play(sad_trombone, PLAY_ASYNCHRONOUS); AlertDialogBox::showError(F("Unable to read media.")); } void onMediaRemoved() { #if HAS_MEDIA if (isPrintingFromMedia()) { stopPrint(); InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED); } else sound.play(media_removed, PLAY_ASYNCHRONOUS); StatusScreen::onMediaRemoved(); FilesScreen::onMediaRemoved(); #endif } void onHeatingError(const heater_id_t header_id) {} void onMinTempError(const heater_id_t header_id) {} void onMaxTempError(const heater_id_t header_id) {} void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); } void onPrintTimerStarted() { InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED); } void onPrintTimerStopped() { InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED); } void onPrintTimerPaused() {} void onPrintDone() {} void onFilamentRunout(const extruder_t extruder) { char lcd_msg[30]; sprintf_P(lcd_msg, PSTR("Extruder %d Filament Error"), extruder + 1); StatusScreen::setStatusMessage(lcd_msg); InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED, FTDI::PLAY_SYNCHRONOUS); } void onHomingStart() {} void onHomingDone() {} void onFactoryReset() { InterfaceSettingsScreen::defaultSettings(); } void onStoreSettings(char *buff) { InterfaceSettingsScreen::saveSettings(buff); } void onLoadSettings(const char *buff) { InterfaceSettingsScreen::loadSettings(buff); } void onPostprocessSettings() {} // Called after loading or resetting stored settings void onSettingsStored(const bool success) { #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE if (success && InterfaceSettingsScreen::backupEEPROM()) { SERIAL_ECHOLNPGM("EEPROM backed up to SPI Flash"); } #else UNUSED(success); #endif } void onSettingsLoaded(const bool) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { sound.play_tone(frequency, duration); } void onUserConfirmRequired(const char * const msg) { if (msg) ConfirmUserRequestAlertBox::show(msg); else ConfirmUserRequestAlertBox::hide(); } // For fancy LCDs include an icon ID, message, and translated button title void onUserConfirmRequired(const int icon, const char * const cstr, FSTR_P const fBtn) { onUserConfirmRequired(cstr); UNUSED(icon); UNUSED(fBtn); } void onUserConfirmRequired(const int icon, FSTR_P const fstr, FSTR_P const fBtn) { onUserConfirmRequired(fstr); UNUSED(icon); UNUSED(fBtn); } #if ENABLED(ADVANCED_PAUSE_FEATURE) void onPauseMode( const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/ ) { stdOnPauseMode(message, mode, extruder); } #endif #if HAS_LEVELING void onLevelingStart() {} void onLevelingDone() {} #if ENABLED(PREHEAT_BEFORE_LEVELING) celsius_t getLevelingBedTemp() { return LEVELING_BED_TEMP; } #endif #endif #if HAS_MESH void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { BedMeshViewScreen::onMeshUpdate(x, y, val); } void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { BedMeshViewScreen::onMeshUpdate(x, y, state); } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) void onSetMinExtrusionTemp(const celsius_t) {} #endif #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled } void onPowerLoss() { // Called when power-loss state is detected } void onPowerLossResume() { // Called on resume from power-loss } #endif #if HAS_PID_HEATING void onPIDTuning(const pidresult_t rst) { // Called for temperature PID tuning result //SERIAL_ECHOLNPGM("OnPIDTuning:", rst); switch (rst) { case PID_STARTED: case PID_BED_STARTED: case PID_CHAMBER_STARTED: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TEMP_TOO_HIGH: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); break; case PID_TUNING_TIMEOUT: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_DONE: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); break; } GOTO_SCREEN(StatusScreen); } void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) { // Called by M303 to update the UI } #endif // HAS_PID_HEATING #if ENABLED(MPC_AUTOTUNE) void onMPCTuning(const mpcresult_t rst) { // Called for temperature PID tuning result switch (rst) { case MPC_STARTED: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MPC_AUTOTUNE)); break; } GOTO_SCREEN(StatusScreen); } #endif #if ENABLED(PLATFORM_M997_SUPPORT) void onFirmwareFlash() {} #endif void onSteppersDisabled() {} void onSteppersEnabled() {} void onAxisDisabled(const axis_t) {} void onAxisEnabled(const axis_t) {} } #endif // TOUCH_UI_FTDI_EVE
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
C++
agpl-3.0
7,094
/************ * boards.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 HAS_RESOLUTION (defined(TOUCH_UI_320x240) || defined(TOUCH_UI_480x272) || defined(TOUCH_UI_800x480)) #define IS_FT800 \ constexpr uint16_t ftdi_chip = 800; \ using namespace FTDI_FT800; \ namespace DL { \ using namespace FTDI_FT800_DL; \ } \ typedef ft800_memory_map ftdi_memory_map; \ typedef ft800_registers ftdi_registers; #define IS_FT810 \ constexpr uint16_t ftdi_chip = 810; \ using namespace FTDI_FT810; \ namespace DL { \ using namespace FTDI_FT800_DL; \ using namespace FTDI_FT810_DL; \ } \ typedef ft810_memory_map ftdi_memory_map; \ typedef ft810_registers ftdi_registers; #ifdef LCD_FTDI_VM800B35A #if !HAS_RESOLUTION #define TOUCH_UI_320x240 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 800 #endif namespace FTDI { IS_FT800 constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; /* 1 = does use GPIO00 for amplifier control, 0 = not in use for Audio */ constexpr bool GPIO_1_Audio_Shutdown = true; /* 1 = does use GPIO01 for amplifier control, 0 = not in use for Audio */ constexpr uint8_t Swizzle = 2; constexpr uint8_t CSpread = 1; constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */ } /** * Settings for the Haoyu Electronics, 4.3" Graphical LCD Touchscreen, 480x272, SPI, FT800 (FT800CB-HY43B) * and 5" Graphical LCD Touchscreen, 480x272, SPI, FT800 (FT800CB-HY50B) * http://www.hotmcu.com/43-graphical-lcd-touchscreen-480x272-spi-ft800-p-111.html?cPath=6_16 * http://www.hotmcu.com/5-graphical-lcd-touchscreen-480x272-spi-ft800-p-124.html?cPath=6_16 * Datasheet: * https://www.hantronix.com/files/data/1278363262430-3.pdf * https://www.haoyuelectronics.com/Attachment/HY43-LCD/LCD%20DataSheet.pdf * https://www.haoyuelectronics.com/Attachment/HY5-LCD-HD/KD50G21-40NT-A1.pdf */ #elif defined(LCD_HAOYU_FT800CB) #if !HAS_RESOLUTION #define TOUCH_UI_480x272 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 800 #endif namespace FTDI { IS_FT800 constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; constexpr bool GPIO_1_Audio_Shutdown = false; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 1; constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */ } /** * Settings for the Haoyu Electronics, 5" Graphical LCD Touchscreen, 800x480, SPI, FT810 * http://www.hotmcu.com/5-graphical-lcd-touchscreen-800x480-spi-ft810-p-286.html * Datasheet: * https://www.haoyuelectronics.com/Attachment/HY5-LCD-HD/KD50G21-40NT-A1.pdf */ #elif defined(LCD_HAOYU_FT810CB) #if !HAS_RESOLUTION #define TOUCH_UI_800x480 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 810 #endif namespace FTDI { IS_FT810 constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; constexpr bool GPIO_1_Audio_Shutdown = false; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 1; constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */ } /** * Settings for the 4D Systems, 4.3" Embedded SPI Display 480x272, SPI, FT800 (4DLCD-FT843) * https://4dsystems.com.au/4dlcd-ft843 * Datasheet: * https://4dsystems.com.au/mwdownloads/download/link/id/52/ */ #elif defined(LCD_4DSYSTEMS_4DLCD_FT843) #if !HAS_RESOLUTION #define TOUCH_UI_480x272 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 800 #endif namespace FTDI { IS_FT800 constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; constexpr bool GPIO_1_Audio_Shutdown = true; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 1; constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */ } /** * Settings for the Aleph Objects Color LCD User Interface * Datasheet https://www.hantronix.com/files/data/s1501799605s500-gh7.pdf */ #elif defined(LCD_LULZBOT_CLCD_UI) #if !HAS_RESOLUTION #define TOUCH_UI_800x480 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 810 #endif namespace FTDI { IS_FT810 constexpr bool Use_Crystal = false; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = true; // The AO CLCD uses GPIO0 to enable audio constexpr bool GPIO_1_Audio_Shutdown = false; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 0; constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */ } /** * FYSETC Color LCD * https://www.aliexpress.com/item/4000627651757.html * Product information: * https://github.com/FYSETC/TFT81050 */ #elif defined(LCD_FYSETC_TFT81050) #if !HAS_RESOLUTION #define TOUCH_UI_800x480 #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 810 #endif namespace FTDI { IS_FT810 constexpr bool Use_Crystal = false; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = true; // The AO CLCD uses GPIO0 to enable audio constexpr bool GPIO_1_Audio_Shutdown = false; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 0; constexpr uint16_t touch_threshold = 2000; /* touch-sensitivity */ } /** * Settings for EVE3-50G - Matrix Orbital 5.0" 800x480, BT815 * https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g * use for example with: https://github.com/RudolphRiedel/EVE_display-adapter */ #elif defined(LCD_EVE3_50G) #if !HAS_RESOLUTION #define TOUCH_UI_800x480 #define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 810 #endif namespace FTDI { IS_FT810 constexpr bool Use_Crystal = true; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; constexpr bool GPIO_1_Audio_Shutdown = false; #define USE_GT911 // this display uses an alternative touch-controller and we need to tell the init function to switch constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 1; constexpr uint8_t Pclkpol = 1; constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */ constexpr uint32_t default_transform_a = 0x000109E4; constexpr uint32_t default_transform_b = 0x000007A6; constexpr uint32_t default_transform_c = 0xFFEC1EBA; constexpr uint32_t default_transform_d = 0x0000072C; constexpr uint32_t default_transform_e = 0x0001096A; constexpr uint32_t default_transform_f = 0xFFF469CF; } /** * Settings for EVE2-50G - Matrix Orbital 5.0" 800x480, FT813 * https://www.matrixorbital.com/ftdi-eve/eve-bt815-bt816/eve3-50g * use for example with: https://github.com/RudolphRiedel/EVE_display-adapter */ #elif defined(LCD_EVE2_50G) #if !HAS_RESOLUTION #define TOUCH_UI_800x480 #define TOUCH_UI_800x480_GENERIC // use more common timing parameters as the original set #endif #ifndef FTDI_API_LEVEL #define FTDI_API_LEVEL 810 #endif namespace FTDI { IS_FT810 constexpr bool Use_Crystal = false; // 0 = use internal oscillator, 1 = module has a crystal populated constexpr bool GPIO_0_Audio_Enable = false; constexpr bool GPIO_1_Audio_Shutdown = false; #define PATCH_GT911 // this display uses an alternative touch-controller and we need to tell the init function to patch the FT813 for it constexpr uint8_t Pclkpol = 1; constexpr uint8_t Swizzle = 0; constexpr uint8_t CSpread = 1; constexpr uint16_t touch_threshold = 1200; /* touch-sensitivity */ constexpr uint32_t default_transform_a = 0x000109E4; constexpr uint32_t default_transform_b = 0x000007A6; constexpr uint32_t default_transform_c = 0xFFEC1EBA; constexpr uint32_t default_transform_d = 0x0000072C; constexpr uint32_t default_transform_e = 0x0001096A; constexpr uint32_t default_transform_f = 0xFFF469CF; } #else #error "Unknown or no TOUCH_UI_FTDI_EVE board specified. To add a new board, modify this file." #endif /* this data is used to patch FT813 displays that use a GT911 as a touch-controller */ #ifdef PATCH_GT911 constexpr PROGMEM unsigned char GT911_data[] = { 26,255,255,255,32,32,48,0,4,0,0,0,2,0,0,0, 34,255,255,255,0,176,48,0,120,218,237,84,221,111,84,69,20,63,51,179,93,160,148,101,111,76,5,44,141,123,111,161,11,219,154,16,9,16,17,229,156,75,26,11,13,21,227,3,16,252,184,179, 45,219,143,45,41,125,144,72,67,100,150,71,189,113,18,36,17,165,100,165,198,16,32,17,149,196,240,128,161,16,164,38,54,240,0,209,72,130,15,38,125,48,66,82,30,76,19,31,172,103,46, 139,24,255,4,227,157,204,156,51,115,102,206,231,239,220,5,170,94,129,137,75,194,216,98,94,103,117,115,121,76,131,177,125,89,125,82,123,60,243,58,142,242,204,185,243,188,118,156, 227,155,203,238,238,195,251,205,229,71,92,28,169,190,184,84,143,113,137,53,244,103,181,237,87,253,113,137,233,48,12,198,165,181,104,139,25,84,253,155,114,74,191,0,54,138,163, 12,62,131,207,129,23,217,34,91,31,128,65,246,163,175,213,8,147,213,107,35,203,94,108,3,111,40,171,83,24,15,165,177,222,116,97,23,188,140,206,150,42,102,181,87,78,86,182,170,134, 215,241,121,26,243,252,2,76,115,217,139,222,206,173,136,132,81,61,35,185,39,113,23,46,199,76,178,54,151,183,224,0,40,189,28,149,182,58,131,79,152,30,76,34,98,234,162,216,133,141, 102,39,170,40,192,101,53,201,146,191,37,77,44,177,209,74,211,5,206,187,5,6,216,47,53,96,123,22,50,103,251,192,84,17,74,227,185,56,106,51,91,161,96,182,163,48,171,141,139,65,152, 66,66,11,102,43,158,75,36,80,147,184,147,139,112,17,235,216,103,111,239,245,92,10,175,194,40,44,58,125,5,59,112,50,103,245,4,78,192,5,156,194,51,60,191,134,75,110,173,237,46,192, 121,156,192,115,184,218,120,67,63,115,46,11,102,10,97,232,50,235,114,182,148,118,178,41,188,12,135,77,202,124,12,96,238,35,161,234,189,129,23,249,212,139,230,25,53,48,205,52,93, 163,117,53,154,170,81,85,163,178,70,69,66,167,241,14,46,241,1,226,136,152,179,197,59,184,148,254,49,132,48,15,176,137,192,76,131,196,105,104,162,86,81,160,165,255,26,173,162,137, 86,145,210,183,192,55,175,194,211,60,91,120,230,184,174,27,41,131,155,40,224,29,87,179,232,16,55,55,7,165,147,81,23,165,49,101,54,224,75,180,81,108,18,29,226,69,225,110,175,224, 42,212,25,47,130,193,110,234,192,215,252,56,74,162,24,46,251,174,54,106,68,245,14,9,155,160,22,120,207,104,240,29,90,178,140,28,24,220,47,166,112,61,251,208,192,111,56,239,238, 93,255,251,62,99,32,193,75,61,190,235,123,229,110,218,194,85,79,225,59,98,20,238,227,235,220,11,221,149,25,180,116,194,159,111,96,192,24,213,59,139,179,156,215,69,230,19,24,35, 135,117,206,171,206,162,67,129,234,61,235,11,104,103,84,64,223,167,254,40,163,101,92,84,43,150,46,249,219,205,7,116,11,91,104,61,57,75,223,8,48,25,28,119,252,222,113,49,86,249, 74,180,211,156,181,61,215,168,157,7,251,199,150,242,250,91,58,132,94,121,7,53,151,139,98,6,165,153,69,214,32,110,211,100,101,31,89,45,81,98,23,205,205,197,209,109,186,198,35, 141,191,249,25,60,132,223,153,251,98,20,239,146,139,20,217,250,41,250,137,58,177,90,57,79,51,108,233,20,253,194,187,49,222,205,114,141,96,48,175,219,107,54,111,138,22,154,103, 108,79,58,252,179,178,79,164,195,2,153,36,39,170,199,201,167,197,85,106,8,59,177,81,46,56,2,230,75,114,17,55,112,188,65,208,137,77,114,10,115,55,58,208,197,173,122,87,6,140, 110,42,208,124,163,70,108,241,104,18,245,98,214,187,134,53,42,221,22,182,133,211,116,148,177,194,209,192,85,90,199,58,55,203,2,229,19,137,187,161,228,154,112,203,145,125,244, 188,220,118,228,41,201,181,41,195,144,215,183,51,80,250,21,217,16,217,200,235,109,227,188,122,218,142,60,170,224,112,240,184,130,229,224,113,5,223,148,163,80,165,183,130,187, 132,116,64,238,161,85,220,115,139,205,98,227,244,29,102,125,7,37,243,123,223,11,26,92,63,243,116,61,191,138,123,244,160,84,186,74,31,5,174,247,119,135,199,248,253,135,242,97, 102,145,190,144,14,85,238,221,231,193,158,48,205,25,120,248,15,220,29,158,9,70,185,30,103,229,33,254,23,237,160,172,62,193,90,222,224,232,14,200,56,90,104,142,227,120,110,6, 21,211,203,65,150,99,151,220,247,87,164,50,159,49,239,234,58,142,0,109,108,123,18,79,227,36,100,248,222,205,96,127,120,26,171,228,69,63,36,17,252,200,17,116,242,187,227,88,143, 247,2,75,191,6,130,59,188,11,55,240,31,243,122,152,226,183,207,154,73,188,39,219,43,105,222,87,41,143,141,140,175,73,112,184,252,61,184,16,90,250,35,168,82,119,176,57,116,94, 200,150,22,190,179,44,104,12,235,84,149,102,252,89,154,193,99,228,106,242,125,248,64,194,255,223,127,242,83,11,255,2,70,214,226,128,0,0 }; #endif // PATCH_GT911
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/boards.h
C++
agpl-3.0
14,763
/**************** * commands.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 "ftdi_basic.h" #ifdef FTDI_BASIC #define MULTIPLE_OF_4(val) ((((val)+3)>>2)<<2) using namespace FTDI; using namespace FTDI::SPI; void CLCD::enable() { mem_write_8(REG::PCLK, Pclk); } void CLCD::disable() { mem_write_8(REG::PCLK, 0x00); } void CLCD::set_brightness(uint8_t brightness) { mem_write_8(REG::PWM_DUTY, min(128,brightness)); } uint8_t CLCD::get_brightness() { return mem_read_8(REG::PWM_DUTY); } void CLCD::turn_on_backlight() { mem_write_8(REG::PWM_DUTY, 128); } void CLCD::FontMetrics::load(const uint8_t font) { static_assert(sizeof(FontMetrics) == 148, "Sizeof font metrics is incorrect"); uint32_t rom_fontroot = mem_read_32(MAP::ROM_FONT_ADDR); mem_read_bulk(rom_fontroot + 148 * (font - 16), (uint8_t*) this, 148); } uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const { uint16_t width = 0; const uint8_t *p = (const uint8_t *) str; for (;;) { const uint8_t val = *p++; n--; if (!val || n == 0) break; width += val < 128 ? char_widths[val] : 0; } return width; } uint16_t CLCD::FontMetrics::get_text_width(FSTR_P str, size_t n) const { uint16_t width = 0; const uint8_t *p = (const uint8_t *) str; for (;;) { const uint8_t val = pgm_read_byte(p++); n--; if (!val || n == 0) break; width += val < 128 ? char_widths[val] : 0; } return width; } /************************** HOST COMMAND FUNCTION *********************************/ void CLCD::host_cmd(unsigned char host_command, unsigned char byte2) { // Sends 24-Bit Host Command to LCD if (host_command != FTDI::ACTIVE) { host_command |= 0x40; } spi_ftdi_select(); spi_send(host_command); spi_send(byte2); spi_send(0x00); spi_ftdi_deselect(); } /************************** MEMORY READ FUNCTIONS *********************************/ void CLCD::spi_read_addr(uint32_t reg_address) { spi_send((reg_address >> 16) & 0x3F); // Address [21:16] spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8] spi_send((reg_address >> 0) & 0xFF); // Address [7:0] spi_send(0x00); // Dummy Byte } // Write 4-Byte Address, Read Multiple Bytes void CLCD::mem_read_bulk(uint32_t reg_address, uint8_t *data, uint16_t len) { spi_ftdi_select(); spi_read_addr(reg_address); spi_read_bulk (data, len); spi_ftdi_deselect(); } // Write 4-Byte Address, Read 1-Byte Data uint8_t CLCD::mem_read_8(uint32_t reg_address) { spi_ftdi_select(); spi_read_addr(reg_address); uint8_t r_data = spi_read_8(); spi_ftdi_deselect(); return r_data; } // Write 4-Byte Address, Read 2-Bytes Data uint16_t CLCD::mem_read_16(uint32_t reg_address) { using namespace SPI::least_significant_byte_first; spi_ftdi_select(); spi_read_addr(reg_address); uint16_t r_data = spi_read_16(); spi_ftdi_deselect(); return r_data; } // Write 4-Byte Address, Read 4-Bytes Data uint32_t CLCD::mem_read_32(uint32_t reg_address) { using namespace SPI::least_significant_byte_first; spi_ftdi_select(); spi_read_addr(reg_address); uint32_t r_data = spi_read_32(); spi_ftdi_deselect(); return r_data; } /************************** MEMORY WRITE FUNCTIONS *********************************/ // Generic operations for transforming a byte, for use with _mem_write_bulk: static inline uint8_t reverse_byte(uint8_t a) { return ((a & 0x1) << 7) | ((a & 0x2) << 5) | ((a & 0x4) << 3) | ((a & 0x8) << 1) | ((a & 0x10) >> 1) | ((a & 0x20) >> 3) | ((a & 0x40) >> 5) | ((a & 0x80) >> 7); } static inline uint8_t xbm_write(const uint8_t *p) {return reverse_byte(pgm_read_byte(p));} void CLCD::spi_write_addr(uint32_t reg_address) { spi_send((reg_address >> 16) | 0x80); // Address [21:16] spi_send((reg_address >> 8 ) & 0xFF); // Address [15:8] spi_send((reg_address >> 0) & 0xFF); // Address [7:0] } // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from RAM void CLCD::mem_write_bulk(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_bulk<ram_write>(data, len, padding); spi_ftdi_deselect(); } // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM void CLCD::mem_write_bulk(uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_bulk<pgm_write>(str, len, padding); spi_ftdi_deselect(); } // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM void CLCD::mem_write_pgm(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_bulk<pgm_write>(data, len, padding); spi_ftdi_deselect(); } // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images) void CLCD::mem_write_xbm(uint32_t reg_address, const void *data, uint16_t len, uint8_t padding) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_bulk<xbm_write>(data, len, padding); spi_ftdi_deselect(); } // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images) void CLCD::mem_write_xbm(uint32_t reg_address, FSTR_P data, uint16_t len, uint8_t padding) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_bulk<xbm_write>(data, len, padding); spi_ftdi_deselect(); } // Write 3-Byte Address, Write 1-Byte Data void CLCD::mem_write_8(uint32_t reg_address, uint8_t data) { spi_ftdi_select(); spi_write_addr(reg_address); spi_write_8(data); spi_ftdi_deselect(); } // Write 3-Byte Address, Write 2-Bytes Data void CLCD::mem_write_16(uint32_t reg_address, uint16_t data) { using namespace SPI::least_significant_byte_first; spi_ftdi_select(); spi_write_addr(reg_address); spi_write_16(data); spi_ftdi_deselect(); } // Write 3-Byte Address, Write 4-Bytes Data void CLCD::mem_write_32(uint32_t reg_address, uint32_t data) { using namespace SPI::least_significant_byte_first; spi_ftdi_select(); spi_write_addr(reg_address); spi_write_32(data); spi_ftdi_deselect(); } // Fill area of len size with repeated data bytes void CLCD::mem_write_fill(uint32_t reg_address, uint8_t data, uint16_t len) { spi_ftdi_select(); spi_write_addr(reg_address); while (len--) spi_write_8(data); spi_ftdi_deselect(); } /******************* FT800/810 Co-processor Commands *********************************/ #if FTDI_API_LEVEL == 800 uint32_t CLCD::CommandFifo::command_write_ptr = 0xFFFFFFFFul; #endif void CLCD::CommandFifo::cmd(uint32_t cmd32) { write((void*)&cmd32, sizeof(uint32_t)); } void CLCD::CommandFifo::cmd(void *data, uint16_t len) { write(data, len); } void CLCD::CommandFifo::bgcolor(uint32_t rgb) { cmd(CMD_BGCOLOR); cmd(rgb); } void CLCD::CommandFifo::fgcolor(uint32_t rgb) { cmd(CMD_FGCOLOR); cmd(rgb); } void CLCD::CommandFifo::gradcolor(uint32_t rgb) { cmd(CMD_GRADCOLOR); cmd(rgb); } // This sends the a text command to the command preprocessor, must be followed by str() void CLCD::CommandFifo::button(int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t option) { struct { int32_t type = CMD_BUTTON; int16_t x; int16_t y; int16_t w; int16_t h; int16_t font; uint16_t option; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.font = font; cmd_data.option = option; cmd( &cmd_data, sizeof(cmd_data) ); } // This sends the a text command to the command preprocessor, must be followed by str() void CLCD::CommandFifo::text(int16_t x, int16_t y, int16_t font, uint16_t options) { struct { int32_t type = CMD_TEXT; int16_t x; int16_t y; int16_t font; uint16_t options; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.font = font; cmd_data.options = options; cmd( &cmd_data, sizeof(cmd_data) ); } // This sends the a toggle command to the command preprocessor, must be followed by str() void CLCD::CommandFifo::toggle(int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state) { struct { int32_t type = CMD_TOGGLE; int16_t x; int16_t y; int16_t w; int16_t font; uint16_t options; uint16_t state; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.font = font; cmd_data.options = options; cmd_data.state = state ? 65535 : 0; cmd( &cmd_data, sizeof(cmd_data) ); } // This sends the a keys command to the command preprocessor, must be followed by str() void CLCD::CommandFifo::keys(int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options) { struct { int32_t type = CMD_KEYS; int16_t x; int16_t y; int16_t w; int16_t h; int16_t font; uint16_t options; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.font = font; cmd_data.options = options; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::clock(int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms) { struct { int32_t type = CMD_CLOCK; int16_t x; int16_t y; int16_t r; uint16_t options; int16_t h; int16_t m; int16_t s; int16_t ms; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.r = r; cmd_data.options = options; cmd_data.h = h; cmd_data.m = m; cmd_data.s = s; cmd_data.ms = ms; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::gauge(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range) { struct { int32_t type = CMD_GAUGE; int16_t x; int16_t y; int16_t r; uint16_t options; uint16_t major; uint16_t minor; uint16_t val; uint16_t range; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.r = r; cmd_data.options = options; cmd_data.major = major; cmd_data.minor = minor; cmd_data.val = val; cmd_data.range = range; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::dial(int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val) { struct { int32_t type = CMD_DIAL; int16_t x; int16_t y; int16_t r; uint16_t options; uint16_t val; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.r = r; cmd_data.options = options; cmd_data.val = val; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::scrollbar(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range) { struct { int32_t type = CMD_SCROLLBAR; int16_t x; int16_t y; int16_t w; uint16_t h; uint16_t options; uint16_t val; uint16_t size; uint16_t range; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.options = options; cmd_data.val = val; cmd_data.size = size; cmd_data.range = range; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::progress(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) { struct { int32_t type = CMD_PROGRESS; int16_t x; int16_t y; int16_t w; int16_t h; uint16_t options; uint16_t val; uint16_t range; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.options = options; cmd_data.val = val; cmd_data.range = range; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::slider(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range) { struct { int32_t type = CMD_SLIDER; int16_t x; int16_t y; int16_t w; int16_t h; uint16_t options; uint16_t val; uint16_t range; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.options = options; cmd_data.val = val; cmd_data.range = range; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::gradient(int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) { struct { int32_t type = CMD_GRADIENT; int16_t x0; int16_t y0; uint32_t rgb0; int16_t x1; int16_t y1; uint32_t rgb1; } cmd_data; cmd_data.x0 = x0; cmd_data.y0 = y0; cmd_data.rgb0 = rgb0; cmd_data.x1 = x1; cmd_data.y1 = y1; cmd_data.rgb1 = rgb1; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::number(int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n) { struct { int32_t type = CMD_NUMBER; int16_t x; int16_t y; int16_t font; uint16_t options; int16_t n; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.font = font; cmd_data.options = options; cmd_data.n = n; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::memzero(uint32_t ptr, uint32_t size) { struct { uint32_t type = CMD_MEMZERO; uint32_t ptr; uint32_t size; } cmd_data; cmd_data.ptr = ptr; cmd_data.size = size; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::memset(uint32_t ptr, uint32_t val, uint32_t size) { struct { uint32_t type = CMD_MEMSET; uint32_t ptr; uint32_t val; uint32_t size; } cmd_data; cmd_data.ptr = ptr; cmd_data.val = val; cmd_data.size = size; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::memcpy(uint32_t dst, uint32_t src, uint32_t size) { struct { uint32_t type = CMD_MEMCPY; uint32_t dst; uint32_t src; uint32_t size; } cmd_data; cmd_data.dst = dst; cmd_data.src = src; cmd_data.size = size; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::memcrc(uint32_t ptr, uint32_t num, uint32_t result) { struct { uint32_t type = CMD_MEMCRC; uint32_t ptr; uint32_t num; uint32_t result; } cmd_data; cmd_data.ptr = ptr; cmd_data.num = num; cmd_data.result = result; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::memwrite(uint32_t ptr, uint32_t value) { struct { uint32_t type = CMD_MEMWRITE; uint32_t ptr; uint32_t num; uint32_t value; } cmd_data; cmd_data.ptr = ptr; cmd_data.num = 4; cmd_data.value = value; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::append(uint32_t ptr, uint32_t size) { struct { uint32_t type = CMD_APPEND; uint32_t ptr; uint32_t size; } cmd_data; cmd_data.ptr = ptr; cmd_data.size = size; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::inflate(uint32_t ptr) { struct { uint32_t type = CMD_INFLATE; uint32_t ptr; } cmd_data; cmd_data.ptr = ptr; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::getptr(uint32_t result) { struct { uint32_t type = CMD_GETPTR; uint32_t result; } cmd_data; cmd_data.result = result; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::track(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t tag) { struct { uint32_t type = CMD_TRACK; int16_t x; int16_t y; int16_t w; int16_t h; int16_t tag; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.tag = tag; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::sketch(int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t ptr, uint16_t format) { struct { uint32_t type = CMD_SKETCH; int16_t x; int16_t y; uint16_t w; uint16_t h; uint32_t ptr; uint16_t format; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd_data.ptr = ptr; cmd_data.format = format; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::snapshot(uint32_t ptr) { struct { uint32_t type = CMD_SNAPSHOT; uint32_t ptr; } cmd_data; cmd_data.ptr = ptr; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::spinner(int16_t x, int16_t y, uint16_t style, uint16_t scale) { struct { uint32_t type = CMD_SPINNER; uint16_t x; uint16_t y; uint16_t style; uint16_t scale; } cmd_data; cmd_data.x = x; cmd_data.y = y; cmd_data.style = style; cmd_data.scale = scale; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::loadimage(uint32_t ptr, uint32_t options) { struct { uint32_t type = CMD_LOADIMAGE; uint32_t ptr; uint32_t options; } cmd_data; cmd_data.ptr = ptr; cmd_data.options = options; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::getprops(uint32_t ptr, uint32_t width, uint32_t height) { struct { uint32_t type = CMD_GETPROPS; uint32_t ptr; uint32_t width; uint32_t height; } cmd_data; cmd_data.ptr = ptr; cmd_data.width = width; cmd_data.height = height; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::scale(int32_t sx, int32_t sy) { struct { uint32_t type = CMD_SCALE; int32_t sx; int32_t sy; } cmd_data; cmd_data.sx = sx; cmd_data.sy = sy; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::rotate(int32_t a) { struct { uint32_t type = CMD_ROTATE; int32_t a; } cmd_data; cmd_data.a = a; cmd( &cmd_data, sizeof(cmd_data) ); } void CLCD::CommandFifo::translate(int32_t tx, int32_t ty) { struct { uint32_t type = CMD_TRANSLATE; int32_t tx; int32_t ty; } cmd_data; cmd_data.tx = tx; cmd_data.ty = ty; cmd( &cmd_data, sizeof(cmd_data) ); } #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::setbase(uint8_t base) { struct { int32_t type = CMD_SETBASE; uint32_t base; } cmd_data; cmd_data.base = base; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::setbitmap(uint32_t addr, uint16_t fmt, uint16_t w, uint16_t h) { struct { uint32_t type = CMD_SETBITMAP; uint32_t addr; uint16_t fmt; uint16_t w; uint16_t h; uint16_t dummy; } cmd_data; cmd_data.addr = addr; cmd_data.fmt = fmt; cmd_data.w = w; cmd_data.h = h; cmd_data.dummy = 0; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::snapshot2(uint32_t format, uint32_t ptr, int16_t x, int16_t y, uint16_t w, uint16_t h) { struct { uint32_t type = CMD_SNAPSHOT2; uint32_t format; uint32_t ptr; int16_t x; int16_t y; uint16_t w; uint16_t h; } cmd_data; cmd_data.format = format; cmd_data.ptr = ptr; cmd_data.x = x; cmd_data.y = y; cmd_data.w = w; cmd_data.h = h; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::mediafifo(uint32_t ptr, uint32_t size) { struct { uint32_t type = CMD_MEDIAFIFO; uint32_t ptr; uint32_t size; } cmd_data; cmd_data.ptr = ptr; cmd_data.size = size; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::videostart() { cmd( CMD_VIDEOSTART ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::videoframe(uint32_t dst, uint32_t ptr) { struct { uint32_t type = CMD_VIDEOFRAME; uint32_t dst; uint32_t ptr; } cmd_data; cmd_data.dst = dst; cmd_data.ptr = ptr; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::playvideo(uint32_t options) { struct { uint32_t type = CMD_PLAYVIDEO; uint32_t options; } cmd_data; cmd_data.options = options; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::setrotate(uint8_t rotation) { struct { uint32_t type = CMD_SETROTATE; uint32_t rotation; } cmd_data; cmd_data.rotation = rotation; cmd( &cmd_data, sizeof(cmd_data) ); } #endif #if FTDI_API_LEVEL >= 810 void CLCD::CommandFifo::romfont(uint8_t font, uint8_t romslot) { struct { uint32_t type = CMD_ROMFONT; uint32_t font; uint32_t romslot; } cmd_data; cmd_data.font = font; cmd_data.romslot = romslot; cmd( &cmd_data, sizeof(cmd_data) ); } #endif /**************************** FT800/810 Co-Processor Command FIFO ****************************/ bool CLCD::CommandFifo::is_processing() { return (mem_read_32(REG::CMD_READ) & 0x0FFF) != (mem_read_32(REG::CMD_WRITE) & 0x0FFF); } bool CLCD::CommandFifo::has_fault() { uint16_t Cmd_Read_Reg = mem_read_32(REG::CMD_READ) & 0x0FFF; return Cmd_Read_Reg == 0x0FFF; } #if FTDI_API_LEVEL == 800 void CLCD::CommandFifo::start() { if (command_write_ptr == 0xFFFFFFFFul) { command_write_ptr = mem_read_32(REG::CMD_WRITE) & 0x0FFF; } } void CLCD::CommandFifo::execute() { if (command_write_ptr != 0xFFFFFFFFul) { mem_write_32(REG::CMD_WRITE, command_write_ptr); } } void CLCD::CommandFifo::reset() { safe_delay(100); mem_write_32(REG::CPURESET, 0x00000001); mem_write_32(REG::CMD_WRITE, 0x00000000); mem_write_32(REG::CMD_READ, 0x00000000); mem_write_32(REG::CPURESET, 0x00000000); safe_delay(300); command_write_ptr = 0xFFFFFFFFul; }; template <class T> bool CLCD::CommandFifo::_write_unaligned(T data, uint16_t len) { const char *ptr = (const char*)data; uint32_t bytes_tail, bytes_head; uint32_t command_read_ptr; #if ENABLED(TOUCH_UI_DEBUG) if (command_write_ptr == 0xFFFFFFFFul) SERIAL_ECHO_MSG("Attempt to write to FIFO before CommandFifo::Cmd_Start()."); #endif /* Wait until there is enough space in the circular buffer for the transfer */ do { command_read_ptr = mem_read_32(REG::CMD_READ) & 0x0FFF; if (command_read_ptr <= command_write_ptr) { bytes_tail = 4096U - command_write_ptr; bytes_head = command_read_ptr; } else { bytes_tail = command_read_ptr - command_write_ptr; bytes_head = 0; } // Check for faults which can lock up the command processor if (has_fault()) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("Fault waiting for space in the command processor"); #endif return false; } } while ((bytes_tail + bytes_head) < len); /* Write as many bytes as possible following REG::CMD_WRITE */ uint16_t bytes_to_write = min(len, bytes_tail); mem_write_bulk (MAP::RAM_CMD + command_write_ptr, T(ptr), bytes_to_write); command_write_ptr += bytes_to_write; ptr += bytes_to_write; len -= bytes_to_write; if (len > 0) { /* Write remaining bytes at start of circular buffer */ mem_write_bulk (MAP::RAM_CMD, T(ptr), len); command_write_ptr = len; } if (command_write_ptr == 4096U) { command_write_ptr = 0; } return true; } // Writes len bytes into the FIFO, if len is not // divisible by four, zero bytes will be written // to align to the boundary. template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) { const uint8_t padding = MULTIPLE_OF_4(len) - len; const uint8_t pad_bytes[] = { 0, 0, 0, 0 }; return _write_unaligned(data, len) && _write_unaligned(pad_bytes, padding); } #else // FTDI_API_LEVEL != 800 ... void CLCD::CommandFifo::start() { } void CLCD::CommandFifo::execute() { } void CLCD::CommandFifo::reset() { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("Resetting command processor"); #endif safe_delay(100); mem_write_32(REG::CPURESET, 0x00000001); mem_write_32(REG::CMD_WRITE, 0x00000000); mem_write_32(REG::CMD_READ, 0x00000000); mem_write_32(REG::CPURESET, 0x00000000); safe_delay(300); }; // Writes len bytes into the FIFO, if len is not // divisible by four, zero bytes will be written // to align to the boundary. template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) { const uint8_t padding = MULTIPLE_OF_4(len) - len; if (has_fault()) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("Faulted... ignoring write."); #endif return false; } // The FT810 provides a special register that can be used // for writing data without us having to do our own FIFO // management. uint16_t Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; if (Command_Space < (len + padding)) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Waiting for ", len + padding, " bytes in command queue, now free: ", Command_Space); #endif do { Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; if (has_fault()) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("... fault"); #endif return false; } } while (Command_Space < len + padding); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("... done"); #endif } mem_write_bulk(REG::CMDB_WRITE, data, len, padding); return true; } #endif // ... FTDI_API_LEVEL != 800 template bool CLCD::CommandFifo::write(const void*, uint16_t); template bool CLCD::CommandFifo::write(FSTR_P, uint16_t); // CO_PROCESSOR COMMANDS void CLCD::CommandFifo::str(const char * data, size_t maxlen) { // Write the string without the terminating '\0' const size_t len = strnlen(data, maxlen); write(data, len); // If padding was added by the previous write, then // the string is terminated. Otherwise write four // more zeros. const uint8_t padding = MULTIPLE_OF_4(len) - len; if (padding == 0) { const uint8_t pad_bytes[] = {0, 0, 0, 0}; write(pad_bytes, 4); } } void CLCD::CommandFifo::str(const char * data) { write(data, strlen(data)+1); } void CLCD::CommandFifo::str(FSTR_P data) { write(data, strlen_P((const char*)data)+1); } /******************* LCD INITIALIZATION ************************/ void CLCD::init() { spi_init(); // Set Up I/O Lines for SPI and FT800/810 Control ftdi_reset(); // Power down/up the FT8xx with the appropriate delays host_cmd(Use_Crystal ? CLKEXT : CLKINT, 0); host_cmd(FTDI::ACTIVE, 0); // Activate the System Clock delay(40); // FTDI/BRT recommendation: no SPI traffic during startup. EVE needs at the very least 45ms to start, so leave her alone for a little while. /* read the device-id until it returns 0x7C or times out, should take less than 150ms */ uint8_t counter; for (counter = 0; counter < 250; counter++) { uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C; if (device_id == 0x7C) { if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip initialized "); break; } else delay(1); if (TERN0(TOUCH_UI_DEBUG, counter > 248)) SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", device_id); } /* Ensure all units are in working condition, usually the touch-controller needs a little more time */ for (counter = 0; counter < 100; counter++) { uint8_t reset_status = mem_read_8(REG::CPURESET) & 0x03; if (reset_status == 0x00) { if (ENABLED(TOUCH_UI_DEBUG)) SERIAL_ECHO_MSG("FTDI chip all units running "); break; } else delay(1); if (TERN0(TOUCH_UI_DEBUG, counter > 98)) SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", reset_status); } #if ENABLED(USE_GT911) /* switch BT815 to use Goodix GT911 touch controller */ mem_write_32(REG::TOUCH_CONFIG, 0x000005D1); #endif #if ENABLED(PATCH_GT911) /* patch FT813 use Goodix GT911 touch controller */ mem_write_pgm(REG::CMDB_WRITE, GT911_data, sizeof(GT911_data)); /* write binary blob to command-fifo */ delay(10); mem_write_8(REG::TOUCH_OVERSAMPLE, 0x0F); /* setup oversample to 0x0f as "hidden" in binary-blob for AN_336 */ mem_write_16(REG::TOUCH_CONFIG, 0x05d0); /* write magic cookie as requested by AN_336 */ /* specific to the EVE2 modules from Matrix-Orbital we have to use GPIO3 to reset GT911 */ mem_write_16(REG::GPIOX_DIR,0x8008); /* Reset-Value is 0x8000, adding 0x08 sets GPIO3 to output, default-value for REG_GPIOX is 0x8000 -> Low output on GPIO3 */ delay(1); /* wait more than 100µs */ mem_write_8(REG::CPURESET, 0x00); /* clear all resets */ delay(56); /* wait more than 55ms */ mem_write_16(REG::GPIOX_DIR,0x8000); /* setting GPIO3 back to input */ #endif mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default /* Configure the FT8xx Registers */ mem_write_16(REG::HCYCLE, FTDI::Hcycle); mem_write_16(REG::HOFFSET, FTDI::Hoffset); mem_write_16(REG::HSYNC0, FTDI::Hsync0); mem_write_16(REG::HSYNC1, FTDI::Hsync1); mem_write_16(REG::VCYCLE, FTDI::Vcycle); mem_write_16(REG::VOFFSET, FTDI::Voffset); mem_write_16(REG::VSYNC0, FTDI::Vsync0); mem_write_16(REG::VSYNC1, FTDI::Vsync1); mem_write_16(REG::HSIZE, FTDI::Hsize); mem_write_16(REG::VSIZE, FTDI::Vsize); mem_write_8(REG::SWIZZLE, FTDI::Swizzle); mem_write_8(REG::PCLK_POL, FTDI::Pclkpol); mem_write_8(REG::CSPREAD, FTDI::CSpread); /* write a basic display-list to get things started */ mem_write_32(MAP::RAM_DL, DL::CLEAR_COLOR_RGB); mem_write_32(MAP::RAM_DL + 4, (DL::CLEAR | 0x07)); /* clear color, stencil and tag buffer */ mem_write_32(MAP::RAM_DL + 8, DL::DL_DISPLAY); /* end of display list */ mem_write_8(REG::DLSWAP, 0x02); // activate display list, Bad Magic Cookie 2 = switch to new list after current frame is scanned out //mem_write_8(REG::TOUCH_MODE, 0x03); // Configure the Touch Screen, Bad Magic Cookie, 3 = CONTINUOUS = Reset Default //mem_write_8(REG::TOUCH_ADC_MODE, 0x01); // Bad Magic Cookie, 1 = single touch = Reset Default //mem_write_8(REG::TOUCH_OVERSAMPLE, 0x0F); // Reset Default = 7 - why 15? mem_write_16(REG::TOUCH_RZTHRESH, touch_threshold); /* setup touch sensitivity */ mem_write_8(REG::VOL_SOUND, 0x00); // Turn Synthesizer Volume Off /* turn on the display by setting DISP high */ /* turn on the Audio Amplifier by setting GPIO_1 high for the select few modules supporting this */ /* no need to use GPIOX here since DISP/GPIO_0 and GPIO_1 are on REG::GPIO for FT81x as well */ if (GPIO_1_Audio_Shutdown) { mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP1); mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP1); } else if (GPIO_0_Audio_Enable) { mem_write_8(REG::GPIO_DIR, GPIO_DISP | GPIO_GP0); mem_write_8(REG::GPIO, GPIO_DISP | GPIO_GP0); } else mem_write_8(REG::GPIO, GPIO_DISP); /* REG::GPIO_DIR is set to output for GPIO_DISP by default */ mem_write_8(REG::PCLK, Pclk); // Turns on Clock by setting PCLK Register to the value necessary for the module mem_write_16(REG::PWM_HZ, 0x00FA); // Turning off dithering seems to help prevent horizontal line artifacts on certain colors mem_write_8(REG::DITHER, 0); default_touch_transform(); default_display_orientation(); } void CLCD::default_touch_transform() { // Set Initial Values for Touch Transform Registers mem_write_32(REG::ROTATE, 0); mem_write_32(REG::TOUCH_TRANSFORM_A, FTDI::default_transform_a); mem_write_32(REG::TOUCH_TRANSFORM_B, FTDI::default_transform_b); mem_write_32(REG::TOUCH_TRANSFORM_C, FTDI::default_transform_c); mem_write_32(REG::TOUCH_TRANSFORM_D, FTDI::default_transform_d); mem_write_32(REG::TOUCH_TRANSFORM_E, FTDI::default_transform_e); mem_write_32(REG::TOUCH_TRANSFORM_F, FTDI::default_transform_f); } void CLCD::default_display_orientation() { #if FTDI_API_LEVEL >= 810 // Set the initial display orientation. On the FT810, we use the command // processor to do this since it will also update the transform matrices. CommandFifo cmd; cmd.setrotate( ENABLED(TOUCH_UI_MIRRORED) * 4 + ENABLED(TOUCH_UI_PORTRAIT) * 2 + ENABLED(TOUCH_UI_INVERTED) * 1 ); cmd.execute(); #elif ANY(TOUCH_UI_PORTRAIT, TOUCH_UI_MIRRORED) #error "PORTRAIT or MIRRORED orientation not supported on the FT800." #elif ENABLED(TOUCH_UI_INVERTED) mem_write_32(REG::ROTATE, 1); #endif } #endif // FTDI_BASIC
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp
C++
agpl-3.0
33,876
/**************** * commands.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/>. * ****************************************************************************/ /**************************************************************************** * FUNCTION MAP * * * * SPI and FT800/810 Commands * * * * CLCD::spi_select() Set CS line to 0 * * CLCD::spi_deselect() Set CS Line to 1 * * CLCD::reset() Toggle FT800/810 Power Down Line 50 ms * * CLCD::spi_init() Configure I/O Lines for SPI * * CLCD::spi_transfer() Send/Receive 1 SPI Byte * * CLCD::init() Set FT800/810 Registers * * CLCD::enable() Turn On FT800/810 PCLK * * CLCD::disable() Turn Off FT8880/810 PCLK * * CLCD::set_backlight() Set LCD Backlight Level * * * * MEMORY READ FUNCTIONS * * * * CLCD::mem_read_addr() Send 32-Bit Address * * CLCD::mem_read_8() Read 1 Byte * * CLCD::mem_read_16() Read 2 Bytes * * CLCD::mem_read_32() Read 4 Bytes * * * * MEMORY WRITE FUNCTIONS * * * * CLCD::mem_write_addr() Send 24-Bit Address * * CLCD::mem_write_8() Write 1 Byte * * CLCD::mem_write_16() Write 2 Bytes * * CLCD::mem_write_32() Write 4 Bytes * * * * HOST COMMAND FUNCTION * * * * CLCD::host_cmd() Send 24-Bit Host Command * * * * COMMAND BUFFER FUNCTIONS * * * * CLCD::cmd() Send 32-Bit Value(4 Bytes)CMD Buffer * * CLCD::cmd() Send Data Structure with 32-Bit Cmd * * CLCD::str() Send Text String in 32-Bit Multiples * * * * FT800/810 GRAPHIC COMMANDS * * * * class CLCD:CommandFifo {} Class to control Cmd FIFO * * CommandFifo::start() Wait for CP finish - Set FIFO Ptr * * CommandFifo::execute() Set REG_CMD_WRITE and start CP * * CommandFifo::reset() Set Cmd Buffer Pointers to 0 * * * CommandFifo::fgcolor Set Graphic Item Foreground Color * * CommandFifo::bgcolor Set Graphic Item Background Color * * CommandFifo::begin() Begin Drawing a Primitive * * CommandFifo::mem_copy() Copy a Block of Memory * * CommandFifo::append() Append Commands to Current DL * * CommandFifo::gradient_color() Set 3D Button Highlight Color * * CommandFifo::button() Draw Button with Bulk Write * * CommandFifo::text() Draw Text with Bulk Write * *****************************************************************************/ /************************************************** * RAM_G Graphics RAM Allocation * * * * Address Use * * * * 8000 Extruder Bitmap * * 8100 Bed Heat Bitmap * * 8200 Fan Bitmap * * 8300 Thumb Drive Symbol Bitmap * * 35000 Static DL Space (FT800) * * F5000 Static DL Space (FT810) * **************************************************/ #pragma once typedef const __FlashStringHelper *FSTR_P; class UIStorage; class CLCD { friend class UIStorage; public: typedef FTDI::ftdi_registers REG; typedef FTDI::ftdi_memory_map MAP; static void spi_write_addr (uint32_t reg_address); static void spi_read_addr (uint32_t reg_address); static uint8_t mem_read_8 (uint32_t reg_address); static uint16_t mem_read_16 (uint32_t reg_address); static uint32_t mem_read_32 (uint32_t reg_address); static void mem_read_bulk (uint32_t reg_address, uint8_t *data, uint16_t len); static void mem_write_8 (uint32_t reg_address, uint8_t w_data); static void mem_write_16 (uint32_t reg_address, uint16_t w_data); static void mem_write_32 (uint32_t reg_address, uint32_t w_data); static void mem_write_fill (uint32_t reg_address, uint8_t w_data, uint16_t len); static void mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0); static void mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0); static void mem_write_xbm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0); static void mem_write_bulk (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0); static void mem_write_xbm (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0); public: class CommandFifo; class FontMetrics; static void init(); static void default_touch_transform(); static void default_display_orientation(); static void turn_on_backlight(); static void enable(); static void disable(); static void set_brightness (uint8_t brightness); static uint8_t get_brightness(); static void host_cmd (unsigned char host_command, unsigned char byte2); static uint32_t dl_size() {return CLCD::mem_read_32(REG::CMD_DL) & 0x1FFF;} static void get_font_metrics (uint8_t font, struct FontMetrics &fm); static uint16_t get_text_width(const uint8_t font, const char *str); static uint16_t get_text_width_P(const uint8_t font, const char *str); static uint8_t get_tag () {return mem_read_8(REG::TOUCH_TAG);} static bool is_touching () {return (mem_read_32(REG::TOUCH_DIRECT_XY) & 0x80000000) == 0;} static uint8_t get_tracker (uint16_t &value) { uint32_t tracker = mem_read_32(REG::TRACKER); value = tracker >> 16; return tracker & 0xFF; } }; /*************************** FT800/810 Font Metrics ****************************/ class CLCD::FontMetrics { public: uint8_t char_widths[128]; uint32_t format; uint32_t stride; uint32_t width; uint32_t height; uint32_t ptr; FontMetrics() {} FontMetrics(uint8_t font) {load(font);} void load(uint8_t font); // Returns width of string, up to a maximum of n characters. uint16_t get_text_width(const char *str, size_t n = SIZE_MAX) const; uint16_t get_text_width(FSTR_P str, size_t n = SIZE_MAX) const; }; /******************* FT800/810 Graphic Commands *********************************/ class CLCD::CommandFifo { protected: #if FTDI_API_LEVEL >= 810 uint32_t getRegCmdBSpace(); #else static uint32_t command_write_ptr; template <class T> bool _write_unaligned(T data, uint16_t len); #endif void start(); public: template <class T> bool write(T data, uint16_t len); public: CommandFifo() {start();} static void reset(); static bool is_processing(); static bool has_fault(); void execute(); void cmd(uint32_t cmd32); void cmd(void *data, uint16_t len); void dlstart() {cmd(FTDI::CMD_DLSTART);} void swap() {cmd(FTDI::CMD_SWAP);} void coldstart() {cmd(FTDI::CMD_COLDSTART);} void screensaver() {cmd(FTDI::CMD_SCREENSAVER);} void stop() {cmd(FTDI::CMD_STOP);} void loadidentity() {cmd(FTDI::CMD_LOADIDENTITY);} void setmatrix() {cmd(FTDI::CMD_SETMATRIX);} void fgcolor (uint32_t rgb); void bgcolor (uint32_t rgb); void gradcolor (uint32_t rgb); void track (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t tag); void clock (int16_t x, int16_t y, int16_t r, uint16_t options, int16_t h, int16_t m, int16_t s, int16_t ms); void gauge (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t major, uint16_t minor, uint16_t val, uint16_t range); void dial (int16_t x, int16_t y, int16_t r, uint16_t options, uint16_t val); void slider (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range); void progress (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range); void scrollbar (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t size, uint16_t range); void number (int16_t x, int16_t y, int16_t font, uint16_t options, int32_t n); void spinner (int16_t x, int16_t y, uint16_t style, uint16_t scale); void sketch (int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t ptr, uint16_t format); void gradient (int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1); void snapshot (uint32_t ptr); void loadimage (uint32_t ptr, uint32_t options); void getprops (uint32_t ptr, uint32_t width, uint32_t height); void scale (int32_t sx, int32_t sy); void rotate (int32_t a); void translate (int32_t tx, int32_t ty); #if FTDI_API_LEVEL >= 810 void setbase (uint8_t base); void setrotate (uint8_t rotation); void setbitmap (uint32_t ptr, uint16_t fmt, uint16_t w, uint16_t h); void snapshot2 (uint32_t fmt, uint32_t ptr, int16_t x, int16_t y, uint16_t w, uint16_t h); void mediafifo (uint32_t ptr, uint32_t size); void playvideo (uint32_t options); void videostart(); void videoframe(uint32_t dst, uint32_t ptr); void romfont (uint8_t font, uint8_t romslot); #endif // All the following must be followed by str() void text (int16_t x, int16_t y, int16_t font, uint16_t options); void button (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t option); void toggle (int16_t x, int16_t y, int16_t w, int16_t font, uint16_t options, bool state); void keys (int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options); // Sends the string portion of text, button, toggle and keys. void str (const char * data, size_t maxlen); void str (const char * data); void str (FSTR_P data); void memzero (uint32_t ptr, uint32_t size); void memset (uint32_t ptr, uint32_t value, uint32_t size); void memcpy (uint32_t dst, uint32_t src, uint32_t size); void memcrc (uint32_t ptr, uint32_t num, uint32_t result); void memwrite (uint32_t ptr, uint32_t value); void inflate (uint32_t ptr); void getptr (uint32_t result); void append (uint32_t ptr, uint32_t size); };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.h
C++
agpl-3.0
13,581
/*************** * constants.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/>. * ****************************************************************************/ /**************************************************************************** * This header defines constants and commands for the FTDI FT810 LCD Driver * * chip. * ****************************************************************************/ #pragma once // OPTIONS namespace FTDI { constexpr uint16_t OPT_3D = 0x0000; constexpr uint16_t OPT_RGB565 = 0x0000; constexpr uint16_t OPT_MONO = 0x0001; constexpr uint16_t OPT_NODL = 0x0002; constexpr uint16_t OPT_FLAT = 0x0100; constexpr uint16_t OPT_SIGNED = 0x0100; constexpr uint16_t OPT_CENTERX = 0x0200; constexpr uint16_t OPT_CENTERY = 0x0400; constexpr uint16_t OPT_CENTER = (OPT_CENTERX | OPT_CENTERY); constexpr uint16_t OPT_RIGHTX = 0x0800; constexpr uint16_t OPT_NOBACK = 0x1000; constexpr uint16_t OPT_NOTICKS = 0x2000; constexpr uint16_t OPT_NOHM = 0x4000; constexpr uint16_t OPT_NOPOINTER = 0x4000; constexpr uint16_t OPT_NOSECS = 0x8000; constexpr uint16_t OPT_NOHANDS = (OPT_NOPOINTER | OPT_NOSECS); } namespace FTDI_FT810 { constexpr uint16_t OPT_NOTEAR = 0x0004; constexpr uint16_t OPT_FULLSCREEN = 0x0008; constexpr uint16_t OPT_MEDIAFIFO = 0x0010; constexpr uint16_t OPT_SOUND = 0x0020; } // GPIO Bits namespace FTDI { constexpr uint8_t GPIO_GP0 = 1 << 0; constexpr uint8_t GPIO_GP1 = 1 << 1; constexpr uint8_t GPIO_DISP = 1 << 7; } namespace FTDI_FT810 { constexpr uint16_t GPIOX_GP0 = 1 << 0; constexpr uint16_t GPIOX_GP1 = 1 << 1; constexpr uint16_t GPIOX_DISP = 1 << 15; } // HOST COMMANDS namespace FTDI { constexpr uint8_t ACTIVE = 0x00; constexpr uint8_t STANDBY = 0x41; constexpr uint8_t SLEEP = 0x42; constexpr uint8_t PWRDOWN = 0x50; constexpr uint8_t CLKEXT = 0x44; constexpr uint8_t CLKINT = 0x48; constexpr uint8_t CORESET = 0x68; } namespace FTDI_FT800 { constexpr uint8_t CLK48M = 0x62; constexpr uint8_t CLK36M = 0x61; } namespace FTDI_FT810 { constexpr uint8_t CLKSEL = 0x61; } // DISPLAY LIST COMMANDS namespace FTDI { constexpr uint8_t ARGB1555 = 0; constexpr uint8_t L1 = 1; constexpr uint8_t L2 = 17; constexpr uint8_t L4 = 2; constexpr uint8_t L8 = 3; constexpr uint8_t RGB332 = 4; constexpr uint8_t ARGB2 = 5; constexpr uint8_t ARGB4 = 6; constexpr uint8_t RGB565 = 7; constexpr uint8_t PALETTED = 8; constexpr uint8_t TEXT8X8 = 9; constexpr uint8_t TEXTVGA = 10; constexpr uint8_t BARGRAPH = 11; constexpr uint8_t ALPHA_FUNC_NEVER = 0; constexpr uint8_t ALPHA_FUNC_LESS = 1; constexpr uint8_t ALPHA_FUNC_LEQUAL = 2; constexpr uint8_t ALPHA_FUNC_GREATER = 3; constexpr uint8_t ALPHA_FUNC_GEQUAL = 4; constexpr uint8_t ALPHA_FUNC_EQUAL = 5; constexpr uint8_t ALPHA_FUNC_NOTEQUAL = 6; constexpr uint8_t ALPHA_FUNC_ALWAYS = 7; constexpr uint8_t NEAREST = 0; constexpr uint8_t BILINEAR = 1; constexpr uint8_t BORDER = 0; constexpr uint8_t REPEAT = 1; constexpr uint8_t BLEND_FUNC_ZERO = 0; constexpr uint8_t BLEND_FUNC_ONE = 1; constexpr uint8_t BLEND_FUNC_SRC_ALPHA = 2; constexpr uint8_t BLEND_FUNC_DST_ALPHA = 3; constexpr uint8_t BLEND_FUNC_ONE_MINUS_SRC_ALPHA = 4; constexpr uint8_t BLEND_FUNC_ONE_MINUS_DST_ALPHA = 5; constexpr uint32_t COLOR_MASK_RED = 8; constexpr uint32_t COLOR_MASK_GRN = 4; constexpr uint32_t COLOR_MASK_BLU = 2; constexpr uint32_t COLOR_MASK_ALPHA = 1; constexpr uint8_t STENCIL_FUNC_NEVER = 0; constexpr uint8_t STENCIL_FUNC_LESS = 1; constexpr uint8_t STENCIL_FUNC_LEQUAL = 2; constexpr uint8_t STENCIL_FUNC_GREATER = 3; constexpr uint8_t STENCIL_FUNC_GEQUAL = 4; constexpr uint8_t STENCIL_FUNC_EQUAL = 5; constexpr uint8_t STENCIL_FUNC_NOTEQUAL = 6; constexpr uint8_t STENCIL_FUNC_ALWAYS = 7; constexpr uint8_t STENCIL_OP_ZERO = 0; constexpr uint8_t STENCIL_OP_KEEP = 1; constexpr uint8_t STENCIL_OP_REPLACE = 2; constexpr uint8_t STENCIL_OP_INCR = 3; constexpr uint8_t STENCIL_OP_DECR = 4; constexpr uint8_t STENCIL_OP_INVERT = 5; typedef enum : uint32_t { BITMAPS = 1, POINTS = 2, LINES = 3, LINE_STRIP = 4, EDGE_STRIP_R = 5, EDGE_STRIP_L = 6, EDGE_STRIP_A = 7, EDGE_STRIP_B = 8, RECTS = 9 } begin_t; } namespace FTDI_FT800_DL { constexpr uint32_t ALPHA_FUNC = 0x09000000; constexpr uint32_t BEGIN = 0x1F000000; constexpr uint32_t BITMAP_HANDLE = 0x05000000; constexpr uint32_t BITMAP_LAYOUT = 0x07000000; constexpr uint32_t BITMAP_SIZE = 0x08000000; constexpr uint32_t BITMAP_SOURCE = 0x01000000; constexpr uint32_t BITMAP_TRANSFORM_A = 0x15000000; constexpr uint32_t BITMAP_TRANSFORM_B = 0x16000000; constexpr uint32_t BITMAP_TRANSFORM_C = 0x17000000; constexpr uint32_t BITMAP_TRANSFORM_D = 0x18000000; constexpr uint32_t BITMAP_TRANSFORM_E = 0x19000000; constexpr uint32_t BITMAP_TRANSFORM_F = 0x1A000000; constexpr uint32_t BLEND_FUNC = 0x0B000000; constexpr uint32_t CALL = 0x1D000000; constexpr uint32_t CELL = 0x06000000; constexpr uint32_t CLEAR = 0x26000000; constexpr uint32_t CLEAR_COLOR_BUFFER = 0x00000004; constexpr uint32_t CLEAR_STENCIL_BUFFER = 0x00000002; constexpr uint32_t CLEAR_TAG_BUFFER = 0x00000001; constexpr uint32_t CLEAR_COLOR_A = 0x0F000000; constexpr uint32_t CLEAR_COLOR_RGB = 0x02000000; constexpr uint32_t CLEAR_STENCIL = 0x11000000; constexpr uint32_t CLEAR_TAG = 0x12000000; constexpr uint32_t COLOR_A = 0x10000000; constexpr uint32_t COLOR_MASK = 0x20000000; constexpr uint32_t COLOR_RGB = 0x04000000; constexpr uint32_t DL_DISPLAY = 0x00000000; constexpr uint32_t END = 0x21000000; constexpr uint32_t JUMP = 0x1E000000; constexpr uint32_t LINE_WIDTH = 0x0E000000; constexpr uint32_t MACRO = 0x25000000; constexpr uint32_t POINT_SIZE = 0x0D000000; constexpr uint32_t RESTORE_CONTEXT = 0x23000000; constexpr uint32_t RETURN = 0x24000000; constexpr uint32_t SAVE_CONTEXT = 0x22000000; constexpr uint32_t SCISSOR_SIZE = 0x1C000000; constexpr uint32_t SCISSOR_XY = 0x1B000000; constexpr uint32_t STENCIL_FUNC = 0x0A000000; constexpr uint32_t STENCIL_MASK = 0x13000000; constexpr uint32_t STENCIL_OP = 0x0C000000; constexpr uint32_t TAG = 0x03000000; constexpr uint32_t TAG_MASK = 0x14000000; constexpr uint32_t VERTEX2F = 0x40000000; constexpr uint32_t VERTEX2II = 0x80000000; } namespace FTDI_FT810_DL { constexpr uint32_t NOP = 0x25000000; constexpr uint32_t BITMAP_LAYOUT_H = 0x28000000; constexpr uint32_t BITMAP_SIZE_H = 0x29000000; constexpr uint32_t VERTEX_FORMAT = 0x27000000; constexpr uint32_t VERTEX_TRANSLATE_X = 0x2B000000; constexpr uint32_t VERTEX_TRANSLATE_Y = 0x2C000000; } // CO-PROCESSOR ENGINE COMMANDS namespace FTDI { constexpr uint32_t CMD_DLSTART = 0xFFFFFF00; constexpr uint32_t CMD_SWAP = 0xFFFFFF01; constexpr uint32_t CMD_COLDSTART = 0xFFFFFF32; constexpr uint32_t CMD_INTERRUPT = 0xFFFFFF02; constexpr uint32_t CMD_APPEND = 0xFFFFFF1E; constexpr uint32_t CMD_REGREAD = 0xFFFFFF19; constexpr uint32_t CMD_MEMWRITE = 0xFFFFFF1A; constexpr uint32_t CMD_INFLATE = 0xFFFFFF22; constexpr uint32_t CMD_LOADIMAGE = 0xFFFFFF24; constexpr uint32_t CMD_MEMCRC = 0xFFFFFF18; constexpr uint32_t CMD_MEMZERO = 0xFFFFFF1C; constexpr uint32_t CMD_MEMSET = 0xFFFFFF1B; constexpr uint32_t CMD_MEMCPY = 0xFFFFFF1D; constexpr uint32_t CMD_BUTTON = 0xFFFFFF0D; constexpr uint32_t CMD_CLOCK = 0xFFFFFF14; constexpr uint32_t CMD_FGCOLOR = 0xFFFFFF0A; constexpr uint32_t CMD_BGCOLOR = 0xFFFFFF09; constexpr uint32_t CMD_GRADCOLOR = 0xFFFFFF34; constexpr uint32_t CMD_GAUGE = 0xFFFFFF13; constexpr uint32_t CMD_GRADIENT = 0xFFFFFF0B; constexpr uint32_t CMD_KEYS = 0xFFFFFF0E; constexpr uint32_t CMD_PROGRESS = 0xFFFFFF0F; constexpr uint32_t CMD_SCROLLBAR = 0xFFFFFF11; constexpr uint32_t CMD_SLIDER = 0xFFFFFF10; constexpr uint32_t CMD_DIAL = 0xFFFFFF2D; constexpr uint32_t CMD_TOGGLE = 0xFFFFFF12; constexpr uint32_t CMD_TEXT = 0xFFFFFF0C; constexpr uint32_t CMD_NUMBER = 0xFFFFFF2E; constexpr uint32_t CMD_LOADIDENTITY = 0xFFFFFF26; constexpr uint32_t CMD_SETMATRIX = 0xFFFFFF2A; constexpr uint32_t CMD_GETMATRIX = 0xFFFFFF33; constexpr uint32_t CMD_GETPTR = 0xFFFFFF23; constexpr uint32_t CMD_GETPROPS = 0xFFFFFF25; constexpr uint32_t CMD_SCALE = 0xFFFFFF28; constexpr uint32_t CMD_ROTATE = 0xFFFFFF29; constexpr uint32_t CMD_TRANSLATE = 0xFFFFFF27; constexpr uint32_t CMD_CALIBRATE = 0xFFFFFF15; constexpr uint32_t CMD_SPINNER = 0xFFFFFF16; constexpr uint32_t CMD_SCREENSAVER = 0xFFFFFF2F; constexpr uint32_t CMD_SKETCH = 0xFFFFFF30; constexpr uint32_t CMD_STOP = 0xFFFFFF17; constexpr uint32_t CMD_SETFONT = 0xFFFFFF2B; constexpr uint32_t CMD_TRACK = 0xFFFFFF2C; constexpr uint32_t CMD_SNAPSHOT = 0xFFFFFF1F; constexpr uint32_t CMD_LOGO = 0xFFFFFF31; } namespace FTDI_FT810 { constexpr uint32_t CMD_SETROTATE = 0xFFFFFF36; constexpr uint32_t CMD_SNAPSHOT2 = 0xFFFFFF37; constexpr uint32_t CMD_SETBASE = 0xFFFFFF38; constexpr uint32_t CMD_MEDIAFIFO = 0xFFFFFF39; constexpr uint32_t CMD_PLAYVIDEO = 0xFFFFFF3A; constexpr uint32_t CMD_SETFONT2 = 0xFFFFFF3B; constexpr uint32_t CMD_SETSCRATCH = 0xFFFFFF3C; constexpr uint32_t CMD_ROMFONT = 0xFFFFFF3F; constexpr uint32_t CMD_VIDEOSTART = 0xFFFFFF40; constexpr uint32_t CMD_VIDEOFRAME = 0xFFFFFF41; constexpr uint32_t CMD_SETBITMAP = 0xFFFFFF43; } namespace FTDI { enum effect_t : unsigned char { SILENCE = 0x00, SQUARE_WAVE = 0x01, SINE_WAVE = 0x02, SAWTOOTH_WAVE = 0x03, TRIANGLE_WAVE = 0x04, BEEPING = 0x05, ALARM = 0x06, WARBLE = 0x07, CAROUSEL = 0x08, SHORT_PIPS_1 = 0x10, SHORT_PIPS_2 = 0x11, SHORT_PIPS_3 = 0x12, SHORT_PIPS_4 = 0x13, SHORT_PIPS_5 = 0x14, SHORT_PIPS_6 = 0x15, SHORT_PIPS_7 = 0x16, SHORT_PIPS_8 = 0x17, SHORT_PIPS_9 = 0x18, SHORT_PIPS_10 = 0x19, SHORT_PIPS_11 = 0x1A, SHORT_PIPS_12 = 0x1B, SHORT_PIPS_13 = 0x1C, SHORT_PIPS_14 = 0x1D, SHORT_PIPS_15 = 0x1E, SHORT_PIPS_16 = 0x1F, DTMF_POUND = 0x23, DTMF_STAR = 0x2C, DTMF_0 = 0x30, DTMF_1 = 0x31, DTMF_2 = 0x32, DTMF_3 = 0x33, DTMF_4 = 0x34, DTMF_5 = 0x35, DTMF_6 = 0x36, DTMF_7 = 0x37, DTMF_8 = 0x38, DTMF_9 = 0x39, HARP = 0x40, XYLOPHONE = 0x41, TUBA = 0x42, GLOCKENSPIEL = 0x43, ORGAN = 0x44, TRUMPET = 0x45, PIANO = 0x46, CHIMES = 0x47, MUSIC_BOX = 0x48, BELL = 0x49, CLICK = 0x50, SWITCH = 0x51, COWBELL = 0x52, NOTCH = 0x53, HIHAT = 0x54, KICKDRUM = 0x55, POP = 0x56, CLACK = 0x57, CHACK = 0x58, MUTE = 0x60, UNMUTE = 0x61 }; enum note_t : unsigned char { END_SONG = 0xFF, REST = 0x00, NOTE_C1 = 0x18, // 24 NOTE_C1S = 0x19, NOTE_D1 = 0x1A, NOTE_D1S = 0x1B, NOTE_E1 = 0x1C, NOTE_F1 = 0x1D, NOTE_F1S = 0x1E, NOTE_G1 = 0x1F, NOTE_G1S = 0x20, NOTE_A1 = 0x21, NOTE_A1S = 0x22, NOTE_B1 = 0x23, NOTE_C2 = 0x24, //36 NOTE_C2S = 0x25, NOTE_D2 = 0x26, NOTE_D2S = 0x27, NOTE_E2 = 0x28, NOTE_F2 = 0x29, NOTE_F2S = 0x2A, NOTE_G2 = 0x2B, NOTE_G2S = 0x2C, NOTE_A2 = 0x2D, NOTE_A2S = 0x2E, NOTE_B2 = 0x2F, NOTE_C3 = 0x30, NOTE_C3S = 0x31, NOTE_D3 = 0x32, NOTE_D3S = 0x33, NOTE_E3 = 0x34, NOTE_F3 = 0x35, NOTE_F3S = 0x36, NOTE_G3 = 0x37, NOTE_G3S = 0x38, NOTE_A3 = 0x39, NOTE_A3S = 0x3A, NOTE_B3 = 0x3B, NOTE_C4 = 0x3C, NOTE_C4S = 0x3D, NOTE_D4 = 0x3E, NOTE_D4S = 0x3F, NOTE_E4 = 0x40, NOTE_F4 = 0x41, NOTE_F4S = 0x42, NOTE_G4 = 0x43, NOTE_G4S = 0x44, NOTE_A4 = 0x45, NOTE_A4S = 0x46, NOTE_B4 = 0x47, NOTE_C5 = 0x48, NOTE_C5S = 0x49, NOTE_D5 = 0x4A, NOTE_D5S = 0x4B, NOTE_E5 = 0x4C, NOTE_F5 = 0x4D, NOTE_F5S = 0x4E, NOTE_G5 = 0x4F, NOTE_G5S = 0x50, NOTE_A5 = 0x51, NOTE_A5S = 0x52, NOTE_B5 = 0x53, }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/constants.h
C++
agpl-3.0
21,987
/****************** * display_list.h * *****************/ /********************************************************************************** * Adapted from: * * https://github.com/RudolphRiedel/FT800-FT813 * * By Rudolph Riedel * * * * MIT License * * * * Copyright (c) 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in all * * copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * * SOFTWARE. * * * **********************************************************************************/ #pragma once namespace FTDI { /* FT8xx graphics engine specific macros useful for static display list generation */ inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) {return DL::ALPHA_FUNC|((func&7UL)<<8)|(ref&255UL);} inline uint32_t BEGIN(begin_t prim) {return DL::BEGIN|(prim&15UL);} inline uint32_t BITMAP_SOURCE(uint32_t ram_g_addr) {return DL::BITMAP_SOURCE|(ram_g_addr);} inline uint32_t BITMAP_HANDLE(uint8_t handle) {return DL::BITMAP_HANDLE|(handle&31UL);} inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint16_t height) {return DL::BITMAP_LAYOUT|((format&31UL)<<19)|((linestride&1023UL)<<9)|(height&511UL);} inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) {return DL::BITMAP_SIZE|((filter&1UL)<<20)|((wrapx&1UL)<<19)|((wrapy&1UL)<<18)|((width&511UL)<<9)|(height&511UL);} #if FTDI_API_LEVEL >= 810 inline uint32_t BITMAP_LAYOUT_H(uint8_t linestride, uint8_t height) {return DL::BITMAP_LAYOUT_H|((linestride&3UL)<<2)|(height&3UL);} inline uint32_t BITMAP_SIZE_H(uint8_t width, uint8_t height) {return DL::BITMAP_SIZE_H|((width&3UL)<<2)|(height&3UL);} #endif inline uint32_t BITMAP_TRANSFORM_A(uint16_t a) {return DL::BITMAP_TRANSFORM_A|(a&131071UL);} inline uint32_t BITMAP_TRANSFORM_B(uint16_t b) {return DL::BITMAP_TRANSFORM_B|(b&131071UL);} inline uint32_t BITMAP_TRANSFORM_C(uint32_t c) {return DL::BITMAP_TRANSFORM_C|(c&16777215UL);} inline uint32_t BITMAP_TRANSFORM_D(uint16_t d) {return DL::BITMAP_TRANSFORM_D|(d&131071UL);} inline uint32_t BITMAP_TRANSFORM_E(uint16_t e) {return DL::BITMAP_TRANSFORM_E|(e&131071UL);} inline uint32_t BITMAP_TRANSFORM_F(uint32_t f) {return DL::BITMAP_TRANSFORM_F|(f&16777215UL);} inline uint32_t BLEND_FUNC(uint8_t src,uint8_t dst) {return DL::BLEND_FUNC|((src&7UL)<<3)|(dst&7UL);} inline uint32_t CALL(uint16_t dest) {return DL::CALL|(dest&65535UL);} inline uint32_t CELL(uint8_t cell) {return DL::CELL|(cell&127UL);} inline uint32_t CLEAR(bool c,bool s,bool t) {return DL::CLEAR|((c?1UL:0UL)<<2)|((s?1UL:0UL)<<1)|(t?1UL:0UL);} inline uint32_t CLEAR_COLOR_A(uint8_t alpha) {return DL::CLEAR_COLOR_A|(alpha&255UL);} inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue) {return DL::CLEAR_COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);} inline uint32_t CLEAR_COLOR_RGB(uint32_t rgb) {return DL::CLEAR_COLOR_RGB|(rgb&0xFFFFFF);} inline uint32_t CLEAR_STENCIL(uint8_t s) {return DL::CLEAR_STENCIL|(s&255UL);} inline uint32_t CLEAR_TAG(uint8_t s) {return DL::CLEAR_TAG|(s&255UL);} inline uint32_t COLOR_A(uint8_t alpha) {return DL::COLOR_A|(alpha&255UL);} inline uint32_t COLOR_MASK(bool r, bool g, bool b, bool a) {return DL::COLOR_MASK|((r?1UL:0UL)<<3)|((g?1UL:0UL)<<2)|((b?1UL:0UL)<<1)|(a?1UL:0UL);} inline uint32_t COLOR_RGB(uint8_t red,uint8_t green,uint8_t blue) {return DL::COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);} inline uint32_t COLOR_RGB(uint32_t rgb) {return DL::COLOR_RGB|(rgb&0xFFFFFF);} /* inline uint32_t DISPLAY() {return (0UL<<24)) */ inline uint32_t END() {return DL::END;} inline uint32_t JUMP(uint16_t dest) {return DL::JUMP|(dest&65535UL);} inline uint32_t LINE_WIDTH(uint16_t width) {return DL::LINE_WIDTH|(width&4095UL);} inline uint32_t MACRO(uint8_t m) {return DL::MACRO|(m&1UL);} inline uint32_t POINT_SIZE(uint16_t size) {return DL::POINT_SIZE|(size&8191UL);} inline uint32_t RESTORE_CONTEXT() {return DL::RESTORE_CONTEXT;} inline uint32_t RETURN () {return DL::RETURN;} inline uint32_t SAVE_CONTEXT() {return DL::SAVE_CONTEXT;} inline uint32_t SCISSOR_XY(uint16_t x,uint16_t y) { return DL::SCISSOR_XY | (FTDI::ftdi_chip >= 810 ? ((x&2047UL)<<11)|(y&2047UL) : ((x& 511UL)<<10)|(y&511UL)); } inline uint32_t SCISSOR_SIZE(uint16_t w,uint16_t h) { return DL::SCISSOR_SIZE | (FTDI::ftdi_chip >= 810 ? ((w&4095UL)<<12)|(h&4095UL) : ((w&1023UL)<<10)|(h&1023UL)); } inline uint32_t SCISSOR_XY() {return DL::SCISSOR_XY;} inline uint32_t SCISSOR_SIZE() { return DL::SCISSOR_SIZE | (FTDI::ftdi_chip >= 810 ? (2048UL<<12)|(2048UL) : ( 512UL<<10)|( 512UL)); } inline uint32_t STENCIL_FUNC(uint16_t func, uint8_t ref, uint8_t mask) {return DL::STENCIL_FUNC|((func&7UL)<<16)|((ref&255UL)<<8)|(mask&255UL);} inline uint32_t STENCIL_MASK(uint8_t mask) {return DL::STENCIL_MASK|(mask&255UL);} inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) {return DL::STENCIL_OP|(((sfail)&7UL)<<3)|(spass&7UL);} inline uint32_t TAG(uint8_t s) {return DL::TAG|(s&255UL);} inline uint32_t TAG_MASK(bool mask) {return DL::TAG_MASK|(mask?1:0);} inline uint32_t VERTEX2F(uint16_t x, uint16_t y) {return DL::VERTEX2F|((x&32767UL)<<15)|(y&32767UL);} inline uint32_t VERTEX2II(uint16_t x,uint16_t y, uint8_t handle = 0, uint8_t cell = 0) {return DL::VERTEX2II|((x&511UL)<<21)|((y&511UL)<<12)|((handle&31UL)<<7)|(cell&127UL);} #if FTDI_API_LEVEL >= 810 inline uint32_t VERTEX_FORMAT(uint8_t frac) {return DL::VERTEX_FORMAT|(frac&7UL);} inline uint32_t VERTEX_TRANSLATE_X(int32_t x) {return DL::VERTEX_TRANSLATE_X|(x&131071UL);} inline uint32_t VERTEX_TRANSLATE_Y(int32_t y) {return DL::VERTEX_TRANSLATE_Y|(y&131071UL);} #endif }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/display_list.h
C++
agpl-3.0
8,984
/**************** * ftdi_basic.h * ****************/ /**************************************************************************** * Written By Mark Pelletier 2019 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - 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 #include "../compat.h" #ifndef __MARLIN_FIRMWARE__ #define FTDI_BASIC #endif #ifdef FTDI_BASIC #include "registers_ft800.h" #include "registers_ft810.h" #include "constants.h" #include "boards.h" #include "commands.h" #include "spi.h" #include "display_list.h" #include "resolutions.h" #endif
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/ftdi_basic.h
C
agpl-3.0
1,711
/********************* * registers_ft800.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/>. * ****************************************************************************/ /**************************************************************************** * This header defines registers for the FTDI FT800 LCD Driver chip. * ****************************************************************************/ /******************************************************************************* * FT810 * * * * START END ADDR SIZE NAME DESCRIPTION * * * * 0x000000 0x03FFFF 256 kB RAM_G Main Graphics RAM * * * * 0x0C0000 0x0C0003 4 B ROM_CHIPID [0:1] 0x800 Chip Id * * [1:2] 0x0100 Vers ID * * * * 0x0BB23C 0x0FFFFB 275 kB ROM_FONT Font table and bitmap * * * * 0x0FFFFC 0x0FFFFF 4 B ROM_FONT_ADDR Font table pointer address * * * * 0x100000 0x101FFF 8 kB RAM_DL Display List RAM * * * * 0x102000 0x1023FF 1 kB RAM_PAL Palette RAM * * * * 0x102400 0x10257F 380 B * Registers * * * * 0x108000 0x108FFF 4 kB RAM_CMD Command Buffer * * * *******************************************************************************/ #pragma once namespace FTDI { struct ft800_memory_map { // MEMORY LOCATIONS FT800 static constexpr uint32_t RAM_G = 0x000000; // Main Graphics RAM static constexpr uint32_t ROM_CHIPID = 0x0C0000; // Chip ID/Version ID static constexpr uint32_t ROM_FONT = 0x0BB23C; // Font ROM static constexpr uint32_t ROM_FONT_ADDR = 0x0FFFFC; // Font Table Pointer static constexpr uint32_t RAM_DL = 0x100000; // Display List RAM static constexpr uint32_t RAM_PAL = 0x102000; // Palette RAM static constexpr uint32_t RAM_REG = 0x102400; // Registers static constexpr uint32_t RAM_CMD = 0x108000; // Command Buffer static constexpr uint32_t RAM_G_SIZE = 256*1024L; // 256k }; struct ft800_registers { // REGISTERS AND ADDRESSES FT800 // REGISTER ADDRESS SIZE RESET VALUE TYPE DESCRIPTION static constexpr uint32_t ID = 0x102400; // 8 0x7C r Identification Register, Always 0x7C static constexpr uint32_t FRAMES = 0x102404; // 32 0x00000000 r Frame Counter, Since Reset static constexpr uint32_t CLOCK = 0x102408; // 32 0x00000000 r Clock cycles, Since Reset static constexpr uint32_t FREQUENCY = 0x10240C; // 28 0x03938700 r/w Main Clock Frequency static constexpr uint32_t RENDERMODE = 0x102410; // 1 0x00 r/w Rendering Mode: 0 = normal, 1 = single-line static constexpr uint32_t SNAPY = 0x102414; // 11 0x0000 r/w Scan Line Select for RENDERMODE 1 static constexpr uint32_t SNAPSHOT = 0x102418; // 1 - r Trigger for RENDERMODE 1 static constexpr uint32_t CPURESET = 0x10241C; // 3 0x02 r/w RESET Bit2 Audio - Bit1 Touch - Bit0 Graphics static constexpr uint32_t TAP_CRC = 0x102420; // 32 - r Live Video Tap static constexpr uint32_t TAP_MASK = 0x102424; // 32 0xFFFFFFFF r/w Live Video Tap Mask static constexpr uint32_t HCYCLE = 0x102428; // 12 0x224 r/w Horizontal Total Cycle Count static constexpr uint32_t HOFFSET = 0x10242C; // 12 0x02B r/w Horizontal Display Start Offset static constexpr uint32_t HSIZE = 0x102430; // 12 0x1E0 r/w Horizontal Display Pixel Count static constexpr uint32_t HSYNC0 = 0x102434; // 12 0x000 r/w Horizontal Sync Fall Offset static constexpr uint32_t HSYNC1 = 0x102438; // 12 0x029 r/w Horizontal Sync Rise Offset static constexpr uint32_t VCYCLE = 0x10243C; // 12 0x124 r/w Vertical Total Cycle Count static constexpr uint32_t VOFFSET = 0x102440; // 12 0x00C r/w Vertical Display Start Offset static constexpr uint32_t VSIZE = 0x102444; // 12 0x110 r/w Vertical Display Line Count static constexpr uint32_t VSYNC0 = 0x102448; // 10 0x000 r/w Vertical Sync Fall Offset static constexpr uint32_t VSYNC1 = 0x10244C; // 10 0x00A r/w Vertical Sync Rise Offset static constexpr uint32_t DLSWAP = 0x102450; // 2 0x00 r/w Display List Swap Control static constexpr uint32_t ROTATE = 0x102454; // 3 0x00 r/w Screen 90,180, 270 degree rotate static constexpr uint32_t OUTBITS = 0x102458; // 9 0x1B6 r/w Output Resolution, 3x3x3 Bits static constexpr uint32_t DITHER = 0x10245C; // 1 0x01 r/w Output Dither Enable static constexpr uint32_t SWIZZLE = 0x102460; // 4 0x00 r/w Output RGB Swizzle, Pin Change for PCB Routing static constexpr uint32_t CSPREAD = 0x102464; // 1 0x01 r/w Output Clock Spreading Enable static constexpr uint32_t PCLK_POL = 0x102468; // 1 0x00 r/w PCLK Polarity: 0 = Rising Edge, 1 = Falling Edge static constexpr uint32_t PCLK = 0x10246C; // 8 0x00 r/w PCLK Frequency Divider, 0 = Disable Clock static constexpr uint32_t TAG_X = 0x102470; // 11 0x000 r/w Tag Query X Coordinate static constexpr uint32_t TAG_Y = 0x102474; // 11 0x000 r/w Tag Query Y Coordinate static constexpr uint32_t TAG = 0x102478; // 8 0x00 r Tag Query Result static constexpr uint32_t VOL_PB = 0x10247C; // 8 0xFF r/w Audio Playback Volume static constexpr uint32_t VOL_SOUND = 0x102480; // 8 0xFF r/w Audio Synthesizer Volume static constexpr uint32_t SOUND = 0x102484; // 16 0x0000 r/w Audio Sound Effect Select static constexpr uint32_t PLAY = 0x102488; // 1 0x00 r/w Audio Start Effect Playback static constexpr uint32_t GPIO_DIR = 0x10248C; // 8 0x80 r/w GPIO Pin Direction: 0 = Input , 1 = Output static constexpr uint32_t GPIO = 0x102490; // 8 0x00 r/w GPIO Pin Values for 0, 1, 7 Drive Strength 2, 3, 4, 5, 6 static constexpr uint32_t INT_FLAGS = 0x102498; // 8 0x00 r Interrupt Flags, Clear by Reading static constexpr uint32_t INT_EN = 0x10249C; // 1 0x00 r/w Global Interrupt Enable static constexpr uint32_t INT_MASK = 0x1024A0; // 8 0xFF r/w Interrupt Enable Mask static constexpr uint32_t PLAYBACK_START = 0x1024A4; // 20 0x00000 r/w Audio Playback RAM Start Address static constexpr uint32_t PLAYBACK_LENGTH = 0x1024A8; // 20 0x00000 r/w Audio Playback Sample Length (Bytes) static constexpr uint32_t PLAYBACK_READPTR = 0x1024AC; // 20 - r Audio Playback Read Pointer static constexpr uint32_t PLAYBACK_FREQ = 0x1024B0; // 16 0x1F40 r/w Audio Playback Frequency (Hz) static constexpr uint32_t PLAYBACK_FORMAT = 0x1024B4; // 2 0x00 r/w Audio Playback Format static constexpr uint32_t PLAYBACK_LOOP = 0x1024B8; // 1 0x00 r/w Audio Playback Loop Enable static constexpr uint32_t PLAYBACK_PLAY = 0x1024BC; // 1 0x00 r Audio Start Playback static constexpr uint32_t PWM_HZ = 0x1024C0; // 14 0x00FA r/w Backlight PWM Frequency (Hz) static constexpr uint32_t PWM_DUTY = 0x1024C4; // 8 0x80 r/w Backlight PWM Duty Cycle: 0 = 0%, 128 = 100% static constexpr uint32_t MACRO_0 = 0x1024C8; // 32 0x00000000 r/w Display List Macro Command 0 static constexpr uint32_t MACRO_1 = 0x1024CC; // 32 0x00000000 r/w Display List Macro Command 1 static constexpr uint32_t CMD_READ = 0x1024E4; // 12 0x000 r/w Command Buffer Read Pointer static constexpr uint32_t CMD_WRITE = 0x1024E8; // 12 0x000 r/w Command Buffer Write Pointer static constexpr uint32_t CMD_DL = 0x1024EC; // 13 0x0000 r/w Command Display List Offset static constexpr uint32_t TOUCH_MODE = 0x1024F0; // 2 0x03 r/w Touch-Screen Sampling Mode static constexpr uint32_t TOUCH_ADC_MODE = 0x1024F4; // 1 0x01 r/w Select Single Ended or Differential Sampling static constexpr uint32_t TOUCH_CHARGE = 0x1024F8; // 16 0x1770 r/w Touch Screen Charge Time, n x 6 Clocks static constexpr uint32_t TOUCH_SETTLE = 0x1024FC; // 4 0x03 r/w Touch-Screen Settle Time, n x 6 Clocks static constexpr uint32_t TOUCH_OVERSAMPLE = 0x102500; // 4 0x07 r/w Touch-Screen Oversample Factor static constexpr uint32_t TOUCH_RZTHRESH = 0x102504; // 16 0xFFFF r/w Touch-Screen Resistance Threshold static constexpr uint32_t TOUCH_RAW_XY = 0x102508; // 32 - r Touch-Screen Raw (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_RZ = 0x10250C; // 16 - r Touch-Screen Resistance static constexpr uint32_t TOUCH_SCREEN_XY = 0x102510; // 32 - r Touch-Screen Screen (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_TAG_XY = 0x102514; // 32 - r Touch-Screen Tag 0 Lookup (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_TAG = 0x102518; // 8 - r Touch-Screen Tag 0 Result static constexpr uint32_t TOUCH_TRANSFORM_A = 0x10251C; // 32 0x00010000 r/w Touch-Screen Transform Coefficient A (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_B = 0x102520; // 32 0x00000000 r/w Touch-Screen Transform Coefficient B (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_C = 0x102524; // 32 0x00000000 r/w Touch-Screen Transform Coefficient C (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_D = 0x102528; // 32 0x00000000 r/w Touch-Screen Transform Coefficient D (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_E = 0x10252C; // 32 0x00010000 r/w Touch-Screen Transform Coefficient E (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_F = 0x102530; // 32 0x00000000 r/w Touch-Screen Transform Coefficient F (s15.16) // Reserved Addresses 0x102434 - 0x102470 static constexpr uint32_t TOUCH_DIRECT_XY = 0x102574; // 32 - r Touch-Screen Direct Conversions XY (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_DIRECT_Z1Z2 = 0x102578; // 32 - r Touch-Screen Direct Conversions Z (z1-MSB16; z2-LSB16) static constexpr uint32_t TRACKER = 0x109000; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/registers_ft800.h
C++
agpl-3.0
14,144
/********************* * registers_ft810.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/>. * ****************************************************************************/ /**************************************************************************** * This header defines registers for the FTDI FT810 LCD Driver chip. * ****************************************************************************/ /******************************************************************************* * FT810 * * * * START END ADDR SIZE NAME DESCRIPTION * * * * 0x000000 0x0FFFFF 1024 kB RAM_G Main Graphics RAM (0 to 1048572) * * * * 0x0C0000 0x0C0003 4 B ROM_CHIPID [0:1] 0x800 Chip Id * * [1:2] 0x0100 Vers ID * * * * 0x1E0000 0x2FFFFB 1152 kB ROM_FONT Font table and bitmap * * * * 0x201EE0 0x2029DC 2812 B ROM_FONT_ROOT ROM font table * * * * 0x2FFFFC 0x2FFFFF 4 B ROM_FONT_ADDR Font table pointer address * * * * 0x300000 0x301FFF 8 kB RAM_DL Display List RAM * * * * 0x302000 0x302FFF 4 kB * Registers * * * * 0x308000 0x308FFF 4 kB RAM_CMD Command Buffer * * * *******************************************************************************/ #pragma once namespace FTDI { struct ft810_memory_map { // MEMORY LOCATIONS FT810 static constexpr uint32_t RAM_G = 0x000000; // Main Graphics RAM static constexpr uint32_t ROM_CHIPID = 0x0C0000; // Chip ID/Version ID static constexpr uint32_t ROM_FONT = 0x1E0000; // Font ROM static constexpr uint32_t ROM_FONT_ADDR = 0x2FFFFC; // Font Table Pointer static constexpr uint32_t RAM_DL = 0x300000; // Display List RAM static constexpr uint32_t RAM_REG = 0x302000; // Registers static constexpr uint32_t RAM_CMD = 0x308000; // Command Buffer static constexpr uint32_t RAM_G_SIZE = 1024*1024L; // 1024k }; struct ft810_registers { // REGISTERS AND ADDRESSES FT810 // REGISTER ADDRESS SIZE RESET VALUE TYPE DESCRIPTION static constexpr uint32_t ID = 0x302000; // 8 0x7C r Identification Register, Always 0x7C static constexpr uint32_t FRAMES = 0x302004; // 32 0x00000000 r Frame Counter, Since Reset static constexpr uint32_t CLOCK = 0x302008; // 32 0x00000000 r Clock cycles, Since Reset static constexpr uint32_t FREQUENCY = 0x30200C; // 28 0x03938700 r/w Main Clock Frequency static constexpr uint32_t RENDERMODE = 0x302010; // 1 0x00 r/w Rendering Mode: 0 = normal, 1 = single-line static constexpr uint32_t SNAPY = 0x302014; // 11 0x0000 r/w Scan Line Select for RENDERMODE 1 static constexpr uint32_t SNAPSHOT = 0x302018; // 1 - r Trigger for RENDERMODE 1 static constexpr uint32_t SNAPFORMAT = 0x30201C; // 6 0x20 r/w Pixel Format for Scanline Readout static constexpr uint32_t CPURESET = 0x302020; // 3 0x02 r/w RESET Bit2 Audio - Bit1 Touch - Bit0 Graphics static constexpr uint32_t TAP_CRC = 0x302024; // 32 - r Live Video Tap static constexpr uint32_t TAP_MASK = 0x302028; // 32 0xFFFFFFFF r/w Live Video Tap Mask static constexpr uint32_t HCYCLE = 0x30202C; // 12 0x224 r/w Horizontal Total Cycle Count static constexpr uint32_t HOFFSET = 0x302030; // 12 0x02B r/w Horizontal Display Start Offset static constexpr uint32_t HSIZE = 0x302034; // 12 0x1E0 r/w Horizontal Display Pixel Count static constexpr uint32_t HSYNC0 = 0x302038; // 12 0x000 r/w Horizontal Sync Fall Offset static constexpr uint32_t HSYNC1 = 0x30203C; // 12 0x029 r/w Horizontal Sync Rise Offset static constexpr uint32_t VCYCLE = 0x302040; // 12 0x124 r/w Vertical Total Cycle Count static constexpr uint32_t VOFFSET = 0x302044; // 12 0x00C r/w Vertical Display Start Offset static constexpr uint32_t VSIZE = 0x302048; // 12 0x110 r/w Vertical Display Line Count static constexpr uint32_t VSYNC0 = 0x30204C; // 10 0x000 r/w Vertical Sync Fall Offset static constexpr uint32_t VSYNC1 = 0x302050; // 10 0x00A r/w Vertical Sync Rise Offset static constexpr uint32_t DLSWAP = 0x302054; // 2 0x00 r/w Display List Swap Control static constexpr uint32_t ROTATE = 0x302058; // 3 0x00 r/w Screen 90,180, 270 degree rotate static constexpr uint32_t OUTBITS = 0x30205C; // 9 0x1B6 r/w Output Resolution, 3x3x3 Bits static constexpr uint32_t DITHER = 0x302060; // 1 0x01 r/w Output Dither Enable static constexpr uint32_t SWIZZLE = 0x302064; // 4 0x00 r/w Output RGB Swizzle, Pin Change for PCB Routing static constexpr uint32_t CSPREAD = 0x302068; // 1 0x01 r/w Output Clock Spreading Enable static constexpr uint32_t PCLK_POL = 0x30206C; // 1 0x00 r/w PCLK Polarity: 0 = Rising Edge, 1 = Falling Edge static constexpr uint32_t PCLK = 0x302070; // 8 0x00 r/w PCLK Frequency Divider, 0 = Disable Clock static constexpr uint32_t TAG_X = 0x302074; // 11 0x000 r/w Tag Query X Coordinate static constexpr uint32_t TAG_Y = 0x302078; // 11 0x000 r/w Tag Query Y Coordinate static constexpr uint32_t TAG = 0x30207C; // 8 0x00 r Tag Query Result static constexpr uint32_t VOL_PB = 0x302080; // 8 0xFF r/w Audio Playback Volume static constexpr uint32_t VOL_SOUND = 0x302084; // 8 0xFF r/w Audio Synthesizer Volume static constexpr uint32_t SOUND = 0x302088; // 16 0x0000 r/w Audio Sound Effect Select static constexpr uint32_t PLAY = 0x30208C; // 1 0x00 r/w Audio Start Effect Playback static constexpr uint32_t GPIO_DIR = 0x302090; // 8 0x80 r/w GPIO Pin Direction: 0 = Input , 1 = Output static constexpr uint32_t GPIO = 0x302094; // 8 0x00 r/w GPIO Pin Values for 0, 1, 7 Drive Strength 2, 3, 4, 5, 6 static constexpr uint32_t GPIOX_DIR = 0x302098; // 16 0x8000 r/w Extended GPIO Pin Direction static constexpr uint32_t GPIOX = 0x30209C; // 16 0x0080 r/w Extended GPIO Pin Values // Reserved Addr 0x3020A0 // Reserved Addr 0x3020A4 static constexpr uint32_t INT_FLAGS = 0x3020A8; // 8 0x00 r Interrupt Flags, Clear by Reading static constexpr uint32_t INT_EN = 0x3020AC; // 1 0x00 r/w Global Interrupt Enable static constexpr uint32_t INT_MASK = 0x3020B0; // 8 0xFF r/w Interrupt Enable Mask static constexpr uint32_t PLAYBACK_START = 0x3020B4; // 20 0x00000 r/w Audio Playback RAM Start Address static constexpr uint32_t PLAYBACK_LENGTH = 0x3020B8; // 20 0x00000 r/w Audio Playback Sample Length (Bytes) static constexpr uint32_t PLAYBACK_READPTR = 0x3020BC; // 20 - r Audio Playback Read Pointer static constexpr uint32_t PLAYBACK_FREQ = 0x3020C0; // 16 0x1F40 r/w Audio Playback Frequency (Hz) static constexpr uint32_t PLAYBACK_FORMAT = 0x3020C4; // 2 0x00 r/w Audio Playback Format static constexpr uint32_t PLAYBACK_LOOP = 0x3020C8; // 1 0x00 r/w Audio Playback Loop Enable static constexpr uint32_t PLAYBACK_PLAY = 0x3020CC; // 1 0x00 r Audio Start Playback static constexpr uint32_t PWM_HZ = 0x3020D0; // 14 0x00FA r/w Backlight PWM Frequency (Hz) static constexpr uint32_t PWM_DUTY = 0x3020D4; // 8 0x80 r/w Backlight PWM Duty Cycle: 0 = 0%, 128 = 100% static constexpr uint32_t MACRO_0 = 0x3020D8; // 32 0x00000000 r/w Display List Macro Command 0 static constexpr uint32_t MACRO_1 = 0x3020DC; // 32 0x00000000 r/w Display List Macro Command 1 // Reserved Addr 0x3020E0 // Reserved Addr 0x3020E4 // Reserved Addr 0x3020E8 // Reserved Addr 0x3020EC // Reserved Addr 0x3020F0 // Reserved Addr 0x3020F4 static constexpr uint32_t CMD_READ = 0x3020F8; // 12 0x000 r/w Command Buffer Read Pointer static constexpr uint32_t CMD_WRITE = 0x3020FC; // 12 0x000 r/w Command Buffer Write Pointer static constexpr uint32_t CMD_DL = 0x302100; // 13 0x0000 r/w Command Display List Offset static constexpr uint32_t TOUCH_MODE = 0x302104; // 2 0x03 r/w Touch-Screen Sampling Mode static constexpr uint32_t TOUCH_ADC_MODE = 0x302108; // 1 0x01 r/w Select Single Ended or Differential Sampling static constexpr uint32_t TOUCH_CHARGE = 0x30210C; // 16 0x1770 r/w Touch Screen Charge Time, n x 6 Clocks static constexpr uint32_t TOUCH_SETTLE = 0x302110; // 4 0x03 r/w Touch-Screen Settle Time, n x 6 Clocks static constexpr uint32_t TOUCH_OVERSAMPLE = 0x302114; // 4 0x07 r/w Touch-Screen Oversample Factor static constexpr uint32_t TOUCH_RZTHRESH = 0x302118; // 16 0xFFFF r/w Touch-Screen Resistance Threshold static constexpr uint32_t TOUCH_RAW_XY = 0x30211C; // 32 - r Touch-Screen Raw (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_RZ = 0x302120; // 16 - r Touch-Screen Resistance static constexpr uint32_t TOUCH_SCREEN_XY = 0x302124; // 32 - r Touch-Screen Screen (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_TAG_XY = 0x302128; // 32 - r Touch-Screen Tag 0 Lookup (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_TAG = 0x30212C; // 8 - r Touch-Screen Tag 0 Result static constexpr uint32_t TOUCH_TAG1_XY = 0x302130; // 32 - r Touch-Screen Tag 1 Lookup static constexpr uint32_t TOUCH_TAG1 = 0x302134; // 8 - r Touch-Screen Tag 1 Result static constexpr uint32_t TOUCH_TAG2_XY = 0x302138; // 32 - r Touch-Screen Tag 2 Lookup static constexpr uint32_t TOUCH_TAG2 = 0x30213C; // 8 - r Touch-Screen Tag 2 Result static constexpr uint32_t TOUCH_TAG3_XY = 0x302140; // 32 - r Touch-Screen Tag 3 Lookup static constexpr uint32_t TOUCH_TAG3 = 0x302144; // 8 - r Touch-Screen Tag 3 Result static constexpr uint32_t TOUCH_TAG4_XY = 0x302148; // 32 - r Touch-Screen Tag 4 Lookup static constexpr uint32_t TOUCH_TAG4 = 0x30214C; // 8 - r Touch-Screen Tag 4 Result static constexpr uint32_t TOUCH_TRANSFORM_A = 0x302150; // 32 0x00010000 r/w Touch-Screen Transform Coefficient A (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_B = 0x302154; // 32 0x00000000 r/w Touch-Screen Transform Coefficient B (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_C = 0x302158; // 32 0x00000000 r/w Touch-Screen Transform Coefficient C (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_D = 0x30215C; // 32 0x00000000 r/w Touch-Screen Transform Coefficient D (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_E = 0x302160; // 32 0x00010000 r/w Touch-Screen Transform Coefficient E (s15.16) static constexpr uint32_t TOUCH_TRANSFORM_F = 0x302164; // 32 0x00000000 r/w Touch-Screen Transform Coefficient F (s15.16) static constexpr uint32_t TOUCH_CONFIG = 0x302168; // 16 0x8381 r/w Touch Configuration static constexpr uint32_t CTOUCH_TOUCH4_X = 0x30216C; // 16 - r Extended Mode Touch Screen // Reserved Addresses 0x302170 static constexpr uint32_t BIST_EN = 0x302174; // 1 0 r/w BIST Memory Mapping Enable // Reserved Addr 0x302178 // Reserved Addr 0x30217C static constexpr uint32_t TRIM = 0x302180; // 8 0 r/w Internal Clock Trimming static constexpr uint32_t ANA_COMP = 0x302184; // 8 0 r/w Analog Control Register static constexpr uint32_t SPI_WIDTH = 0x302188; // 3 0 r/w QSPI Bus Width Setting static constexpr uint32_t TOUCH_DIRECT_XY = 0x30218C; // 32 - r Touch-Screen Direct Conversions XY (x-MSB16; y-LSB16) static constexpr uint32_t TOUCH_DIRECT_Z1Z2 = 0x302190; // 32 - r Touch-Screen Direct Conversions Z (z1-MSB16; z2-LSB16) // Reserved Addresses 0x302194 - 0x302560 static constexpr uint32_t DATESTAMP = 0x320564; // 128 - r Stamp Date Code static constexpr uint32_t CMDB_SPACE = 0x302574; // 12 0xFFC r/w Command DL Space Available static constexpr uint32_t CMDB_WRITE = 0x302578; // 32 0 w Command DL Write static constexpr uint32_t TRACKER = 0x309000; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) static constexpr uint32_t TRACKER_1 = 0x309004; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) static constexpr uint32_t TRACKER_2 = 0x309008; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) static constexpr uint32_t TRACKER_3 = 0x30900C; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) static constexpr uint32_t TRACKER_4 = 0x309010; // 32 0x00000000 r/w Track Register (Track Value MSB16; Tag Value - LSB8) static constexpr uint32_t MEDIAFIFO_READ = 0x309014; // 32 0x00000000 r/w Media FIFO read pointer static constexpr uint32_t MEDIAFIFO_WRITE = 0x309018; // 32 0x00000000 r/w Media FIFO write pointer }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/registers_ft810.h
C++
agpl-3.0
17,927
/***************** * resolutions.h * *****************/ /**************************************************************************** * Written By Mark Pelletier 2019 - Aleph Objects, Inc. * * Written By Marcio Teixeira 2019 - 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 /*** * The FT8xx has odd registers that don't correspond to timing values in * display datasheets. This macro computes the register values using the * formulas given in the document: * * Bridgetek Application Note * AN_336 FT8xx * Selecting an LCD Display * Version 2.1 * Issue Date: 2017-11-14 */ #define COMPUTE_REGS_FROM_DATASHEET \ constexpr uint16_t Hoffset = thfp + thb - 1; \ constexpr uint16_t Hcycle = th; \ constexpr uint16_t Hsync0 = thfp - 1 ; \ constexpr uint16_t Hsync1 = thfp + thpw - 1; \ constexpr uint16_t Voffset = tvfp + tvb - 1; \ constexpr uint16_t Vcycle = tv; \ constexpr uint16_t Vsync0 = tvfp - 1; \ constexpr uint16_t Vsync1 = tvfp + tvpw - 1; \ static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \ static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv") #if ENABLED(TOUCH_UI_320x240) namespace FTDI { constexpr uint8_t Pclk = 8; constexpr uint8_t Pclkpol = 0; constexpr uint16_t Hsize = 320; constexpr uint16_t Vsize = 240; constexpr uint16_t Vsync0 = 0; constexpr uint16_t Vsync1 = 2; constexpr uint16_t Voffset = 13; constexpr uint16_t Vcycle = 263; constexpr uint16_t Hsync0 = 0; constexpr uint16_t Hsync1 = 10; constexpr uint16_t Hoffset = 70; constexpr uint16_t Hcycle = 408; constexpr uint32_t default_transform_a = 0x000054AD; constexpr uint32_t default_transform_b = 0xFFFFFF52; constexpr uint32_t default_transform_c = 0xFFF7F6E4; constexpr uint32_t default_transform_d = 0x00000065; constexpr uint32_t default_transform_e = 0xFFFFBE3B; constexpr uint32_t default_transform_f = 0x00F68E75; } #elif defined(TOUCH_UI_480x272) namespace FTDI { constexpr uint8_t Pclk = 7; constexpr uint8_t Pclkpol = 1; constexpr uint16_t Hsize = 480; constexpr uint16_t Vsize = 272; constexpr uint16_t th = 525; // One horizontal line constexpr uint16_t thfp = 43; // HS Front porch constexpr uint16_t thb = 2; // HS Back porch (blanking) constexpr uint16_t thpw = 41; // HS pulse width constexpr uint16_t tv = 286; // Vertical period time constexpr uint16_t tvfp = 12; // VS Front porch constexpr uint16_t tvb = 2; // VS Back porch (blanking) constexpr uint16_t tvpw = 10; // VS pulse width COMPUTE_REGS_FROM_DATASHEET; constexpr uint32_t default_transform_a = 0x00008100; constexpr uint32_t default_transform_b = 0x00000000; constexpr uint32_t default_transform_c = 0xFFF18000; constexpr uint32_t default_transform_d = 0x00000000; constexpr uint32_t default_transform_e = 0xFFFFB100; constexpr uint32_t default_transform_f = 0x0120D000; } #elif defined(TOUCH_UI_800x480) namespace FTDI { #ifdef TOUCH_UI_800x480_GENERIC constexpr uint8_t Pclk = 2; constexpr uint16_t Hsize = 800; constexpr uint16_t Vsize = 480; constexpr uint16_t Vsync0 = 0; constexpr uint16_t Vsync1 = 3; constexpr uint16_t Voffset = 32; constexpr uint16_t Vcycle = 525; constexpr uint16_t Hsync0 = 0; constexpr uint16_t Hsync1 = 48; constexpr uint16_t Hoffset = 88; constexpr uint16_t Hcycle = 928; #else constexpr uint8_t Pclk = 3; constexpr uint8_t Pclkpol = 1; constexpr uint16_t Hsize = 800; constexpr uint16_t Vsize = 480; constexpr uint16_t th = 1056; // One horizontal line constexpr uint16_t thfp = 210; // HS Front porch constexpr uint16_t thb = 46; // HS Back porch (blanking) constexpr uint16_t thpw = 23; // HS pulse width constexpr uint16_t tv = 525; // Vertical period time constexpr uint16_t tvfp = 22; // VS Front porch constexpr uint16_t tvb = 23; // VS Back porch (blanking) constexpr uint16_t tvpw = 10; // VS pulse width COMPUTE_REGS_FROM_DATASHEET; constexpr uint32_t default_transform_a = 0x0000D8B9; constexpr uint32_t default_transform_b = 0x00000124; constexpr uint32_t default_transform_c = 0xFFE23926; constexpr uint32_t default_transform_d = 0xFFFFFF51; constexpr uint32_t default_transform_e = 0xFFFF7E4F; constexpr uint32_t default_transform_f = 0x01F0AF70; #endif } #else #error "Unknown or no TOUCH_UI_FTDI_EVE display resolution specified. To add a display resolution, modify 'ftdi_eve_resolutions.h'." #endif
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/resolutions.h
C++
agpl-3.0
6,712
/*********** * spi.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 "ftdi_basic.h" #ifdef FTDI_BASIC /********************************* SPI Functions *********************************/ namespace FTDI { #ifndef CLCD_USE_SOFT_SPI #ifdef CLCD_SPI_BUS SPIClass EVE_SPI(CLCD_SPI_BUS); #endif #ifndef CLCD_HW_SPI_SPEED #define CLCD_HW_SPI_SPEED 8000000 >> SD_SPI_SPEED #endif SPISettings SPI::spi_settings(CLCD_HW_SPI_SPEED, MSBFIRST, SPI_MODE0); #endif void SPI::spi_init() { SET_OUTPUT(CLCD_MOD_RESET); // Module Reset (a.k.a. PD, not SPI) WRITE(CLCD_MOD_RESET, 0); // start with module in power-down SET_OUTPUT(CLCD_SPI_CS); WRITE(CLCD_SPI_CS, 1); #ifdef CLCD_SPI_EXTRA_CS SET_OUTPUT(CLCD_SPI_EXTRA_CS); WRITE(CLCD_SPI_EXTRA_CS, 1); #endif #ifdef SPI_FLASH_SS SET_OUTPUT(SPI_FLASH_SS); WRITE(SPI_FLASH_SS, 1); #endif #ifdef CLCD_USE_SOFT_SPI SET_OUTPUT(CLCD_SOFT_SPI_MOSI); WRITE(CLCD_SOFT_SPI_MOSI, 1); SET_OUTPUT(CLCD_SOFT_SPI_SCLK); WRITE(CLCD_SOFT_SPI_SCLK, 0); SET_INPUT_PULLUP(CLCD_SOFT_SPI_MISO); #else SPI_OBJ.begin(); #endif } #ifdef CLCD_USE_SOFT_SPI uint8_t SPI::_soft_spi_xfer(uint8_t spiOutByte) { uint8_t spiIndex = 0x80; uint8_t spiInByte = 0; uint8_t k; noInterrupts(); for (k = 0; k < 8; k++) { // Output and Read each bit of spiOutByte and spiInByte WRITE(CLCD_SOFT_SPI_MOSI, (spiOutByte & spiIndex) ? 1 : 0); // Output MOSI Bit WRITE(CLCD_SOFT_SPI_SCLK, 1); // Pulse Clock if (READ(CLCD_SOFT_SPI_MISO)) spiInByte |= spiIndex; // MISO changes on the falling edge of clock, so sample it before WRITE(CLCD_SOFT_SPI_SCLK, 0); spiIndex >>= 1; } interrupts(); return spiInByte; } #endif #ifdef CLCD_USE_SOFT_SPI void SPI::_soft_spi_send(uint8_t spiOutByte) { uint8_t k, spiIndex = 0x80; noInterrupts(); for (k = 0; k < 8; k++) { // Output each bit of spiOutByte WRITE(CLCD_SOFT_SPI_MOSI, (spiOutByte & spiIndex) ? 1 : 0); // Output MOSI Bit WRITE(CLCD_SOFT_SPI_SCLK, 1); // Pulse Clock WRITE(CLCD_SOFT_SPI_SCLK, 0); spiIndex >>= 1; } interrupts(); } #endif void SPI::spi_read_bulk(void *data, uint16_t len) { uint8_t *p = (uint8_t *)data; while (len--) *p++ = spi_recv(); } bool SPI::spi_verify_bulk(const void *data, uint16_t len) { const uint8_t *p = (const uint8_t *)data; while (len--) if (*p++ != spi_recv()) return false; return true; } // CLCD SPI - Chip Select void SPI::spi_ftdi_select() { #ifndef CLCD_USE_SOFT_SPI SPI_OBJ.beginTransaction(spi_settings); #endif WRITE(CLCD_SPI_CS, 0); #ifdef CLCD_SPI_EXTRA_CS WRITE(CLCD_SPI_EXTRA_CS, 0); #endif delayMicroseconds(1); } // CLCD SPI - Chip Deselect void SPI::spi_ftdi_deselect() { WRITE(CLCD_SPI_CS, 1); #ifdef CLCD_SPI_EXTRA_CS WRITE(CLCD_SPI_EXTRA_CS, 1); #endif #ifndef CLCD_USE_SOFT_SPI SPI_OBJ.endTransaction(); #endif } #ifdef SPI_FLASH_SS // Serial SPI Flash SPI - Chip Select void SPI::spi_flash_select() { #ifndef CLCD_USE_SOFT_SPI SPI_OBJ.beginTransaction(spi_settings); #endif WRITE(SPI_FLASH_SS, 0); delayMicroseconds(1); } // Serial SPI Flash SPI - Chip Deselect void SPI::spi_flash_deselect() { WRITE(SPI_FLASH_SS, 1); #ifndef CLCD_USE_SOFT_SPI SPI_OBJ.endTransaction(); #endif } #endif // Not really a SPI signal... void SPI::ftdi_reset() { WRITE(CLCD_MOD_RESET, 0); delay(6); /* minimum time for power-down is 5ms */ WRITE(CLCD_MOD_RESET, 1); delay(21); /* minimum time to allow from rising PD_N to first access is 20ms */ } // Not really a SPI signal... void SPI::test_pulse() { #ifdef CLCD_AUX_0 WRITE(CLCD_AUX_0, 1); delayMicroseconds(10); WRITE(CLCD_AUX_0, 0); #endif } } #endif // FTDI_BASIC
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp
C++
agpl-3.0
5,366
/********* * spi.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 #ifndef CLCD_USE_SOFT_SPI #include <SPI.h> #endif namespace FTDI { #if !defined(CLCD_SPI_BUS) || defined(CLCD_USE_SOFT_SPI) #define SPI_OBJ ::SPI #else extern SPIClass EVE_SPI; #define SPI_OBJ EVE_SPI #endif namespace SPI { #ifndef CLCD_USE_SOFT_SPI extern SPISettings spi_settings; #endif uint8_t _soft_spi_xfer (uint8_t val); void _soft_spi_send (uint8_t val); void spi_init (); void spi_ftdi_select (); void spi_ftdi_deselect (); void spi_flash_select (); void spi_flash_deselect (); inline uint8_t spi_recv() { #ifdef CLCD_USE_SOFT_SPI return _soft_spi_xfer(0x00); #else return SPI_OBJ.transfer(0x00); #endif }; inline void spi_send (uint8_t val) { #ifdef CLCD_USE_SOFT_SPI _soft_spi_send(val); #else SPI_OBJ.transfer(val); #endif }; inline void spi_write_8 (uint8_t val) {spi_send(val);}; inline uint8_t spi_read_8 () {return spi_recv();}; namespace least_significant_byte_first { inline void spi_write_16 (uint16_t val) {spi_send(val >> 0); spi_send(val >> 8);}; inline void spi_write_32 (uint32_t val) {spi_send(val >> 0); spi_send(val >> 8); spi_send(val >> 16); spi_send(val >> 24);}; inline uint8_t spi_read_8 () {return spi_recv();}; inline uint16_t spi_read_16 () {return (((uint16_t) spi_recv()) << 0) | (((uint16_t) spi_recv()) << 8);}; inline uint32_t spi_read_32 () {return (((uint32_t) spi_recv()) << 0) | (((uint32_t) spi_recv()) << 8) | (((uint32_t) spi_recv()) << 16) | (((uint32_t) spi_recv()) << 24);}; } namespace most_significant_byte_first { inline void spi_write_16 (uint16_t val) {spi_send(val >> 8); spi_send(val >> 0);}; inline void spi_write_24 (uint32_t val) {spi_send(val >> 16); spi_send(val >> 8); spi_send(val >> 0);}; inline void spi_write_32 (uint32_t val) {spi_send(val >> 24); spi_send(val >> 16); spi_send(val >> 8); spi_send(val >> 0);}; inline uint16_t spi_read_16 () {return (((uint16_t) spi_recv()) << 8) | (((uint16_t) spi_recv()) << 0);}; inline uint32_t spi_read_32 () {return (((uint32_t) spi_recv()) << 24) | (((uint32_t) spi_recv()) << 16) | (((uint32_t) spi_recv()) << 8) | (((uint32_t) spi_recv()) << 0);}; } inline uint8_t ram_write(const uint8_t *p) {return *p;} inline uint8_t pgm_write(const uint8_t *p) {return pgm_read_byte(p);} typedef uint8_t (*bulk_write_op)(const uint8_t*); // Generic template for function for writing multiple bytes, plus padding bytes. // The template parameter op is an inlineable function which is applied to each byte. template<bulk_write_op byte_op> void spi_write_bulk(const void *data, uint16_t len, uint8_t padding) { const uint8_t *p = (const uint8_t *)data; while (len--) spi_send(byte_op(p++)); while (padding--) spi_send(0); } template<bulk_write_op byte_op> void spi_write_bulk(const void *data, uint16_t len) { const uint8_t *p = (const uint8_t *)data; while (len--) spi_send(byte_op(p++)); } void spi_read_bulk( void *data, uint16_t len); bool spi_verify_bulk(const void *data, uint16_t len); void ftdi_reset(); void test_pulse(); } }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.h
C++
agpl-3.0
5,917
/**************************************************************************** * 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 #include "../config.h" #ifdef __MARLIN_FIRMWARE__ // Marlin will define the I/O functions for us #if ENABLED(TOUCH_UI_FTDI_EVE) #define FTDI_BASIC #define FTDI_EXTENDED #endif #else // !__MARLIN_FIRMWARE__ #include <Arduino.h> #ifndef CLCD_USE_SOFT_SPI #include <SPI.h> #endif namespace fast_io { template<typename port_t,uint8_t bits> struct port_pin { typedef port_t port; static void set_high() {port::port() = (port::port() | bits);} static void set_low() {port::port() = (port::port() & (~bits));} static void set_input() {port::ddr() = (port::ddr() & (~bits));} static void set_input_pullup() {set_input(); set_high();} static void set_output() {port::ddr() = (port::ddr() | bits);} static uint8_t read() {return port::pin() & bits;} static void write(bool v) {if (v) set_high(); else set_low();} }; #define MAKE_AVR_PORT_PINS(ID) \ struct port_##ID { \ static volatile uint8_t &pin() {return PIN##ID;}; \ static volatile uint8_t &port() {return PORT##ID;}; \ static volatile uint8_t &ddr() {return DDR##ID;}; \ }; \ typedef port_pin<port_##ID, 0b00000001> AVR_##ID##0; \ typedef port_pin<port_##ID, 0b00000010> AVR_##ID##1; \ typedef port_pin<port_##ID, 0b00000100> AVR_##ID##2; \ typedef port_pin<port_##ID, 0b00001000> AVR_##ID##3; \ typedef port_pin<port_##ID, 0b00010000> AVR_##ID##4; \ typedef port_pin<port_##ID, 0b00100000> AVR_##ID##5; \ typedef port_pin<port_##ID, 0b01000000> AVR_##ID##6; \ typedef port_pin<port_##ID, 0b10000000> AVR_##ID##7; #ifdef PORTA MAKE_AVR_PORT_PINS(A); #endif #ifdef PORTB MAKE_AVR_PORT_PINS(B); #endif #ifdef PORTC MAKE_AVR_PORT_PINS(C); #endif #ifdef PORTD MAKE_AVR_PORT_PINS(D); #endif #ifdef PORTE MAKE_AVR_PORT_PINS(E); #endif #ifdef PORTF MAKE_AVR_PORT_PINS(F); #endif #ifdef PORTG MAKE_AVR_PORT_PINS(G); #endif #ifdef PORTH MAKE_AVR_PORT_PINS(H); #endif #ifdef PORTJ MAKE_AVR_PORT_PINS(J); #endif #ifdef PORTK MAKE_AVR_PORT_PINS(K); #endif #ifdef PORTL MAKE_AVR_PORT_PINS(L); #endif #ifdef PORTQ MAKE_AVR_PORT_PINS(Q); #endif #ifdef PORTR MAKE_AVR_PORT_PINS(R); #endif #undef MAKE_AVR_PORT_PINS template<uint8_t p> struct arduino_digital_pin { static constexpr uint8_t pin = p; static void set_high() {digitalWrite(p, HIGH);} static void set_low() {digitalWrite(p, LOW);} static void set_input() {pinMode(p, INPUT);} static void set_input_pullup() {pinMode(p, INPUT_PULLUP);} static void set_output() {pinMode(p, OUTPUT);} static uint8_t read() {return digitalRead(p);} static void write(bool v) {digitalWrite(p, v ? HIGH : LOW);} }; #define MAKE_ARDUINO_PINS(ID) typedef arduino_digital_pin<ID> ARDUINO_DIGITAL_##ID; MAKE_ARDUINO_PINS( 0); MAKE_ARDUINO_PINS( 1); MAKE_ARDUINO_PINS( 2); MAKE_ARDUINO_PINS( 3); MAKE_ARDUINO_PINS( 4); MAKE_ARDUINO_PINS( 5); MAKE_ARDUINO_PINS( 6); MAKE_ARDUINO_PINS( 7); MAKE_ARDUINO_PINS( 8); MAKE_ARDUINO_PINS( 9); MAKE_ARDUINO_PINS(10); MAKE_ARDUINO_PINS(11); MAKE_ARDUINO_PINS(12); MAKE_ARDUINO_PINS(13); MAKE_ARDUINO_PINS(14); MAKE_ARDUINO_PINS(15); MAKE_ARDUINO_PINS(16); MAKE_ARDUINO_PINS(17); MAKE_ARDUINO_PINS(18); MAKE_ARDUINO_PINS(19); MAKE_ARDUINO_PINS(10); MAKE_ARDUINO_PINS(21); MAKE_ARDUINO_PINS(22); MAKE_ARDUINO_PINS(23); MAKE_ARDUINO_PINS(24); MAKE_ARDUINO_PINS(25); MAKE_ARDUINO_PINS(26); MAKE_ARDUINO_PINS(27); MAKE_ARDUINO_PINS(28); MAKE_ARDUINO_PINS(29); MAKE_ARDUINO_PINS(30); MAKE_ARDUINO_PINS(31); MAKE_ARDUINO_PINS(32); MAKE_ARDUINO_PINS(33); MAKE_ARDUINO_PINS(34); MAKE_ARDUINO_PINS(35); MAKE_ARDUINO_PINS(36); MAKE_ARDUINO_PINS(37); MAKE_ARDUINO_PINS(38); MAKE_ARDUINO_PINS(39); MAKE_ARDUINO_PINS(40); MAKE_ARDUINO_PINS(41); MAKE_ARDUINO_PINS(42); MAKE_ARDUINO_PINS(43); MAKE_ARDUINO_PINS(44); MAKE_ARDUINO_PINS(45); MAKE_ARDUINO_PINS(46); MAKE_ARDUINO_PINS(47); MAKE_ARDUINO_PINS(48); MAKE_ARDUINO_PINS(49); MAKE_ARDUINO_PINS(50); MAKE_ARDUINO_PINS(51); MAKE_ARDUINO_PINS(52); MAKE_ARDUINO_PINS(53); #undef MAKE_ARDUINO_PINS } // namespace fast_io #define SET_INPUT(pin) fast_io::pin::set_input() #define SET_INPUT_PULLUP(pin) do{ fast_io::pin::set_input(); fast_io::pin::set_high(); }while(0) #define SET_INPUT_PULLDOWN SET_INPUT #define SET_OUTPUT(pin) fast_io::pin::set_output() #define READ(pin) fast_io::pin::read() #define WRITE(pin, value) fast_io::pin::write(value) #ifndef pgm_read_word_far #define pgm_read_word_far pgm_read_word #endif #ifndef pgm_read_dword_far #define pgm_read_dword_far pgm_read_dword #endif #ifndef pgm_read_ptr_far #define pgm_read_ptr_far pgm_read_ptr #endif // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments #define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT #define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) // SERIAL_ECHOPGM / SERIAL_ECHOPGM_P is used to output a key value pair. The key must be a string and the value can be anything // Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR(). #define __SEP_N(N,V...) _SEP_##N(V) #define _SEP_N(N,V...) __SEP_N(N,V) #define _SEP_1(PRE) SERIAL_ECHOPGM(PRE) #define _SEP_2(PRE,V) do{ Serial.print(F(PRE)); Serial.print(V); }while(0) #define _SEP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0) #define _SEP_4(a,b,V...) do{ _SEP_2(a,b); _SEP_2(V); }while(0) // Print up to 1 pairs of values followed by newline #define __SELP_N(N,V...) _SELP_##N(V) #define _SELP_N(N,V...) __SELP_N(N,V) #define _SELP_1(PRE) SERIAL_ECHOLNPGM(PRE) #define _SELP_2(PRE,V) do{ Serial.print(F(PRE)); Serial.println(V); }while(0) #define _SELP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0) #define _SELP_4(a,b,V...) do{ _SEP_2(a,b); _SELP_2(V); }while(0) #define SERIAL_ECHO_START() #define SERIAL_ECHOLNPGM(str) Serial.println(F(str)) #define SERIAL_ECHOPGM(str) Serial.print(F(str)) #define SERIAL_ECHO_MSG(V...) SERIAL_ECHOLNPGM(V) #define SERIAL_ECHOLNPGM(V...) _SELP_N(NUM_ARGS(V),V) #define SERIAL_ECHOPGM(str, val) do{ Serial.print(F(str)); Serial.print(val); }while(0) #define safe_delay delay // Define macros for compatibility // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments #define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT #define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) #define _CAT(a,V...) a##V #define CAT(a,V...) _CAT(a,V) #define FIRST(a,...) a #define SECOND(a,b,...) b #define THIRD(a,b,c,...) c #define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0 #define PROBE() ~, 1 // Second item will be 1 if this is passed #define _NOT_0 PROBE() #define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'. #define _BOOL(x) NOT(NOT(x)) // _BOOL('0') gets '0'. Anything else gets '1'. #define _DO_1(W,C,A) (_##W##_1(A)) #define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B)) #define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V)) #define _DO_4(W,C,A,V...) (_##W##_1(A) C _DO_3(W,C,V)) #define _DO_5(W,C,A,V...) (_##W##_1(A) C _DO_4(W,C,V)) #define _DO_6(W,C,A,V...) (_##W##_1(A) C _DO_5(W,C,V)) #define _DO_7(W,C,A,V...) (_##W##_1(A) C _DO_6(W,C,V)) #define _DO_8(W,C,A,V...) (_##W##_1(A) C _DO_7(W,C,V)) #define _DO_9(W,C,A,V...) (_##W##_1(A) C _DO_8(W,C,V)) #define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V)) #define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V)) #define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V)) #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) #define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) #define _DO_16(W,C,A,V...) (_##W##_1(A) C _DO_15(W,C,V)) #define _DO_17(W,C,A,V...) (_##W##_1(A) C _DO_16(W,C,V)) #define _DO_18(W,C,A,V...) (_##W##_1(A) C _DO_17(W,C,V)) #define _DO_19(W,C,A,V...) (_##W##_1(A) C _DO_18(W,C,V)) #define _DO_20(W,C,A,V...) (_##W##_1(A) C _DO_19(W,C,V)) #define _DO_21(W,C,A,V...) (_##W##_1(A) C _DO_20(W,C,V)) #define _DO_22(W,C,A,V...) (_##W##_1(A) C _DO_21(W,C,V)) #define _DO_23(W,C,A,V...) (_##W##_1(A) C _DO_22(W,C,V)) #define _DO_24(W,C,A,V...) (_##W##_1(A) C _DO_23(W,C,V)) #define _DO_25(W,C,A,V...) (_##W##_1(A) C _DO_24(W,C,V)) #define _DO_26(W,C,A,V...) (_##W##_1(A) C _DO_25(W,C,V)) #define _DO_27(W,C,A,V...) (_##W##_1(A) C _DO_26(W,C,V)) #define _DO_28(W,C,A,V...) (_##W##_1(A) C _DO_27(W,C,V)) #define _DO_29(W,C,A,V...) (_##W##_1(A) C _DO_28(W,C,V)) #define _DO_30(W,C,A,V...) (_##W##_1(A) C _DO_29(W,C,V)) #define _DO_31(W,C,A,V...) (_##W##_1(A) C _DO_30(W,C,V)) #define _DO_32(W,C,A,V...) (_##W##_1(A) C _DO_31(W,C,V)) #define _DO_33(W,C,A,V...) (_##W##_1(A) C _DO_32(W,C,V)) #define _DO_34(W,C,A,V...) (_##W##_1(A) C _DO_33(W,C,V)) #define _DO_35(W,C,A,V...) (_##W##_1(A) C _DO_34(W,C,V)) #define _DO_36(W,C,A,V...) (_##W##_1(A) C _DO_35(W,C,V)) #define _DO_37(W,C,A,V...) (_##W##_1(A) C _DO_36(W,C,V)) #define _DO_38(W,C,A,V...) (_##W##_1(A) C _DO_37(W,C,V)) #define _DO_39(W,C,A,V...) (_##W##_1(A) C _DO_38(W,C,V)) #define _DO_40(W,C,A,V...) (_##W##_1(A) C _DO_39(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V) #define _ISENA_ ~,1 #define _ISENA_1 ~,1 #define _ISENA_0x1 ~,1 #define _ISENA_true ~,1 #define _ISENA(V...) IS_PROBE(V) #define _ENA_1(O) _ISENA(CAT(_IS,CAT(ENA_, O))) #define _DIS_1(O) NOT(_ENA_1(O)) #define ENABLED(V...) DO(ENA,&&,V) #define DISABLED(V...) DO(DIS,&&,V) #define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1' #define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0' #define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION converted to A or '1' #define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION converted to A or '<nul>' #define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1' #define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1' #define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B. #define IF_DISABLED(O,A) _TERN(_ENA_1(O),,A) #define ANY(V...) !DISABLED(V) #define NONE DISABLED #define ALL ENABLED // Remove compiler warning on an unused variable #ifndef UNUSED #ifdef HAL_STM32 #define UNUSED(X) (void)X #else #define UNUSED(x) ((void)(x)) #endif #endif #endif // !__MARLIN_FIRMWARE__ #ifndef SD_SPI_SPEED #define SD_SPI_SPEED SPI_FULL_SPEED #endif
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h
C++
agpl-3.0
12,962
/*********************** * adjuster_widget.cpp * ***********************/ /**************************************************************************** * Written By Marcio Teixeira 2021 - Cocoa Press * * * * 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) #define SUB_COLS 9 #define SUB_ROWS 1 #define VAL_POS SUB_POS(1,1), SUB_SIZE(5,1) #define INC_POS SUB_POS(6,1), SUB_SIZE(2,1) #define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1) namespace FTDI { void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, FSTR_P units, int8_t width, uint8_t precision) { char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)]; if (isnan(value)) strcpy_P(str, PSTR("-")); else dtostrf(value, width, precision, str); if (units) { strcat_P(str, PSTR(" ")); strcat_P(str, (const char*) units); } cmd.tag(0).text(VAL_POS, str); } void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, FSTR_P units, int8_t width, uint8_t precision, draw_mode_t what) { if (what & BACKGROUND) cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT); if (what & FOREGROUND) { draw_adjuster_value(cmd, x, y, w, h, value, units, width, precision); cmd.tag(tag ).button(INC_POS, F("-")) .tag(tag+1).button(DEC_POS, F("+")); } } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.cpp
C++
agpl-3.0
2,623
/********************* * adjuster_widget.h * *********************/ /**************************************************************************** * Written By Marcio Teixeira 2021 - Cocoa Press * * * * 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 namespace FTDI { void draw_adjuster_value( CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, FSTR_P units = nullptr, int8_t width = 5, uint8_t precision = 1 ); void draw_adjuster( CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, FSTR_P units = nullptr, int8_t width = 5, uint8_t precision = 1, draw_mode_t what = BOTH ); }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/adjuster_widget.h
C++
agpl-3.0
1,781
/************** * arrows.cpp * **************/ /**************************************************************************** * Written By Marcio Teixeira 2021 - SynDaver 3D * * * * 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) #define COORD(X,Y) cx + s*(swapXY ? Y : (flipX ? -X : X)), cy + s*(swapXY ? (flipX ? -X : X) : Y) namespace FTDI { void drawArrow(int x, int y, int w, int h, Direction direction) { const bool swapXY = direction == UP || direction == DOWN; const bool flipX = direction == UP || direction == LEFT; const int s = min(w,h); const int cx = (x + w/2)*16; const int cy = (y + h/2)*16; CommandProcessor cmd; cmd.cmd(SAVE_CONTEXT()) .cmd(LINE_WIDTH(s/2)) .cmd(BEGIN(LINES)) .cmd(VERTEX2F(COORD( 5, 0))) .cmd(VERTEX2F(COORD( 2,-2))) .cmd(VERTEX2F(COORD( 5, 0))) .cmd(VERTEX2F(COORD( 2, 2))) .cmd(VERTEX2F(COORD( 5, 0))) .cmd(VERTEX2F(COORD(-5, 0))) .cmd(RESTORE_CONTEXT()); } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/arrows.cpp
C++
agpl-3.0
2,168
/************ * arrows.h * ************/ /**************************************************************************** * Written By Marcio Teixeira 2021 - SynDaver 3D * * * * 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 namespace FTDI { enum Direction {UP, DOWN, LEFT, RIGHT}; void drawArrow(int x, int y, int w, int h, Direction direction); }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/arrows.h
C++
agpl-3.0
1,437
/***************** * bitmap_info.h * *****************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 #ifndef FORCEDINLINE #define FORCEDINLINE __attribute__((always_inline)) inline #endif namespace FTDI { // The following functions *must* be inlined since we are relying on the compiler to do // substitution of the constants from the data structure rather than actually storing // it in PROGMEM (which would fail, since we are not using pgm_read to read them). // Plus, by inlining, all the equations are evaluated at compile-time as everything // should be a constant. typedef struct { const uint8_t format; const uint16_t linestride; const uint8_t filter; const uint8_t wrapx; const uint8_t wrapy; const uint32_t RAMG_offset; const uint16_t width; const uint16_t height; } bitmap_info_t; FORCEDINLINE uint32_t BITMAP_SOURCE (const bitmap_info_t& info) {return BITMAP_SOURCE (ftdi_memory_map::RAM_G + info.RAMG_offset);}; FORCEDINLINE uint32_t BITMAP_LAYOUT (const bitmap_info_t& info) {return BITMAP_LAYOUT (info.format, info.linestride, info.height);}; FORCEDINLINE uint32_t BITMAP_SIZE (const bitmap_info_t& info) {return BITMAP_SIZE (info.filter, info.wrapx, info.wrapy, info.width, info.height);} }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/bitmap_info.h
C++
agpl-3.0
2,511
/************************* * circular_progress.cpp * *************************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) /* This function draws a circular progress "ring" */ namespace FTDI { void draw_circular_progress(CommandProcessor& cmd, int x, int y, int w, int h, float percent, char *text, uint32_t bgcolor, uint32_t fgcolor) { const float rim = 0.3; const float a = percent/100.0*2.0*M_PI; const float a1 = min(M_PI/2, a); const float a2 = min(M_PI/2, a-a1); const float a3 = min(M_PI/2, a-a1-a2); const float a4 = min(M_PI/2, a-a1-a2-a3); const int ro = min(w,h) * 8; const int rr = ro * rim; const int cx = x * 16 + w * 8; const int cy = y * 16 + h * 8; // Load a rim shape into stencil buffer cmd.cmd(SAVE_CONTEXT()); cmd.cmd(TAG_MASK(0)); cmd.cmd(CLEAR(0,1,0)); cmd.cmd(COLOR_MASK(0,0,0,0)); cmd.cmd(STENCIL_OP(STENCIL_OP_KEEP, STENCIL_OP_INVERT)); cmd.cmd(STENCIL_FUNC(STENCIL_FUNC_ALWAYS, 255, 255)); cmd.cmd(BEGIN(POINTS)); cmd.cmd(POINT_SIZE(ro)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(POINT_SIZE(ro - rr)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(RESTORE_CONTEXT()); // Mask further drawing by stencil buffer cmd.cmd(SAVE_CONTEXT()); cmd.cmd(STENCIL_FUNC(STENCIL_FUNC_NOTEQUAL, 0, 255)); // Fill the background cmd.cmd(COLOR_RGB(bgcolor)); cmd.cmd(BEGIN(POINTS)); cmd.cmd(POINT_SIZE(ro)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(COLOR_RGB(fgcolor)); // Paint upper-right quadrant cmd.cmd(BEGIN(EDGE_STRIP_A)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(VERTEX2F(cx + ro*sin(a1) + 16,cy - ro*cos(a1) + 8)); // Paint lower-right quadrant if (a > M_PI/2) { cmd.cmd(BEGIN(EDGE_STRIP_R)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(VERTEX2F(cx + ro*cos(a2),cy + ro*sin(a2) + 16)); } // Paint lower-left quadrant if (a > M_PI) { cmd.cmd(BEGIN(EDGE_STRIP_B)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(VERTEX2F(cx - ro*sin(a3) - 8,cy + ro*cos(a3))); } // Paint upper-left quadrant if (a > 1.5*M_PI) { cmd.cmd(BEGIN(EDGE_STRIP_L)); cmd.cmd(VERTEX2F(cx, cy)); cmd.cmd(VERTEX2F(cx - ro*cos(a4),cy - ro*sin(a4))); } cmd.cmd(RESTORE_CONTEXT()); // Draw the text cmd.cmd(SAVE_CONTEXT()); cmd.cmd(COLOR_RGB(fgcolor)); cmd.text(x,y,w,h,text, OPT_CENTERX | OPT_CENTERY); cmd.cmd(RESTORE_CONTEXT()); } void draw_circular_progress(CommandProcessor& cmd, int x, int y, int w, int h, float percent, uint32_t bgcolor, uint32_t fgcolor) { char str[5]; sprintf(str,"%d\%%",int(percent)); draw_circular_progress(cmd, x, y, w, h, percent, str, bgcolor, fgcolor); } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/circular_progress.cpp
C++
agpl-3.0
4,025
/*********************** * circular_progress.h * ***********************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 namespace FTDI { void draw_circular_progress(CommandProcessor& cmd, int x, int y, int w, int h, float percent, char *text, uint32_t bgcolor, uint32_t fgcolor); void draw_circular_progress(CommandProcessor& cmd, int x, int y, int w, int h, float percent, uint32_t bgcolor, uint32_t fgcolor); }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/circular_progress.h
C++
agpl-3.0
1,650
/************************* * command_processor.cpp * *************************/ /**************************************************************************** * Written By Marcio Teixeira 2018 * * * * 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) CommandProcessor::btn_style_func_t *CommandProcessor::_btn_style_callback = CommandProcessor::default_button_style_func; bool CommandProcessor::is_tracking = false; uint32_t CommandProcessor::memcrc(uint32_t ptr, uint32_t num) { const uint16_t x = CLCD::mem_read_16(CLCD::REG::CMD_WRITE); memcrc(ptr, num, 0); wait(); return CLCD::mem_read_32(CLCD::MAP::RAM_CMD + x + 12); } bool CommandProcessor::wait() { while (is_processing() && !has_fault()) { /* nada */ } return !has_fault(); } #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.cpp
C++
agpl-3.0
1,914
/*********************** * command_processor.h * ***********************/ /**************************************************************************** * 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 typedef struct { uint32_t bg; uint32_t grad; uint32_t fg; uint32_t rgb; } btn_colors; // Disable TOUCH_UI_FIT_TEXT on a case-by-case basis namespace FTDI { constexpr uint16_t OPT_NOFIT = OPT_NOTICKS; } /**************************** Enhanced Command Processor **************************/ /* The CommandProcessor class wraps the CommandFifo with several features to make * defining user interfaces much easier. * * - Implements chaining on all methods * - Automatically adds text to button, toggle, text and keys. * - Constrains all widgets to fit inside a box for ease of layout. * - Font size is specified using a chained modifier. * - Option argument is given the default OPT_3D value. */ class CommandProcessor : public CLCD::CommandFifo { public: static constexpr uint8_t STYLE_DISABLED = 0x80; private: static bool default_button_style_func(CommandProcessor &, uint8_t tag, uint8_t & /*style*/, uint16_t &options, bool) { if (tag != 0 && FTDI::EventLoop::get_pressed_tag() == tag) { options = FTDI::OPT_FLAT; } return false; } typedef bool btn_style_func_t(CommandProcessor &cmd, uint8_t tag, uint8_t &style, uint16_t &options, bool post); static btn_style_func_t *_btn_style_callback; static bool is_tracking; int8_t _font = 26, _tag = 0; uint8_t _style = 0; protected: // Returns the canonical thickness of a widget (i.e. the height of a toggle element) uint16_t widget_thickness() { CLCD::FontMetrics fm(_font); return fm.height * 20.0/16; } FORCEDINLINE void linear_widget_box(int16_t &x, int16_t &y, int16_t &w, int16_t &h, bool tracker = false) { const uint16_t th = widget_thickness() / 2; if (w > h) { x += tracker ? th * 2.5 : th; y += (h - th) / 2; w -= tracker ? th * 5.0 : th * 2; h = th; } else { x += (w - th) / 2; y += tracker ? th * 2.5 : th; w = th; h -= tracker ? th * 5.0 : th * 2; } } FORCEDINLINE uint16_t circular_widget_box(int16_t &x, int16_t &y, int16_t &w, int16_t &h) { const uint16_t r = min(w,h) / 2; x += w / 2; y += h / 2; w = 1; h = 1; return r; } public: // Helper method for setting all colors at once inline CommandProcessor& colors(const btn_colors &colors) { cmd(FTDI::COLOR_RGB(colors.rgb)) .gradcolor(colors.grad) .fgcolor(colors.fg) .bgcolor(colors.bg); return *this; } inline CommandProcessor& bitmap_size(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height) { cmd(FTDI::BITMAP_SIZE(filter, wrapx, wrapy, width, height)); #if FTDI_API_LEVEL >= 810 if (FTDI::ftdi_chip >= 810) cmd(FTDI::BITMAP_SIZE_H(width >> 9, height >> 9)); #endif return *this; } inline CommandProcessor& bitmap_layout(uint8_t format, uint16_t linestride, uint16_t height) { cmd(FTDI::BITMAP_LAYOUT(format, linestride, height)); #if FTDI_API_LEVEL >= 810 if (FTDI::ftdi_chip >= 810) cmd(FTDI::BITMAP_LAYOUT_H(linestride >> 10, height >> 9)); #endif return *this; } inline CommandProcessor& set_button_style_callback(const btn_style_func_t *func) { _btn_style_callback = func ?: default_button_style_func; return *this; } inline CommandProcessor& tag (uint8_t tag) {_tag = tag; cmd(FTDI::TAG(tag)); return *this;} inline CommandProcessor& font (int16_t font) {_font = font; return *this;} inline CommandProcessor& enabled (bool enabled=false) { if (enabled) _style &= ~STYLE_DISABLED; else _style |= STYLE_DISABLED; return *this; } inline CommandProcessor& style (uint8_t style) { _style = (_style & STYLE_DISABLED) | style; return *this; } bool wait(); uint32_t memcrc(uint32_t ptr, uint32_t num); // Wrap all the CommandFifo routines to allow method chaining inline CommandProcessor& cmd (uint32_t cmd32) {CLCD::CommandFifo::cmd(cmd32); return *this;} inline CommandProcessor& cmd (void *data, uint16_t len) {CLCD::CommandFifo::cmd(data, len); return *this;} inline CommandProcessor& execute() {CLCD::CommandFifo::execute(); return *this;} inline CommandProcessor& fgcolor (uint32_t rgb) {CLCD::CommandFifo::fgcolor(rgb); return *this;} inline CommandProcessor& bgcolor (uint32_t rgb) {CLCD::CommandFifo::bgcolor(rgb); return *this;} inline CommandProcessor& gradcolor(uint32_t rgb) {CLCD::CommandFifo::gradcolor(rgb); return *this;} inline CommandProcessor& snapshot (uint32_t ptr) {CLCD::CommandFifo::snapshot(ptr); return *this;} inline CommandProcessor& loadimage(uint32_t ptr, uint32_t options) {CLCD::CommandFifo::loadimage(ptr, options); return *this;} inline CommandProcessor& sketch (int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t ptr, uint16_t format) {CLCD::CommandFifo::sketch(x, y, w, h, ptr, format); return *this;} inline CommandProcessor& screensaver () {CLCD::CommandFifo::screensaver(); return *this;} #if FTDI_API_LEVEL >= 810 inline CommandProcessor& setbase (uint8_t base) {CLCD::CommandFifo::setbase(base); return *this;} #endif inline CommandProcessor& loadidentity () {CLCD::CommandFifo::loadidentity(); return *this;} inline CommandProcessor& scale (int32_t sx, int32_t sy) {CLCD::CommandFifo::scale(sx,sy); return *this;} inline CommandProcessor& rotate (int32_t a) {CLCD::CommandFifo::rotate(a); return *this;} inline CommandProcessor& translate(int32_t tx, int32_t ty) {CLCD::CommandFifo::translate(tx,ty); return *this;} inline CommandProcessor& setmatrix () {CLCD::CommandFifo::setmatrix(); return *this;} inline CommandProcessor& stop () {CLCD::CommandFifo::stop(); return *this;} inline CommandProcessor& memzero (uint32_t ptr, uint32_t size) {CLCD::CommandFifo::memzero(ptr, size); return *this;} inline CommandProcessor& memset (uint32_t ptr, uint32_t val, uint32_t size) {CLCD::CommandFifo::memset(ptr, val, size); return *this;} inline CommandProcessor& memcpy (uint32_t src, uint32_t dst, uint32_t size) {CLCD::CommandFifo::memcpy(src, dst, size); return *this;} inline CommandProcessor& memcrc (uint32_t ptr, uint32_t num, uint32_t result) {CLCD::CommandFifo::memcrc(ptr, num, result); return *this;} inline CommandProcessor& memwrite (uint32_t ptr, uint32_t value) {CLCD::CommandFifo::memwrite(ptr, value); return *this;} inline CommandProcessor& inflate (uint32_t ptr) {CLCD::CommandFifo::inflate(ptr); return *this;} inline CommandProcessor& getptr (uint32_t result) {CLCD::CommandFifo::getptr(result); return *this;} inline CommandProcessor& getprops (uint32_t ptr, uint32_t width, uint32_t height) {CLCD::CommandFifo::getprops(ptr, width, height); return *this;} #if FTDI_API_LEVEL >= 810 inline CommandProcessor& setbitmap (uint32_t ptr, uint16_t fmt, uint16_t w, uint16_t h) {CLCD::CommandFifo::setbitmap(ptr,fmt,w,h); return *this;} inline CommandProcessor& snapshot2 (uint32_t fmt, uint32_t ptr, int16_t x, int16_t y, uint16_t w, uint16_t h) {CLCD::CommandFifo::snapshot2(fmt,ptr,x,y,w,h); return *this;} inline CommandProcessor& mediafifo (uint32_t p, uint32_t s) {CLCD::CommandFifo::mediafifo(p, s); return *this;} inline CommandProcessor& playvideo(uint32_t options) {CLCD::CommandFifo::playvideo(options); return *this;} inline CommandProcessor& romfont(uint8_t font, uint8_t slot) {CLCD::CommandFifo::romfont(font, slot); return *this;} #endif inline CommandProcessor& gradient(int16_t x0, int16_t y0, uint32_t rgb0, int16_t x1, int16_t y1, uint32_t rgb1) {CLCD::CommandFifo::gradient(x0,y0,rgb0,x1,y1,rgb1); return *this;} inline CommandProcessor& rectangle(int16_t x, int16_t y, int16_t w, int16_t h) { using namespace FTDI; CLCD::CommandFifo::cmd(BEGIN(RECTS)); CLCD::CommandFifo::cmd(VERTEX2F( x * 16, y * 16)); CLCD::CommandFifo::cmd(VERTEX2F((x + w) * 16, (y + h) * 16)); return *this; } inline CommandProcessor& border(int16_t x, int16_t y, int16_t w, int16_t h) { using namespace FTDI; CLCD::CommandFifo::cmd(BEGIN(LINES)); CLCD::CommandFifo::cmd(VERTEX2F( x * 16, y * 16)); CLCD::CommandFifo::cmd(VERTEX2F((x + w) * 16, y * 16)); CLCD::CommandFifo::cmd(VERTEX2F((x + w) * 16, y * 16)); CLCD::CommandFifo::cmd(VERTEX2F((x + w) * 16, (y + h) * 16)); CLCD::CommandFifo::cmd(VERTEX2F((x + w) * 16, (y + h) * 16)); CLCD::CommandFifo::cmd(VERTEX2F( x * 16, (y + h) * 16)); CLCD::CommandFifo::cmd(VERTEX2F( x * 16, (y + h) * 16)); CLCD::CommandFifo::cmd(VERTEX2F( x * 16, y * 16)); return *this; } template<typename T> FORCEDINLINE CommandProcessor& toggle(int16_t x, int16_t y, int16_t w, int16_t h, T text, bool state, uint16_t options = FTDI::OPT_3D) { CLCD::FontMetrics fm(_font); const int16_t widget_h = fm.height * 20.0 / 16; // The y coordinate of the toggle is the baseline of the text, // so we must introduce a fudge factor based on the line height to // actually center the control. const int16_t fudge_y = fm.height * 5 / 16; CLCD::CommandFifo::toggle(x + widget_h, y + (h - widget_h) / 2 + fudge_y, w - widget_h, _font, options, state); CLCD::CommandFifo::str(text); return *this; } CommandProcessor& toggle2(int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P no, FSTR_P yes, bool state, uint16_t options = FTDI::OPT_3D) { char text[strlen_P(FTOP(no)) + strlen_P(FTOP(yes)) + 2]; strcpy_P(text, FTOP(no)); strcat(text, "\xFF"); strcat_P(text, FTOP(yes)); return toggle(x, y, w, h, text, state, options); } // Constrained drawing routines. These constrain the widget inside a box for easier layout. // The FORCEDINLINE ensures that the code is inlined so that all the math is done at compile time. FORCEDINLINE CommandProcessor& track_linear(int16_t x, int16_t y, int16_t w, int16_t h, int16_t tag) { linear_widget_box(x, y, w, h, true); CLCD::CommandFifo::track(x, y, w, h, tag); is_tracking = true; return *this; } FORCEDINLINE CommandProcessor& track_circular(int16_t x, int16_t y, int16_t w, int16_t h, int16_t tag) { circular_widget_box(x,y, w, h); CLCD::CommandFifo::track(x, y, w, h, tag); is_tracking = true; return *this; } uint8_t track_tag (uint16_t &value) { if (is_tracking) { if (FTDI::EventLoop::is_touch_held()) { return CLCD::get_tracker(value); } else { CLCD::CommandFifo::track(0, 0, 0, 0, 0); CLCD::CommandFifo::execute(); is_tracking = false; } } return 0; } FORCEDINLINE CommandProcessor& clock(int16_t x, int16_t y, int16_t w, int16_t h, int16_t hr, int16_t m, int16_t s, int16_t ms, uint16_t options = FTDI::OPT_3D) { const uint16_t r = circular_widget_box(x, y, w, h); CLCD::CommandFifo::clock(x, y, r, options, hr, m, s, ms); return *this; } FORCEDINLINE CommandProcessor& gauge(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t major, uint16_t minor, uint16_t val, uint16_t range, uint16_t options = FTDI::OPT_3D) { const uint16_t r = circular_widget_box(x, y, w, h); CLCD::CommandFifo::gauge(x, y, r, options, major, minor, val, range); return *this; } FORCEDINLINE CommandProcessor& dial(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t val, uint16_t options = FTDI::OPT_3D) { const uint16_t r = circular_widget_box(x, y, w, h); CLCD::CommandFifo::dial(x, y, r, options, val); return *this; } FORCEDINLINE CommandProcessor& slider(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t val, uint16_t range, uint16_t options = FTDI::OPT_3D) { linear_widget_box(x, y, w, h); CLCD::CommandFifo::slider(x, y, w, h, options, val, range); return *this; } FORCEDINLINE CommandProcessor& progress(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t val, uint16_t range, uint16_t options = FTDI::OPT_3D) { linear_widget_box(x, y, w, h); CLCD::CommandFifo::progress(x, y, w, h, options, val, range); return *this; } FORCEDINLINE CommandProcessor& scrollbar(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t val, uint16_t size, uint16_t range, uint16_t options = 0) { linear_widget_box(x, y, w, h); CLCD::CommandFifo::scrollbar(x, y, w, h, options, val, size, range); return *this; } void apply_text_alignment(int16_t &x, int16_t &y, int16_t w, int16_t h, uint16_t options) { using namespace FTDI; x += ((options & OPT_CENTERX) ? w/2 : ((options & OPT_RIGHTX) ? w : 0)); y += ((options & OPT_CENTERY) ? h/2 : h); } // Reduce font size until text fits the enclosing box. template<typename T> int8_t apply_fit_text(int16_t w, int16_t h, T text) { using namespace FTDI; int8_t font = _font; #if ENABLED(TOUCH_UI_USE_UTF8) const bool is_utf8 = has_utf8_chars(text); #endif for (;font > 26;) { int16_t width, height; #if ENABLED(TOUCH_UI_USE_UTF8) if (is_utf8) { width = get_utf8_text_width(text, font_size_t::from_romfont(font)); height = font_size_t::from_romfont(font).get_height(); } else #endif { CLCD::FontMetrics fm(font); width = fm.get_text_width(text); height = fm.height; } if (width < w && height < h) break; font--; } return font; } CommandProcessor& number(int16_t x, int16_t y, int16_t w, int16_t h, int32_t n, uint16_t options = FTDI::OPT_CENTER) { using namespace FTDI; apply_text_alignment(x, y, w, h, options); CLCD::CommandFifo::number(x, y, _font, options, n); return *this; } template<typename T> uint16_t text_width(T text) { using namespace FTDI; #if ENABLED(TOUCH_UI_USE_UTF8) if (has_utf8_chars(text)) return get_utf8_text_width(text, font_size_t::from_romfont(_font)); #endif CLCD::FontMetrics fm(_font); return fm.get_text_width(text); } template<typename T> CommandProcessor& text(int16_t x, int16_t y, int16_t w, int16_t h, T text, uint16_t options = FTDI::OPT_CENTER) { using namespace FTDI; apply_text_alignment(x, y, w, h, options); #ifdef TOUCH_UI_FIT_TEXT const int8_t font = (options & OPT_NOFIT) ? _font : apply_fit_text(w, h, text); #else const int8_t font = _font; #endif #if ENABLED(TOUCH_UI_USE_UTF8) if (has_utf8_chars(text)) draw_utf8_text(*this, x, y, text, font_size_t::from_romfont(font), options); else #endif { CLCD::CommandFifo::text(x, y, font, options); CLCD::CommandFifo::str(text); } return *this; } FORCEDINLINE CommandProcessor& icon(int16_t x, int16_t y, int16_t w, int16_t h, const FTDI::bitmap_info_t& info, const float scale = 1) { using namespace FTDI; cmd(BEGIN(BITMAPS)); if (scale != 1) { cmd(BITMAP_TRANSFORM_A(uint32_t(float(256)/scale))); cmd(BITMAP_TRANSFORM_E(uint32_t(float(256)/scale))); } cmd(BITMAP_SIZE(info.filter, info.wrapx, info.wrapy, info.width*scale, info.height*scale)); cmd(VERTEX2F((x + w/2 - info.width*scale/2)*16, (y + h/2 - info.height*scale/2)*16)); if (scale != 1) { cmd(BITMAP_TRANSFORM_A(256)); cmd(BITMAP_TRANSFORM_E(256)); } return *this; } template<typename T> CommandProcessor& button(int16_t x, int16_t y, int16_t w, int16_t h, T text, uint16_t options = FTDI::OPT_3D) { using namespace FTDI; bool styleModified = false; if (_btn_style_callback) styleModified = _btn_style_callback(*this, _tag, _style, options, false); #ifdef TOUCH_UI_FIT_TEXT const int8_t font = (options & OPT_NOFIT) ? _font : apply_fit_text(w, h, text); #else const int8_t font = _font; #endif CLCD::CommandFifo::button(x, y, w, h, font, options); #if ENABLED(TOUCH_UI_USE_UTF8) if (has_utf8_chars(text)) { CLCD::CommandFifo::str(F("")); apply_text_alignment(x, y, w, h, OPT_CENTER); if (!(options & FTDI::OPT_FLAT)) { // Reproduce the black "shadow" the FTDI adds to the button label CLCD::CommandFifo::cmd(SAVE_CONTEXT()); CLCD::CommandFifo::cmd(COLOR_RGB(0x00000)); draw_utf8_text(*this, x-1, y-1, text, font_size_t::from_romfont(font), OPT_CENTER); CLCD::CommandFifo::cmd(RESTORE_CONTEXT()); } // Draw the button label draw_utf8_text(*this, x, y, text, font_size_t::from_romfont(font), OPT_CENTER); } else #endif CLCD::CommandFifo::str(text); if (_btn_style_callback && styleModified) _btn_style_callback(*this, _tag, _style, options, true); return *this; } template<typename T> CommandProcessor& keys(int16_t x, int16_t y, int16_t w, int16_t h, T keys, uint16_t options = FTDI::OPT_3D) { CLCD::CommandFifo::keys(x, y, w, h, _font, options); CLCD::CommandFifo::str(keys); return *this; } FORCEDINLINE CommandProcessor& spinner(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t style = 0, uint16_t scale = 0) { circular_widget_box(x, y, w, h); CLCD::CommandFifo::spinner(x, y, style, scale); return *this; } };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h
C++
agpl-3.0
20,295
/**************** * dl_cache.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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) /* The Display List Cache mechanism stores the display list corresponding * to a menu into RAM_G so that on subsequent calls drawing the menu does * not require as much SPI traffic. * * Layout of Cache memory: * * The cache memory begins with a table at * DL_CACHE_START: each table entry contains * an address, size and used bytes for a cached * DL slot. * * Immediately following the table is the * DL_FREE_ADDR, which points to free cache * space; following this is occupied DL space, * and after that free space that is yet to * be used. * * location data sizeof * * DL_CACHE_START slot0_addr 4 * slot0_size 4 * slot0_used 4 * slot1_addr 4 * slot1_size 4 * slot1_used 4 * ... * slotN_addr 4 * slotN_size 4 * slotN_used 4 * DL_FREE_ADDR dl_free_ptr 4 * cached data * ... * dl_free_ptr empty space * ... */ #define DL_CACHE_START MAP::RAM_G_SIZE - 0xFFFF #define DL_FREE_ADDR DL_CACHE_START + DL_CACHE_SLOTS * 12 using namespace FTDI; // The init function ensures all cache locations are marked as empty void DLCache::init() { CLCD::mem_write_32(DL_FREE_ADDR, DL_FREE_ADDR + 4); for (uint8_t slot = 0; slot < DL_CACHE_SLOTS; slot++) save_slot(slot, 0, 0, 0); } bool DLCache::has_data() { return dl_slot_size != 0; } bool DLCache::wait_until_idle() { const unsigned long startTime = millis(); do { if ((millis() - startTime) > 250) { SERIAL_ECHO_MSG("Timeout on DL_Cache::Wait_Until_Idle()"); CLCD::CommandFifo::reset(); return false; } #ifdef __MARLIN_FIRMWARE__ ExtUI::yield(); #endif } while (CLCD::CommandFifo::is_processing()); return true; } /* This caches the current display list in RAMG so * that it can be appended later. The memory is * dynamically allocated following DL_FREE_ADDR. * * If min_bytes is provided, then that many bytes * will be reserved so that the cache may be re-written * later with potentially a bigger DL. */ bool DLCache::store(uint32_t min_bytes /* = 0*/) { CLCD::CommandFifo cmd; // Execute any commands already in the FIFO cmd.execute(); if (!wait_until_idle()) return false; // Figure out how long the display list is const uint32_t dl_size = CLCD::dl_size(); if (dl_slot_addr == 0) { // If we are allocating new space... dl_slot_addr = CLCD::mem_read_32(DL_FREE_ADDR); dl_slot_size = max(dl_size, min_bytes); const uint32_t free_space = MAP::RAM_G_SIZE - dl_slot_addr; if (dl_slot_size <= free_space) { CLCD::mem_write_32(DL_FREE_ADDR, dl_slot_addr + dl_slot_size); } else { dl_slot_addr = 0; dl_slot_size = 0; dl_slot_used = 0; } } if (dl_size > dl_slot_size) { // Not enough memory to cache the display list. #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Not enough space in GRAM to cache display list, free space: ", dl_slot_size, " Required: ", dl_size); #endif dl_slot_used = 0; save_slot(); return false; } else { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Saving DL to RAMG cache, bytes: ", dl_slot_used, " Free space: ", dl_slot_size); #endif dl_slot_used = dl_size; save_slot(); cmd.memcpy(dl_slot_addr, MAP::RAM_DL, dl_slot_used); cmd.execute(); return true; } } void DLCache::save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t used) { CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 0, addr); CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 4, size); CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 8, used); } void DLCache::load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used) { addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0); size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4); used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8); } void DLCache::append() { CLCD::CommandFifo cmd; cmd.append(dl_slot_addr, dl_slot_used); #if ENABLED(TOUCH_UI_DEBUG) cmd.execute(); wait_until_idle(); SERIAL_ECHO_MSG("Appending to DL from RAMG cache, bytes: ", dl_slot_used, " REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); #endif } #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp
C++
agpl-3.0
5,868
/************** * dl_cache.h * **************/ /**************************************************************************** * 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 /******************* DISPLAY LIST CACHE MANAGEMENT ************************/ /* The Display List Cache mechanism stores the display list corresponding * to a menu into RAM_G so that on subsequent calls drawing the menu does * not require as much SPI traffic. Dynamic content, such as indicators, * should not be cached. * * The DLCache can be used like so: * * DLCache dlcache(UNIQUE_ID); * * if (dlcache.hasData()) * dlcache.append(); * else * dlcache.store(); // Add stuff to the DL */ class DLCache { private: typedef FTDI::ftdi_registers REG; typedef FTDI::ftdi_memory_map MAP; uint8_t dl_slot_indx; uint32_t dl_slot_addr; uint16_t dl_slot_size; uint16_t dl_slot_used; void load_slot() {load_slot(dl_slot_indx, dl_slot_addr, dl_slot_size, dl_slot_used);} void save_slot() {save_slot(dl_slot_indx, dl_slot_addr, dl_slot_size, dl_slot_used);} static void load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used); static void save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t used); bool wait_until_idle(); public: static void init(); DLCache(uint8_t slot) { dl_slot_indx = slot; load_slot(); } bool has_data(); bool store(uint32_t min_bytes = 0); void append(); }; #define DL_CACHE_SLOTS 250
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h
C++
agpl-3.0
2,662
/****************** * event_loop.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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) using namespace FTDI; enum { UNPRESSED = 0x00 }; tiny_timer_t touch_timer; UIData::flags_t UIData::flags; uint8_t pressed_tag = UNPRESSED; uint8_t UIData::get_persistent_data_mask() { // A bit mask for flags that should be stored to the EEPROM. // Others are considered temporarily values that need not be // saved. constexpr flags_t persistent_flags = { bits: { touch_start_sound: true, touch_end_sound: true, touch_repeat_sound: true, show_animations: true } }; return persistent_flags.value; } void UIData::reset_persistent_data() { // Default values for persistent data constexpr flags_t default_flags = { bits: { touch_start_sound: true, touch_end_sound: true, touch_repeat_sound: true, show_animations: true, touch_debouncing: false, ignore_unpress: false } }; flags.value = default_flags.value; } uint8_t UIData::get_persistent_data() { return flags.value & get_persistent_data_mask(); } void UIData::set_persistent_data(uint8_t value) { flags.value = value & get_persistent_data_mask(); } void UIData::enable_touch_sounds(bool enabled) { UIData::flags.bits.touch_start_sound = enabled; UIData::flags.bits.touch_end_sound = enabled; UIData::flags.bits.touch_repeat_sound = enabled; } bool UIData::touch_sounds_enabled() { return UIData::flags.bits.touch_start_sound || UIData::flags.bits.touch_end_sound || UIData::flags.bits.touch_repeat_sound; } void UIData::enable_animations(bool enabled) { UIData::flags.bits.show_animations = enabled; } bool UIData::animations_enabled() { return UIData::flags.bits.show_animations; } namespace FTDI { uint8_t EventLoop::get_pressed_tag() { return pressed_tag; } bool EventLoop::is_touch_held() { return pressed_tag != 0; } /** * process_events(): Process events from the touch panel. * * This function consists of a state machine that accomplishes the following: * * - Reads the tag register from the touch panel * - Dispatches onTouchStart and onTouchEnd events to the active screen. * - Handles auto-repetition by sending onTouchHeld to the active screen periodically. * - Plays touch feedback "click" sounds when appropriate. * - Performs debouncing to suppress spurious touch events. */ void EventLoop::process_events() { // If the LCD is processing commands, don't check // for tags since they may be changing and could // cause spurious events. if (!touch_timer.elapsed(TOUCH_UPDATE_INTERVAL) || CLCD::CommandFifo::is_processing()) { return; } const uint8_t tag = CLCD::get_tag(); switch (pressed_tag) { case UNPRESSED: if (tag != 0) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Touch start: ", tag); #endif pressed_tag = tag; current_screen.onRefresh(); // When the user taps on a button, activate the onTouchStart handler const uint8_t lastScreen = current_screen.getScreen(); if (current_screen.onTouchStart(tag)) { touch_timer.start(); if (UIData::flags.bits.touch_start_sound) sound.play(press_sound); } // In the case in which a touch event triggered a new screen to be // drawn, we don't issue a touchEnd since it would be sent to the // wrong screen. UIData::flags.bits.ignore_unpress = (lastScreen != current_screen.getScreen()); } else { touch_timer.start(); } break; default: // PRESSED if (!UIData::flags.bits.touch_debouncing) { if (tag == pressed_tag) { // The user is holding down a button. if (touch_timer.elapsed(1000 / TOUCH_REPEATS_PER_SECOND)) { if (current_screen.onTouchHeld(tag)) { current_screen.onRefresh(); if (UIData::flags.bits.touch_repeat_sound) sound.play(repeat_sound); } touch_timer.start(); } } else if (tag == 0) { touch_timer.start(); UIData::flags.bits.touch_debouncing = true; } } else { // Debouncing... if (tag == pressed_tag) { // If while debouncing, we detect a press, then cancel debouncing. UIData::flags.bits.touch_debouncing = false; } else if (touch_timer.elapsed(DEBOUNCE_PERIOD)) { UIData::flags.bits.touch_debouncing = false; if (UIData::flags.bits.ignore_unpress) { UIData::flags.bits.ignore_unpress = false; pressed_tag = UNPRESSED; break; } if (UIData::flags.bits.touch_end_sound) sound.play(unpress_sound); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Touch end: ", pressed_tag); #endif const uint8_t saved_pressed_tag = pressed_tag; pressed_tag = UNPRESSED; current_screen.onTouchEnd(saved_pressed_tag); current_screen.onRefresh(); } } break; } // switch (pressed_tag) } // processEvents() void EventLoop::setup() { CLCD::init(); DLCache::init(); UIData::reset_persistent_data(); current_screen.start(); } void EventLoop::loop() { sound.onIdle(); /** * Guard against re-entry of UI methods, which can * crash. Re-entry can happen because some functions * (e.g. planner.synchronize) call idle(). */ if (!UIData::flags.bits.prevent_reentry) { UIData::flags.bits.prevent_reentry = true; current_screen.onIdle(); process_events(); UIData::flags.bits.prevent_reentry = false; } } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp
C++
agpl-3.0
7,318
/**************** * event_loop.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 STATUS_UPDATE_INTERVAL 1000 #define TOUCH_UPDATE_INTERVAL 50 #define TOUCH_REPEATS_PER_SECOND 4 #define DEBOUNCE_PERIOD 150 class UIData { private: typedef union { struct { uint8_t touch_start_sound : 1; uint8_t touch_end_sound : 1; uint8_t touch_repeat_sound : 1; uint8_t show_animations : 1; uint8_t touch_debouncing : 1; uint8_t ignore_unpress : 1; uint8_t prevent_reentry : 1; } bits; uint8_t value; } flags_t; public: static flags_t flags; static uint8_t get_persistent_data_mask(); static uint8_t get_persistent_data(); static void set_persistent_data(uint8_t value); static void reset_persistent_data(); static void enable_touch_sounds(bool enabled); static bool touch_sounds_enabled(); static void enable_animations(bool enabled); static bool animations_enabled(); }; namespace FTDI { class EventLoop { private: static constexpr FTDI::effect_t press_sound = FTDI::CHACK; static constexpr FTDI::effect_t repeat_sound = FTDI::CHACK; static constexpr FTDI::effect_t unpress_sound = FTDI::POP; static void process_events(); public: static void setup(); static void loop(); static uint8_t get_pressed_tag(); static bool is_touch_held(); }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.h
C++
agpl-3.0
2,787
/******************* * ftdi_extended.h * *******************/ /**************************************************************************** * Written By Mark Pelletier 2019 - Aleph Objects, Inc. * * Written By Marcio Teixeira 201( - 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 #include "../compat.h" #include "../basic/ftdi_basic.h" #ifndef __MARLIN_FIRMWARE__ #define FTDI_EXTENDED #endif #if ENABLED(FTDI_EXTENDED) #include "unicode/font_size_t.h" #include "unicode/unicode.h" #include "unicode/standard_char_set.h" #include "unicode/western_char_set.h" #include "unicode/cyrillic_char_set.h" #include "unicode/font_bitmaps.h" #include "rgb_t.h" #include "bitmap_info.h" #include "tiny_timer.h" #include "grid_layout.h" #include "dl_cache.h" #include "event_loop.h" #include "command_processor.h" #include "screen_types.h" #include "sound_player.h" #include "sound_list.h" #include "polygon.h" #include "poly_ui.h" #include "arrows.h" #include "text_box.h" #include "text_ellipsis.h" #include "adjuster_widget.h" #include "circular_progress.h" #endif
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/ftdi_extended.h
C
agpl-3.0
2,233
/***************** * grid_layout.h * *****************/ /**************************************************************************** * 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 /* The grid layout macros allow buttons to be arranged on a grid so * that their locations become independent of the display size. The * layout model is similar to that of HTML TABLEs. * * These macros are meant to be evaluated into constants at compile * time, so resolution independence can be as efficient as using * hard-coded coordinates. */ // Margin defines the margin (in pixels) on each side of a button in // the layout #ifdef TOUCH_UI_800x480 #define MARGIN_L 5 #define MARGIN_R 5 #define MARGIN_T 5 #define MARGIN_B 5 #define MARGIN_DEFAULT 5 #else #define MARGIN_L 3 #define MARGIN_R 3 #define MARGIN_T 3 #define MARGIN_B 3 #define MARGIN_DEFAULT 3 #endif // The EDGE variables adds some space on the edges of the display #define EDGE_T 0 #define EDGE_B 0 #define EDGE_L 0 #define EDGE_R 0 // _GRID_X and _GRID_Y computes the positions of the divisions on // the layout grid. #define _GRID_X(x) ((x)*(FTDI::display_width-EDGE_R-EDGE_L)/GRID_COLS+EDGE_L) #define _GRID_Y(y) ((y)*(FTDI::display_height-EDGE_B-EDGE_T)/GRID_ROWS+EDGE_T) // BOX_X, BOX_Y, BOX_W and BOX_X returns the top-left and width // and height of position on the grid. #define BOX_X(x) (_GRID_X((x)-1)) #define BOX_Y(y) (_GRID_Y((y)-1)) #define BOX_W(w) (_GRID_X(w) - _GRID_X(0)) #define BOX_H(h) (_GRID_Y(h) - _GRID_Y(0)) // BTN_X, BTN_Y, BTN_W and BTN_X returns the top-left and width // and height of a button, taking into account the button margins. #define BTN_X(x) (BOX_X(x) + MARGIN_L) #define BTN_Y(y) (BOX_Y(y) + MARGIN_T) #define BTN_W(w) (BOX_W(w) - MARGIN_L - MARGIN_R) #define BTN_H(h) (BOX_H(h) - MARGIN_T - MARGIN_B) // Abbreviations for common phrases, to allow a box or button // to be defined in one line of source. #define BTN_POS(x,y) BTN_X(x), BTN_Y(y) #define BTN_SIZE(w,h) BTN_W(w), BTN_H(h) #define BOX_POS(x,y) BOX_X(x), BOX_Y(y) #define BOX_SIZE(w,h) BOX_W(w), BOX_H(h) // Draw a reference grid for ease of spacing out widgets. #define DRAW_LAYOUT_GRID \ { \ cmd.cmd(LINE_WIDTH(4)); \ for (int i = 1; i <= GRID_COLS; i++) { \ cmd.cmd(BEGIN(LINES)); \ cmd.cmd(VERTEX2F(_GRID_X(i) *16, 0 *16)); \ cmd.cmd(VERTEX2F(_GRID_X(i) *16, FTDI::display_height *16)); \ } \ for (int i = 1; i < GRID_ROWS; i++) { \ cmd.cmd(BEGIN(LINES)); \ cmd.cmd(VERTEX2F(0 *16, _GRID_Y(i) *16)); \ cmd.cmd(VERTEX2F(FTDI::display_width *16, _GRID_Y(i) *16)); \ } \ cmd.cmd(LINE_WIDTH(16)); \ } // Routines for subdividing a grid within a box (x,y,w,h) #define SUB_GRID_W(W) ((W)*w/SUB_COLS) #define SUB_GRID_H(H) ((H)*h/SUB_ROWS) #define SUB_GRID_X(X) (SUB_GRID_W((X)-1) + x) #define SUB_GRID_Y(Y) (SUB_GRID_H((Y)-1) + y) #define SUB_X(X) (SUB_GRID_X(X) + MARGIN_L) #define SUB_Y(Y) (SUB_GRID_Y(Y) + MARGIN_T) #define SUB_W(W) (SUB_GRID_W(W) - MARGIN_L - MARGIN_R) #define SUB_H(H) (SUB_GRID_H(H) - MARGIN_T - MARGIN_B) #define SUB_POS(X,Y) SUB_X(X), SUB_Y(Y) #define SUB_SIZE(W,H) SUB_W(W), SUB_H(H) namespace FTDI { #if ENABLED(TOUCH_UI_PORTRAIT) constexpr uint16_t display_width = Vsize; constexpr uint16_t display_height = Hsize; #else constexpr uint16_t display_width = Hsize; constexpr uint16_t display_height = Vsize; #endif }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/grid_layout.h
C++
agpl-3.0
4,861
/************* * poly_ui.h * *************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 /** * The PolyReader class iterates over an array of (x,y) pairs. * For supporting polygons with holes an end-of-loop marker may * be embedded into the data stream: * * const PROGMEM uint16_t data[] = { * x, y, x, y, ..., eol, * ... * x, y, x, y, ..., eol * } * * The PolyReader object can be used to iterate over the points. * * PolyReader r(data, N_ELEMENTS(data)); * * for (r.start();r.has_more(); r.next()) { * uint16_t x = r.x; * uint16_t y = r.y; * * // Do something with the point * ... * * // Do something else if this point * // closes a loop. * if (r.end_of_loop()) { * ... * } * } */ class PolyReader { public: typedef uint16_t type_t; private: static constexpr type_t eol = 0xFFFF; const type_t *p, *top, *end; type_t start_x, start_y; void close_loop() { x = start_x; y = start_y; start_x = eol; start_y = eol; } public: type_t x, y; // Begin reading a polygon data structure PolyReader(const uint16_t data[], const size_t n_elements) : top(data), end(data + n_elements) { start(); } void start() { p = top; start_x = eol; next(); } // Reads the next point in the polygon data structure void next() { if (!p) return; if (p == end) { if (start_x != eol) close_loop(); else p = nullptr; } else { x = pgm_read_word_far(p++); if (x == eol) close_loop(); else { y = pgm_read_word_far(p++); if (start_x == eol) { start_x = x; start_y = y; } } } } bool has_more() { return p != nullptr; } bool end_of_loop() { return start_x == eol; } }; /** * The TransformedPolyReader class works like the PolyReader, * but the (x,y) input is assumed to be normalized onto a * unit square and then mapped to the full 16-bits, i.e. * (0.0,1.0) => (0x0000,0xFFFE). This class will scale the * data to fit the entire display, a bounding box, or apply * some arbitrary affine transform. * * This class is suitable for reading data from "svg2cpp.py" */ class TransformedPolyReader : public PolyReader { private: /** * Fixed point type for fast transformations, supports * values from 0 to 1024, with 1/32 precision. */ static constexpr uint8_t fract_bits = 5; typedef int16_t fix_t; fix_t makefix(float f) { return f * (1 << fract_bits); } // First two rows of 3x3 transformation matrix fix_t a, b, c; fix_t d, e, f; void transform() { /** * Values from PolyReader vary from 0 to FFFE. * As an approximation to dividing by FFFE, * we perform a bit shift right by 16. */ const int32_t px = PolyReader::x; const int32_t py = PolyReader::y; const int32_t round = 1 << (fract_bits-1); x = (((((a * px) + (b * py)) >> 16) + c) + round) >> fract_bits; y = (((((d * px) + (e * py)) >> 16) + f) + round) >> fract_bits; } void set_transform( fix_t A, fix_t B, fix_t C, fix_t D, fix_t E, fix_t F ) { a = A; b = B; c = C; d = D; e = E; f = F; } public: typedef int16_t type_t; type_t x, y; TransformedPolyReader(const uint16_t data[], const size_t n) : PolyReader(data, n) { scale_to_fit(); transform(); } // Set an arbitrary affine transform void set_transform( float A, float B, float C, float D, float E, float F ) { set_transform( makefix(A), makefix(B), makefix(C), makefix(D), makefix(E), makefix(F) ); } // Scale the data to fit a specified bounding box void scale_to_fit(type_t x_min, type_t y_min, type_t x_max, type_t y_max) { fix_t sx = makefix(x_max - x_min); fix_t sy = makefix(y_max - y_min); fix_t tx = makefix(x_min); fix_t ty = makefix(y_min); set_transform( sx, 0, tx, 0, sy, ty ); } // Scale to fit the entire display (default) void scale_to_fit() { scale_to_fit(0, 0, FTDI::display_width, FTDI::display_height); } void next() { PolyReader::next(); transform(); } }; /** * The DeduplicatedPolyReader wraps around another PolyReader * class to remove repeated points from the data. This could * happen when scaling down using TransformedPolyReader, for * example. */ template<class POLY_READER> class DeduplicatedPolyReader : public POLY_READER { private: typename POLY_READER::type_t last_x, last_y; static constexpr typename POLY_READER::type_t eol = 0xFFFF; public: DeduplicatedPolyReader(const uint16_t data[], const size_t n) : POLY_READER(data, n) { last_x = POLY_READER::x; last_y = POLY_READER::y; } void next() { do { if (!POLY_READER::has_more()) return; POLY_READER::next(); } while (POLY_READER::x == last_x && POLY_READER::y == last_y && !POLY_READER::end_of_loop()); if (POLY_READER::end_of_loop()) { last_x = last_y = eol; } else { last_x = POLY_READER::x; last_y = POLY_READER::y; } } }; /** * The helper class allows you to build an interface based on arbitrary * shapes. */ template<class POLY_READER=DeduplicatedPolyReader<TransformedPolyReader>> class GenericPolyUI { protected: CommandProcessor &cmd; draw_mode_t mode; private: // Attributes used to paint buttons uint32_t btn_fill_color = 0x000000; uint32_t btn_shadow_color = 0xF3E0E0; uint8_t btn_shadow_depth = 5; uint32_t btn_stroke_color = 0x000000; uint8_t btn_stroke_width = 28; public: enum ButtonStyle : uint8_t { FILL = 1, STROKE = 2, SHADOW = 4, REGULAR = 7 }; typedef POLY_READER poly_reader_t; GenericPolyUI(CommandProcessor &c, draw_mode_t what = BOTH) : cmd(c), mode(what) {} // Fills a polygon with the current COLOR_RGB void fill(poly_reader_t r, bool clip = true) { using namespace FTDI; int16_t x, y, w, h; if (clip) { // Clipping reduces the number of pixels that are // filled, allowing more complex shapes to be drawn // in the allotted time. bounds(r, x, y, w, h); cmd.cmd(SAVE_CONTEXT()); cmd.cmd(SCISSOR_XY(x, y)); cmd.cmd(SCISSOR_SIZE(w, h)); } Polygon p(cmd); p.begin_fill(); p.begin_loop(); for (r.start();r.has_more();r.next()) { p(r.x * 16, r.y * 16); if (r.end_of_loop()) { p.end_loop(); p.begin_loop(); } } p.end_loop(); p.end_fill(); if (clip) cmd.cmd(RESTORE_CONTEXT()); } void shadow(poly_reader_t r, uint8_t offset) { #if FTDI_API_LEVEL >= 810 using namespace FTDI; cmd.cmd(VERTEX_TRANSLATE_X(offset * 16)); cmd.cmd(VERTEX_TRANSLATE_Y(offset * 16)); fill(r, false); cmd.cmd(VERTEX_TRANSLATE_X(0)); cmd.cmd(VERTEX_TRANSLATE_Y(0)); #endif } // Strokes a polygon with the current COLOR_RGB void stroke(poly_reader_t r) { using namespace FTDI; Polygon p(cmd); p.begin_stroke(); p.begin_loop(); for (r.start();r.has_more(); r.next()) { p(r.x * 16, r.y * 16); if (r.end_of_loop()) { p.end_loop(); p.begin_loop(); } } p.end_loop(); p.end_stroke(); } // Compute the bounds of a polygon void bounds(poly_reader_t r, int16_t &x, int16_t &y, int16_t &w, int16_t &h) { int16_t x_min = INT16_MAX; int16_t y_min = INT16_MAX; int16_t x_max = INT16_MIN; int16_t y_max = INT16_MIN; for (r.start(); r.has_more(); r.next()) { x_min = min(x_min, int16_t(r.x)); x_max = max(x_max, int16_t(r.x)); y_min = min(y_min, int16_t(r.y)); y_max = max(y_max, int16_t(r.y)); } x = x_min; y = y_min; w = x_max - x_min; h = y_max - y_min; } /** * Draw shaped buttons. Buttons are drawn out of a polygon which is * filled and stroked on top of a drop shadow. The button will * become "pushed" when touched. */ void button_fill(const uint32_t color) { btn_fill_color = color; } void button_stroke(const uint32_t color, const uint8_t width) { btn_stroke_color = color; btn_stroke_width = width; } void button_shadow(const uint32_t color, const uint8_t depth) { btn_shadow_color = color; btn_shadow_depth = depth; } void button(const uint8_t tag, poly_reader_t r, uint8_t style = REGULAR) { using namespace FTDI; // Draw the shadow #if FTDI_API_LEVEL >= 810 if (mode & BACKGROUND && style & SHADOW) { cmd.cmd(SAVE_CONTEXT()); cmd.cmd(TAG(tag)); cmd.cmd(VERTEX_TRANSLATE_X(btn_shadow_depth * 16)); cmd.cmd(VERTEX_TRANSLATE_Y(btn_shadow_depth * 16)); cmd.cmd(COLOR_RGB(btn_shadow_color)); fill(r, false); cmd.cmd(RESTORE_CONTEXT()); } #endif if (mode & FOREGROUND) { cmd.cmd(SAVE_CONTEXT()); #if FTDI_API_LEVEL >= 810 if (EventLoop::get_pressed_tag() == tag) { // "Push" the button cmd.cmd(VERTEX_TRANSLATE_X(btn_shadow_depth * 16)); cmd.cmd(VERTEX_TRANSLATE_Y(btn_shadow_depth * 16)); } #endif // Draw the fill and stroke cmd.cmd(TAG(tag)); if (style & FILL) { cmd.cmd(COLOR_RGB(btn_fill_color)); fill(r, false); } if (style & STROKE) { cmd.cmd(COLOR_RGB(btn_stroke_color)); cmd.cmd(LINE_WIDTH(btn_stroke_width)); stroke(r); } cmd.cmd(RESTORE_CONTEXT()); } } void color(const uint32_t color) { cmd.cmd(FTDI::COLOR_RGB(color)); } }; typedef GenericPolyUI<> PolyUI;
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/poly_ui.h
C++
agpl-3.0
11,413
/************* * polygon.h * *************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 /** * The Polygon class helps drawing filled or stroked polygons on the FTDI EVE: * * CommandProcessor cmd; * cmd.cmd(COLOR_RGB(0x00FF00)); * * Polygon p(cmd); * p.begin_fill(); * p.begin_loop(); * p(10,10); * p(20,10); * p(20,20); * p(10,20); * p.end_loop(); * p.begin_loop(); * ... // Additional closed paths * p.end_loop(); * ... * p.end_fill(); * * Based on the example from "Application Note AN_334, FT801 Polygon Application": * * https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/AN_334-FT801_Polygon_Application.pdf */ namespace FTDI { class Polygon { private: FTDI::begin_t path_initiator = FTDI::LINE_STRIP; public: CommandProcessor &cmd; Polygon(CommandProcessor &c) : cmd(c) {} void begin_fill() { using namespace FTDI; cmd.cmd(SAVE_CONTEXT()); cmd.cmd(TAG_MASK(0)); cmd.cmd(CLEAR(0,1,0)); cmd.cmd(COLOR_MASK(0,0,0,0)); cmd.cmd(STENCIL_OP(STENCIL_OP_KEEP, STENCIL_OP_INVERT)); cmd.cmd(STENCIL_FUNC(STENCIL_FUNC_ALWAYS, 255, 255)); // Drawing the edge strip along scan lines // seems to yield the best performance #if ENABLED(TOUCH_UI_PORTRAIT) path_initiator = EDGE_STRIP_B; #else path_initiator = EDGE_STRIP_R; #endif } // Specify a clipping rectangle to paint fewer pixels and reduce rendering time, otherwise all pixels will be painted. void end_fill(const int16_t x1 = 0, const int16_t y1 = 0, const int16_t x2 = display_width * 16, const int16_t y2 = display_height * 16) { using namespace FTDI; cmd.cmd(RESTORE_CONTEXT()); cmd.cmd(SAVE_CONTEXT()); cmd.cmd(STENCIL_FUNC(STENCIL_FUNC_NOTEQUAL, 0, 255)); cmd.cmd(BEGIN(RECTS)); cmd.cmd(VERTEX2F(x1, y1)); cmd.cmd(VERTEX2F(x2, y2)); cmd.cmd(RESTORE_CONTEXT()); } void begin_stroke() {path_initiator = FTDI::LINE_STRIP;} void begin_loop() {cmd.cmd(FTDI::BEGIN(path_initiator));} void end_stroke() {} void end_loop() {} void operator()(const uint16_t x, const uint16_t y) {cmd.cmd(FTDI::VERTEX2F(x, y));} }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/polygon.h
C++
agpl-3.0
3,592
/*********** * rgb_t.h * ***********/ /**************************************************************************** * 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 /** * Implementation of hsl_to_rgb as constexpr functions based on: * * https://www.rapidtables.com/convert/color/hsl-to-rgb.html */ constexpr float _hsl_fmod(float x, float y) { return x - int(x/y)*y; } constexpr float _hsl_c(float, float S, float L) { return (1.0f - fabs(2*L-1.0f)) * S; } constexpr float _hsl_x(float H, float S, float L) { return _hsl_c(H,S,L) * (1.0f - fabs(_hsl_fmod(H/60, 2) - 1)); } constexpr float _hsl_m(float H, float S, float L) { return L - _hsl_c(H,S,L)/2; } constexpr float _hsl_rgb(float H, float S, float L, float r, float g, float b) { return ((uint32_t((r + _hsl_m(H,S,L))*255+0.5) << 16) | (uint32_t((g + _hsl_m(H,S,L))*255+0.5) << 8) | (uint32_t((b + _hsl_m(H,S,L))*255+0.5) << 0)); } constexpr uint32_t hsl_to_rgb(float H, float S, float L) { return (H < 60) ? _hsl_rgb(H,S,L,_hsl_c(H,S,L), _hsl_x(H,S,L), 0) : (H < 120) ? _hsl_rgb(H,S,L,_hsl_x(H,S,L), _hsl_c(H,S,L), 0) : (H < 180) ? _hsl_rgb(H,S,L, 0, _hsl_c(H,S,L), _hsl_x(H,S,L)) : (H < 240) ? _hsl_rgb(H,S,L, 0, _hsl_x(H,S,L), _hsl_c(H,S,L)) : (H < 300) ? _hsl_rgb(H,S,L,_hsl_x(H,S,L), 0, _hsl_c(H,S,L)) : _hsl_rgb(H,S,L,_hsl_c(H,S,L), 0, _hsl_x(H,S,L)); } /** * Structure for RGB colors */ struct rgb_t { union { struct { uint8_t b,g,r,a; }; uint32_t packed; }; rgb_t() : packed(0) {} rgb_t(uint32_t rgb) : packed(rgb) {} rgb_t(uint8_t r, uint8_t g, uint8_t b) : b(b), g(g), r(r), a(0) {} operator uint32_t() const {return packed;}; static void lerp(float t, const rgb_t a, const rgb_t b, rgb_t &c) { c.r = a.r + t * (b.r - a.r); c.g = a.g + t * (b.g - a.g); c.b = a.b + t * (b.b - a.b); } uint8_t luminance() const {return 0.299*r + 0.587*g + 0.114*b;} };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/rgb_t.h
C++
agpl-3.0
3,281
/****************** * screen_types.h * ******************/ /**************************************************************************** * 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) /********************** VIRTUAL DISPATCH DATA TYPE ******************************/ uint8_t ScreenRef::lookupScreen(onRedraw_func_t onRedraw_ptr) { for (uint8_t type = 0; type < tableSize(); type++) { if (GET_METHOD(type, onRedraw) == onRedraw_ptr) { return type; } } #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); SERIAL_ECHOPGM("Screen not found: ", (uintptr_t) onRedraw_ptr); #endif return 0xFF; } void ScreenRef::setScreen(onRedraw_func_t onRedraw_ptr) { uint8_t type = lookupScreen(onRedraw_ptr); if (type != 0xFF) { setType(type); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("New screen: ", type); #endif } } void ScreenRef::initializeAll() { for (uint8_t type = 0; type < tableSize(); type++) GET_METHOD(type, onStartup)(); } /********************** SCREEN STACK ******************************/ void ScreenStack::start() { initializeAll(); onEntry(); } void ScreenStack::push(onRedraw_func_t onRedraw_ptr) { stack[3] = stack[2]; stack[2] = stack[1]; stack[1] = stack[0]; stack[0] = lookupScreen(onRedraw_ptr); } void ScreenStack::push() { stack[3] = stack[2]; stack[2] = stack[1]; stack[1] = stack[0]; stack[0] = getType(); } void ScreenStack::pop() { setType(stack[0]); forget(); } void ScreenStack::forget() { stack[0] = stack[1]; stack[1] = stack[2]; stack[2] = stack[3]; stack[3] = 0; } void ScreenStack::goTo(onRedraw_func_t s) { push(); onExit(); setScreen(s); onEntry(); } void ScreenStack::goBack() { onExit(); pop(); onEntry(); } ScreenStack current_screen; #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp
C++
agpl-3.0
2,990
/******************** * screen_types.cpp * ********************/ /**************************************************************************** * 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 typedef enum { BACKGROUND = 1, FOREGROUND = 2, BOTH = 3 } draw_mode_t; /********************** VIRTUAL DISPATCH DATA TYPE ******************************/ // True virtual classes are extremely expensive on the Arduino // as the compiler stores the virtual function tables in RAM. // We invent a data type called ScreenRef that gives us // polymorphism by mapping an ID to virtual methods on various // classes. This works by keeping a table in PROGMEM of pointers // to static methods. #define DECL_SCREEN(className) { \ className::onStartup, \ className::onEntry, \ className::onExit, \ className::onIdle, \ className::onRefresh, \ className::onRedraw, \ className::onTouchStart, \ className::onTouchHeld, \ className::onTouchEnd \ } #define GET_METHOD(type, method) reinterpret_cast<method##_func_t*>(pgm_read_ptr_far(&functionTable[type].method##_ptr)) #define SCREEN_TABLE PROGMEM const ScreenRef::table_t ScreenRef::functionTable[] = #define SCREEN_TABLE_POST size_t ScreenRef::tableSize() { \ constexpr size_t siz = sizeof(functionTable)/sizeof(functionTable[0]); \ static_assert(siz > 0, "The screen table is empty!"); \ return siz; \ } class ScreenRef { protected: typedef void onStartup_func_t(); typedef void onEntry_func_t(); typedef void onExit_func_t(); typedef void onIdle_func_t(); typedef void onRefresh_func_t(); typedef void onRedraw_func_t(draw_mode_t); typedef bool onTouchStart_func_t(uint8_t); typedef bool onTouchHeld_func_t(uint8_t); typedef bool onTouchEnd_func_t(uint8_t); private: typedef struct { onStartup_func_t *onStartup_ptr; onEntry_func_t *onEntry_ptr; onExit_func_t *onExit_ptr; onIdle_func_t *onIdle_ptr; onRefresh_func_t *onRefresh_ptr; onRedraw_func_t *onRedraw_ptr; onTouchStart_func_t *onTouchStart_ptr; onTouchHeld_func_t *onTouchHeld_ptr; onTouchEnd_func_t *onTouchEnd_ptr; } table_t; uint8_t type = 0; static PROGMEM const table_t functionTable[]; public: static size_t tableSize(); uint8_t getType() {return type;} void setType(uint8_t t) {type = t;} uint8_t lookupScreen(onRedraw_func_t onRedraw_ptr); void setScreen(onRedraw_func_t onRedraw_ptr); void onStartup() {GET_METHOD(type, onStartup)();} void onEntry() {GET_METHOD(type, onEntry)();} void onExit() {GET_METHOD(type, onExit)();} void onIdle() {GET_METHOD(type, onIdle)();} void onRefresh() {GET_METHOD(type, onRefresh)();} void onRedraw(draw_mode_t dm) {GET_METHOD(type, onRedraw)(dm);} bool onTouchStart(uint8_t tag) {return GET_METHOD(type, onTouchStart)(tag);} bool onTouchHeld(uint8_t tag) {return GET_METHOD(type, onTouchHeld)(tag);} bool onTouchEnd(uint8_t tag) {return GET_METHOD(type, onTouchEnd)(tag);} void initializeAll(); }; /********************** SCREEN STACK ******************************/ // To conserve dynamic memory, the screen stack is hard-coded to // have four values, allowing a menu of up to four levels. class ScreenStack : public ScreenRef { private: uint8_t stack[4]; public: void start(); void push(onRedraw_func_t); void push(); void pop(); void forget(); void goTo(onRedraw_func_t); void goBack(); uint8_t peek() {return stack[0];} uint8_t getScreen() {return getType();} }; extern ScreenStack current_screen; /********************** BASE SCREEN CLASS ******************************/ /* UIScreen is the base class for all user interface screens. */ class UIScreen { public: static void onStartup() {} static void onEntry() {current_screen.onRefresh();} static void onExit() {} static void onIdle() {} static bool onTouchStart(uint8_t) {return true;} static bool onTouchHeld(uint8_t) {return false;} static bool onTouchEnd(uint8_t) {return true;} }; #define PUSH_SCREEN(screen) current_screen.push(screen::onRedraw) #define GOTO_SCREEN(screen) current_screen.goTo(screen::onRedraw) #define GOTO_PREVIOUS() current_screen.goBack(); #define AT_SCREEN(screen) (current_screen.getType() == current_screen.lookupScreen(screen::onRedraw)) #define IS_PARENT_SCREEN(screen) (current_screen.peek() == current_screen.lookupScreen(screen::onRedraw)) /************************** CACHED VS UNCACHED SCREENS ***************************/ class UncachedScreen { public: static void onRefresh() { using namespace FTDI; CommandProcessor cmd; cmd.cmd(CMD_DLSTART); #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); #endif current_screen.onRedraw(BOTH); cmd.cmd(DL::DL_DISPLAY); cmd.cmd(CMD_SWAP); cmd.execute(); } }; template<uint8_t DL_SLOT,uint32_t DL_SIZE = 0> class CachedScreen { protected: static void gfxError() { using namespace FTDI; CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR(true,true,true)) .font(30) .text(0, 0, display_width, display_height, F("GFX MEM FULL")); } static bool storeBackground() { DLCache dlcache(DL_SLOT); if (!dlcache.store(DL_SIZE)) { SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space"); gfxError(); // Try to cache a shorter error message instead. dlcache.store(DL_SIZE); return false; } return true; } static void repaintBackground() { using namespace FTDI; DLCache dlcache(DL_SLOT); CommandProcessor cmd; cmd.cmd(CMD_DLSTART); #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); #endif current_screen.onRedraw(BACKGROUND); dlcache.store(DL_SIZE); } public: static void onRefresh() { #if ENABLED(TOUCH_UI_DEBUG) const uint32_t start_time = millis(); #endif using namespace FTDI; DLCache dlcache(DL_SLOT); CommandProcessor cmd; cmd.cmd(CMD_DLSTART); if (dlcache.has_data()) { dlcache.append(); } else { #if ENABLED(TOUCH_UI_USE_UTF8) load_utf8_bitmaps(cmd); #endif current_screen.onRedraw(BACKGROUND); dlcache.store(DL_SIZE); } current_screen.onRedraw(FOREGROUND); cmd.cmd(DL::DL_DISPLAY); cmd.cmd(CMD_SWAP); cmd.execute(); #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHOLNPGM("Time to draw screen (ms): ", millis() - start_time); #endif } };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h
C++
agpl-3.0
8,173
/**************** * sound_list.h * ****************/ /**************************************************************************** * 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 class SoundList { private: static PROGMEM const struct list_t { const char * const PROGMEM name; const FTDI::SoundPlayer::sound_t* data; } list[]; public: static const uint8_t n; static const char* name(uint8_t val) { return (const char* ) pgm_read_ptr_far(&list[val].name); } static FTDI::SoundPlayer::sound_t* data(uint8_t val) { return (FTDI::SoundPlayer::sound_t*) pgm_read_ptr_far(&list[val].data); } };
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_list.h
C++
agpl-3.0
1,785
/******************** * sound_player.cpp * ********************/ /**************************************************************************** * 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) namespace FTDI { SoundPlayer sound; // Global sound player object void SoundPlayer::set_volume(uint8_t vol) { CLCD::mem_write_8(REG::VOL_SOUND, vol); } uint8_t SoundPlayer::get_volume() { return CLCD::mem_read_8(REG::VOL_SOUND); } void SoundPlayer::play(effect_t effect, note_t note) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_MSG("Playing note ", note, ", instrument ", effect); #endif // Play the note CLCD::mem_write_16(REG::SOUND, (note == REST) ? 0 : (((note ?: NOTE_C4) << 8) | effect)); CLCD::mem_write_8(REG::PLAY, 1); } note_t SoundPlayer::frequency_to_midi_note(const uint16_t frequency_hz) { const float f0 = 440; return note_t(NOTE_A4 + (log(frequency_hz)-log(f0))*12/log(2) + 0.5); } // Plays a tone of a given frequency and duration. Since the FTDI FT810 only // supports MIDI notes, we round down to the nearest note. void SoundPlayer::play_tone(const uint16_t frequency_hz, const uint16_t duration_ms) { play(ORGAN, frequency_to_midi_note(frequency_hz)); // Schedule silence to squelch the note after the duration expires. sequence = silence; wait = duration_ms; timer.start(); } void SoundPlayer::play(const sound_t *seq, play_mode_t mode) { sequence = seq; wait = 250; // Adding this delay causes the note to not be clipped, not sure why. timer.start(); if (mode == PLAY_ASYNCHRONOUS) return; // If playing synchronously, then play all the notes here while (has_more_notes()) { onIdle(); TERN_(TOUCH_UI_FTDI_EVE, ExtUI::yield()); } } bool SoundPlayer::is_sound_playing() { return CLCD::mem_read_8( REG::PLAY ) & 0x1; } void SoundPlayer::onIdle() { if (!sequence) return; const bool ready_for_next_note = (wait == 0) ? !is_sound_playing() : timer.elapsed(wait); if (ready_for_next_note) { const effect_t fx = effect_t(pgm_read_byte(&sequence->effect)); const note_t nt = note_t(pgm_read_byte(&sequence->note)); const uint32_t ms = uint32_t(pgm_read_byte(&sequence->sixteenths)) * 1000 / 16; if (ms == 0 && fx == SILENCE && nt == END_SONG) { sequence = 0; play(SILENCE, REST); } else { wait = ms; timer.start(); play(fx, nt); sequence++; } } } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.cpp
C++
agpl-3.0
3,754
/****************** * sound_player.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 namespace FTDI { typedef enum { PLAY_ASYNCHRONOUS, PLAY_SYNCHRONOUS } play_mode_t; class SoundPlayer { typedef FTDI::ftdi_registers REG; typedef FTDI::ftdi_memory_map MAP; public: struct sound_t { effect_t effect; // The sound effect number note_t note; // The MIDI note value uint16_t sixteenths; // Duration of note, in sixteeths of a second, or zero to play to completion }; const uint8_t WAIT = 0; private: const sound_t *sequence; tiny_timer_t timer; tiny_time_t wait; note_t frequency_to_midi_note(const uint16_t frequency); public: static void set_volume(uint8_t volume); static uint8_t get_volume(); static void play(effect_t effect, note_t note = NOTE_C4); static bool is_sound_playing(); void play(const sound_t *seq, play_mode_t mode = PLAY_SYNCHRONOUS); void play_tone(const uint16_t frequency_hz, const uint16_t duration_ms); bool has_more_notes() {return sequence != 0;}; void onIdle(); }; extern SoundPlayer sound; const PROGMEM SoundPlayer::sound_t silence[] = { {SILENCE, END_SONG, 0} }; }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/sound_player.h
C++
agpl-3.0
2,617
/**************** * text_box.cpp * ****************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) #define IS_LINE_SEPARATOR(c) c == '\n' || c == '\t' #define IS_WORD_SEPARATOR(c) c == ' ' #define IS_SEPARATOR(c) IS_LINE_SEPARATOR(c) || IS_WORD_SEPARATOR(c) namespace FTDI { /** * Given a str, end will be set to the position at which a line needs to * be broken so that the display width is less than w. The line will also * be broken after a '\n'. Returns the display width of the line. */ static uint16_t find_line_break(const FontMetrics &utf8_fm, const CLCD::FontMetrics &clcd_fm, const uint16_t w, const char *start, const char *&end, bool use_utf8) { const char *p = start; end = start; uint16_t lw = 0, result = 0; for (;;) { const char *next = p; const utf8_char_t c = get_utf8_char_and_inc(next); // Decide whether to break the string at this location if (IS_SEPARATOR(c) || c == '\0' ) { end = p; result = lw; } if (IS_LINE_SEPARATOR(c) || c == '\0') break; // Measure the next character const uint16_t cw = use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c]; // Stop processing once string exceeds the display width if (lw + cw > w) break; // Now add the length of the current character to the tally. lw += cw; p = next; } if (end == start) { end = p; result = lw; } return result; } /** * This function returns a measurements of the word-wrapped text box. */ static void measure_text_box(const FontMetrics &utf8_fm, const CLCD::FontMetrics &clcd_fm, const char *str, uint16_t &width, uint16_t &height, bool use_utf8) { const char *line_start = (const char*)str; const char *line_end; const uint16_t wrap_width = width; width = height = 0; for (;;) { const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8); width = max(width, line_width); height += utf8_fm.get_height(); if (IS_SEPARATOR(*line_end)) line_end++; if (*line_end == '\0') break; if (line_end == line_start) break; line_start = line_end; } } /** * This function draws text inside a bounding box, doing word wrapping and using the largest font that will fit. */ void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options, uint8_t font) { #if ENABLED(TOUCH_UI_USE_UTF8) const bool use_utf8 = has_utf8_chars(str); #else constexpr bool use_utf8 = false; #endif uint16_t box_width, box_height; FontMetrics utf8_fm(font); CLCD::FontMetrics clcd_fm; clcd_fm.load(font); // Shrink the font until we find a font that fits for (;;) { box_width = w; measure_text_box(utf8_fm, clcd_fm, str, box_width, box_height, use_utf8); if (box_width <= (uint16_t)w && box_height <= (uint16_t)h) break; if (font == 26) break; utf8_fm.load(--font); clcd_fm.load(font); } const uint16_t dx = (options & OPT_RIGHTX) ? w : (options & OPT_CENTERX) ? w / 2 : 0, dy = (options & OPT_BOTTOMY) ? (h - box_height) : (options & OPT_CENTERY) ? (h - box_height) / 2 : 0; const char *line_start = str, *line_end; for (;;) { find_line_break(utf8_fm, clcd_fm, w, line_start, line_end, use_utf8); const size_t line_len = line_end - line_start; if (line_len) { #if ENABLED(TOUCH_UI_USE_UTF8) if (use_utf8) draw_utf8_text(cmd, x + dx, y + dy, line_start, utf8_fm.fs, options & ~(OPT_CENTERY | OPT_BOTTOMY), line_len); else #endif { cmd.CLCD::CommandFifo::text(x + dx, y + dy, font, options & ~(OPT_CENTERY | OPT_BOTTOMY)); cmd.CLCD::CommandFifo::str(line_start, line_len); } } y += utf8_fm.get_height(); if (IS_SEPARATOR(*line_end)) line_end++; if (*line_end == '\0') break; if (line_end == line_start) break; line_start = line_end; } } void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P fstr, uint16_t options, uint8_t font) { #ifdef __AVR__ char str[strlen_P(FTOP(fstr)) + 1]; strcpy_P(str, FTOP(fstr)); draw_text_box(cmd, x, y, w, h, (const char*) str, options, font); #else draw_text_box(cmd, x, y, w, h, FTOP(fstr), options, font); #endif } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp
C++
agpl-3.0
5,841
/************** * text_box.h * **************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 /** * This function draws text inside a bounding box, doing word wrapping and using the largest font that will fit. */ namespace FTDI { constexpr uint16_t OPT_BOTTOMY = 0x1000; // Non-standard void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P str, uint16_t options = 0, uint8_t font = 31); void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31); }
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.h
C++
agpl-3.0
1,788
/********************* * text_ellipsis.cpp * *********************/ /**************************************************************************** * Written By Marcio Teixeira 2019 - 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 "ftdi_extended.h" #if ENABLED(FTDI_EXTENDED) namespace FTDI { /** * Helper function for drawing text with ellipses. The str buffer may be modified and should have space for up to two extra characters. */ static void _draw_text_with_ellipsis(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, char *str, uint16_t options, uint8_t font) { #if ENABLED(TOUCH_UI_USE_UTF8) const bool use_utf8 = has_utf8_chars(str); #define CHAR_WIDTH(c) use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c] #else constexpr bool use_utf8 = false; #define CHAR_WIDTH(c) utf8_fm.get_char_width(c) #endif FontMetrics utf8_fm(font); CLCD::FontMetrics clcd_fm; clcd_fm.load(font); const int16_t ellipsisWidth = utf8_fm.get_char_width('.') * 3; // Compute the total line length, as well as // the location in the string where it can // split and still allow the ellipsis to fit. int16_t lineWidth = 0; char *breakPoint = str; const char *next = str; while (*next) { const utf8_char_t c = get_utf8_char_and_inc(next); lineWidth += CHAR_WIDTH(c); if (lineWidth + ellipsisWidth < w) breakPoint = (char*)next; } if (lineWidth > w) strcpy_P(breakPoint, PSTR("...")); cmd.apply_text_alignment(x, y, w, h, options); if (use_utf8) { TERN_(TOUCH_UI_USE_UTF8, draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options)); } else { cmd.CLCD::CommandFifo::text(x, y, font, options); cmd.CLCD::CommandFifo::str(str); } } /** * These functions draws text inside a bounding box, truncating the text and * adding ellipsis if the text does not fit. */ void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options, uint8_t font) { char tmp[strlen(str) + 3]; strcpy(tmp, str); _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); } void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P fstr, uint16_t options, uint8_t font) { char tmp[strlen_P(FTOP(fstr)) + 3]; strcpy_P(tmp, FTOP(fstr)); _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); } } // namespace FTDI #endif // FTDI_EXTENDED
2301_81045437/Marlin
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp
C++
agpl-3.0
3,649