You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.5 KiB
79 lines
2.5 KiB
3 years ago
|
/**
|
||
3 years ago
|
* 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
|
||
3 years ago
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
3 years ago
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
3 years ago
|
* (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.
|
||
|
*
|
||
3 years ago
|
* You should have received a copy of the GNU General Public License
|
||
3 years ago
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
|
||
3 years ago
|
/**
|
||
3 years ago
|
* Lock screen implementation for DWIN UI Enhanced implementation
|
||
3 years ago
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||
3 years ago
|
* Version: 2.1
|
||
|
* Date: 2021/11/09
|
||
3 years ago
|
*
|
||
|
* Based on the original code provided by Creality under GPL
|
||
3 years ago
|
*/
|
||
|
|
||
3 years ago
|
#include "../../../inc/MarlinConfigPre.h"
|
||
|
|
||
|
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
|
||
|
|
||
|
#include "../../../core/types.h"
|
||
|
#include "dwin_lcd.h"
|
||
|
#include "dwinui.h"
|
||
|
#include "dwin.h"
|
||
|
#include "lockscreen.h"
|
||
|
|
||
3 years ago
|
LockScreenClass lockScreen;
|
||
|
|
||
|
uint8_t LockScreenClass::lock_pos = 0;
|
||
|
bool LockScreenClass::unlocked = false;
|
||
3 years ago
|
uint8_t LockScreenClass::rprocess = 0;
|
||
3 years ago
|
|
||
3 years ago
|
void LockScreenClass::init() {
|
||
|
lock_pos = 0;
|
||
3 years ago
|
unlocked = false;
|
||
3 years ago
|
draw();
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
void LockScreenClass::draw() {
|
||
3 years ago
|
Title.SetCaption(PSTR("Lock Screen"));
|
||
|
DWINUI::ClearMenuArea();
|
||
|
DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo
|
||
|
DWINUI::Draw_CenteredString(Color_White, 180, F("Printer is Locked,"));
|
||
|
DWINUI::Draw_CenteredString(Color_White, 200, F("Scroll to unlock."));
|
||
|
DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-"));
|
||
|
DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
|
||
3 years ago
|
DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
||
3 years ago
|
DWIN_UpdateLCD();
|
||
|
}
|
||
|
|
||
3 years ago
|
void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
|
||
|
switch (encoder_diffState) {
|
||
|
case ENCODER_DIFF_CW: lock_pos += 8; break;
|
||
|
case ENCODER_DIFF_CCW: lock_pos -= 8; break;
|
||
|
case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break;
|
||
|
default: break;
|
||
3 years ago
|
}
|
||
|
DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
|
||
3 years ago
|
DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
||
3 years ago
|
DWIN_UpdateLCD();
|
||
|
}
|
||
|
|
||
|
#endif // DWIN_CREALITY_LCD_ENHANCED
|