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
|
|---|---|---|---|---|---|
/***************************
* max_velocity_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 FTDI_MAX_VELOCITY_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
void MaxVelocityScreen::onRedraw(draw_mode_t what) {
using namespace ExtUI;
widgets_t w(what);
w.precision(0);
w.units(GET_TEXT_F(MSG_UNITS_MM_S));
w.heading( GET_TEXT_F(MSG_MAX_SPEED_NO_UNITS));
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_VMAX_X), getAxisMaxFeedrate_mm_s(X) );
w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_VMAX_Y), getAxisMaxFeedrate_mm_s(Y) );
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_VMAX_Z), getAxisMaxFeedrate_mm_s(Z) );
#if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_VMAX_E), getAxisMaxFeedrate_mm_s(E0) );
#elif HAS_MULTI_EXTRUDER
w.heading(GET_TEXT_F(MSG_VMAX_E));
w.color(e_axis) .adjuster( 8, F(STR_E0), getAxisMaxFeedrate_mm_s(E0) );
w.color(e_axis) .adjuster( 10, F(STR_E1), getAxisMaxFeedrate_mm_s(E1) );
#if EXTRUDERS > 2
w.color(e_axis).adjuster( 12, F(STR_E2), getAxisMaxFeedrate_mm_s(E2) );
#if EXTRUDERS > 3
w.color(e_axis).adjuster( 14, F(STR_E3), getAxisMaxFeedrate_mm_s(E3) );
#endif
#endif
#endif
w.increments();
}
bool MaxVelocityScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
case 2: UI_DECREMENT(AxisMaxFeedrate_mm_s, X); break;
case 3: UI_INCREMENT(AxisMaxFeedrate_mm_s, X); break;
case 4: UI_DECREMENT(AxisMaxFeedrate_mm_s, Y); break;
case 5: UI_INCREMENT(AxisMaxFeedrate_mm_s, Y); break;
case 6: UI_DECREMENT(AxisMaxFeedrate_mm_s, Z); break;
case 7: UI_INCREMENT(AxisMaxFeedrate_mm_s, Z); break;
#if DISTINCT_E
case 8: UI_DECREMENT(AxisMaxFeedrate_mm_s, E0); break;
case 9: UI_INCREMENT(AxisMaxFeedrate_mm_s, E0); break;
#if DISTINCT_E > 1
case 10: UI_DECREMENT(AxisMaxFeedrate_mm_s, E1); break;
case 11: UI_INCREMENT(AxisMaxFeedrate_mm_s, E1); break;
#if DISTINCT_E > 2
case 12: UI_DECREMENT(AxisMaxFeedrate_mm_s, E2); break;
case 13: UI_INCREMENT(AxisMaxFeedrate_mm_s, E2); break;
#if DISTINCT_E > 3
case 14: UI_DECREMENT(AxisMaxFeedrate_mm_s, E3); break;
case 15: UI_INCREMENT(AxisMaxFeedrate_mm_s, E3); break;
#endif
#endif
#endif
#endif
default: return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_MAX_VELOCITY_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/max_velocity_screen.cpp
|
C++
|
agpl-3.0
| 3,958
|
/*************************
* max_velocity_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 FTDI_MAX_VELOCITY_SCREEN
#define FTDI_MAX_VELOCITY_SCREEN_CLASS MaxVelocityScreen
class MaxVelocityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_VELOCITY_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/generic/max_velocity_screen.h
|
C++
|
agpl-3.0
| 1,721
|
/***************************
* media_player_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"
/**
* The MediaPlayerScreen allows an AVI to be played.
*
* It requires a special AVI file. The following video
* and audio codecs must be used:
*
* -vcodec mjpeg -pix_fmt yuvj420p
* -acodec adpcm_ima_wav
*
* To generate a 2 second static screen from a png file:
*
* ffmpeg -i startup.png -vcodec mjpeg -pix_fmt yuvj420p -r 1 video.avi
* sox -n -r 44100 -b 8 -c 2 -L silence.wav trim 0.0 2.000
* ffmpeg -i silence.wav -acodec adpcm_ima_wav silence.avi
* ffmpeg -i video.avi -i silence.wav -c copy -map 0:v:0 -map 1:a:0 startup.avi
*/
#ifdef FTDI_MEDIA_PLAYER_SCREEN
#include "../archim2-flash/flash_storage.h"
#include "../archim2-flash/media_file_reader.h"
using namespace FTDI;
void MediaPlayerScreen::onEntry() {
BaseScreen::onEntry();
CLCD::turn_on_backlight();
SoundPlayer::set_volume(255);
}
void MediaPlayerScreen::onRedraw(draw_mode_t) {
}
bool MediaPlayerScreen::playCardMedia() {
#if HAS_MEDIA
char fname[15];
strcpy_P(fname, PSTR("STARTUP.AVI"));
MediaFileReader reader;
if (!reader.open(fname))
return false;
SERIAL_ECHO_MSG("Starting to play STARTUP.AVI");
playStream(&reader, MediaFileReader::read);
reader.close();
#endif
return true;
}
// Attempt to play media from the onboard SPI flash chip
bool MediaPlayerScreen::playBootMedia() {
UIFlashStorage::BootMediaReader reader;
if (!reader.isAvailable()) return false;
SERIAL_ECHO_MSG("Starting to play boot video");
playStream(&reader, UIFlashStorage::BootMediaReader::read);
return true;
}
void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream) {
#if FTDI_API_LEVEL >= 810
if (FTDI::ftdi_chip >= 810) {
// Set up the media FIFO on the end of RAMG, as the top of RAMG
// will be used as the framebuffer.
uint8_t buf[512];
const uint32_t block_size = 512;
const uint32_t fifo_size = block_size * 2;
const uint32_t fifo_start = CLCD::MAP::RAM_G + CLCD::MAP::RAM_G_SIZE - fifo_size;
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(0x000000))
.cmd(CLEAR(true,true,true))
.cmd(DL::DL_DISPLAY)
.cmd(CMD_SWAP)
.execute()
.cmd(CMD_DLSTART)
.mediafifo(fifo_start, fifo_size)
.playvideo(OPT_FULLSCREEN | OPT_MEDIAFIFO | OPT_NOTEAR | OPT_SOUND)
.cmd(DL::DL_DISPLAY)
.cmd(CMD_SWAP)
.execute();
uint32_t writePtr = 0;
int16_t nBytes;
uint32_t t = millis();
uint8_t timeouts;
spiInit(SPI_HALF_SPEED); // Boost SPI speed for video playback
do {
// Write block n
nBytes = (*data_stream)(obj, buf, block_size);
if (nBytes == -1) break;
if (millis() - t > 10) {
ExtUI::yield();
t = millis();
}
CLCD::mem_write_bulk (fifo_start + writePtr, buf, nBytes);
// Wait for FTDI810 to finish playing block n-1
timeouts = 20;
do {
if (millis() - t > 10) {
ExtUI::yield();
t = millis();
timeouts--;
if (timeouts == 0) {
SERIAL_ECHO_MSG("Timeout playing video");
cmd.reset();
goto exit;
}
}
} while (CLCD::mem_read_32(CLCD::REG::MEDIAFIFO_READ) != writePtr);
// Start playing block n
writePtr = (writePtr + nBytes) % fifo_size;
CLCD::mem_write_32(CLCD::REG::MEDIAFIFO_WRITE, writePtr);
} while (nBytes == block_size);
SERIAL_ECHO_MSG("Done playing video");
exit:
spiInit(SD_SPI_SPEED); // Restore default speed
// Since playing media overwrites RAMG, we need to reinitialize
// everything that is stored in RAMG.
cmd.cmd(CMD_DLSTART).execute();
DLCache::init();
StatusScreen::loadBitmaps();
}
#else
UNUSED(obj);
UNUSED(data_stream);
#endif // FTDI_API_LEVEL >= 810
}
#endif // FTDI_MEDIA_PLAYER_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/media_player_screen.cpp
|
C++
|
agpl-3.0
| 5,466
|
/*************************
* media_player_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 FTDI_MEDIA_PLAYER_SCREEN
#define FTDI_MEDIA_PLAYER_SCREEN_CLASS MediaPlayerScreen
class MediaPlayerScreen : public BaseScreen, public UncachedScreen {
private:
typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes);
public:
static bool playCardMedia();
static bool playBootMedia();
static void onEntry();
static void onRedraw(draw_mode_t);
static void playStream(void *obj, media_streamer_func_t*);
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/media_player_screen.h
|
C++
|
agpl-3.0
| 1,887
|
/************************
* move_axis_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 FTDI_MOVE_AXIS_SCREEN
using namespace FTDI;
using namespace ExtUI;
constexpr static MoveAxisScreenData &mydata = screen_data.MoveAxisScreen;
void BaseMoveAxisScreen::onEntry() {
// Since Marlin keeps only one absolute position for all the extruders,
// we have to keep track of the relative motion of individual extruders
// ourselves. The relative distances are reset to zero whenever this
// screen is entered.
for (uint8_t i = 0; i < ExtUI::extruderCount; ++i) {
mydata.e_rel[i] = 0;
}
BaseNumericAdjustmentScreen::onEntry();
}
void MoveAxisScreen::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_MOVE_AXIS));
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.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));
#if EXTRUDERS > 3
w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3));
#endif
#endif
#endif
#if Z_HOME_TO_MIN
w.button(24, GET_TEXT_F(MSG_MOVE_Z_TO_TOP), !axis_should_home(Z_AXIS));
#endif
w.increments();
}
bool BaseMoveAxisScreen::onTouchHeld(const uint8_t tag) {
#define UI_INCREMENT_AXIS(axis) setManualFeedrate(axis, increment); UI_INCREMENT(AxisPosition_mm, axis);
#define UI_DECREMENT_AXIS(axis) setManualFeedrate(axis, increment); UI_DECREMENT(AxisPosition_mm, axis);
const float increment = getIncrement();
switch (tag) {
#if HAS_X_AXIS
case 2: UI_DECREMENT_AXIS(X); break;
case 3: UI_INCREMENT_AXIS(X); break;
#endif
#if HAS_EXTRUDERS
// For extruders, also update relative distances.
case 8: UI_DECREMENT_AXIS(E0); mydata.e_rel[0] -= increment; break;
case 9: UI_INCREMENT_AXIS(E0); mydata.e_rel[0] += increment; break;
#if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT_AXIS(E1); mydata.e_rel[1] -= increment; break;
case 11: UI_INCREMENT_AXIS(E1); mydata.e_rel[1] += increment; break;
#if EXTRUDERS > 2
case 12: UI_DECREMENT_AXIS(E2); mydata.e_rel[2] -= increment; break;
case 13: UI_INCREMENT_AXIS(E2); mydata.e_rel[2] += increment; break;
#if EXTRUDERS > 3
case 14: UI_DECREMENT_AXIS(E3); mydata.e_rel[3] -= increment; break;
case 15: UI_INCREMENT_AXIS(E3); mydata.e_rel[3] += increment; break;
#endif
#endif
#endif
#endif
#if HAS_Y_AXIS
case 4: UI_DECREMENT_AXIS(Y); break;
case 5: UI_INCREMENT_AXIS(Y); break;
case 20: SpinnerDialogBox::enqueueAndWait(F("G28X")); break;
case 21: SpinnerDialogBox::enqueueAndWait(F("G28Y")); break;
#if HAS_Z_AXIS
case 6: UI_DECREMENT_AXIS(Z); break;
case 7: UI_INCREMENT_AXIS(Z); break;
case 22: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break;
case 24: raiseZtoTop(); break;
#endif
#endif
case 23: SpinnerDialogBox::enqueueAndWait(F("G28")); break;
default:
return false;
}
return true;
}
void BaseMoveAxisScreen::raiseZtoTop() {
constexpr xyz_feedrate_t homing_feedrate = HOMING_FEEDRATE_MM_M;
setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate.z);
}
float BaseMoveAxisScreen::getManualFeedrate(const uint8_t axis, const_float_t increment_mm) {
// Compute 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.
constexpr xyze_feedrate_t max_manual_feedrate = MANUAL_FEEDRATE;
return min(MMM_TO_MMS(max_manual_feedrate[axis]), ABS(increment_mm * (TOUCH_REPEATS_PER_SECOND) * 0.80f));
}
void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::axis_t axis, const_float_t increment_mm) {
ExtUI::setFeedrate_mm_s(getManualFeedrate(X_AXIS + (axis - ExtUI::X), increment_mm));
}
#if HAS_EXTRUDERS
void BaseMoveAxisScreen::setManualFeedrate(const ExtUI::extruder_t, const_float_t increment_mm) {
ExtUI::setFeedrate_mm_s(getManualFeedrate(E_AXIS, increment_mm));
}
#endif
void MoveAxisScreen::onIdle() {
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
onRefresh();
refresh_timer.start();
}
BaseScreen::onIdle();
}
#endif // FTDI_MOVE_AXIS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp
|
C++
|
agpl-3.0
| 6,330
|
/**********************
* move_axis_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 FTDI_MOVE_AXIS_SCREEN
#define FTDI_MOVE_AXIS_SCREEN_CLASS MoveAxisScreen
struct MoveAxisScreenData {
struct BaseNumericAdjustmentScreenData placeholder;
float e_rel[ExtUI::extruderCount];
};
class BaseMoveAxisScreen : public BaseNumericAdjustmentScreen {
private:
static float getManualFeedrate(const uint8_t axis, const_float_t increment_mm);
public:
static void raiseZtoTop();
static void setManualFeedrate(const ExtUI::axis_t, const_float_t increment_mm);
static void setManualFeedrate(const ExtUI::extruder_t, const_float_t increment_mm);
static void onEntry();
static bool onTouchHeld(const uint8_t tag);
};
class MoveAxisScreen : public BaseMoveAxisScreen, public CachedScreen<MOVE_AXIS_SCREEN_CACHE> {
public:
static void onRedraw(draw_mode_t);
static void onIdle();
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.h
|
C++
|
agpl-3.0
| 2,247
|
/*****************************
* nozzle_offsets_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 FTDI_NOZZLE_OFFSETS_SCREEN
using namespace FTDI;
using namespace ExtUI;
void NozzleOffsetScreen::onEntry() {
// Since we don't allow the user to edit the offsets for E0,
// make sure they are all zero.
normalizeNozzleOffset(X);
normalizeNozzleOffset(Y);
normalizeNozzleOffset(Z);
}
void NozzleOffsetScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(2).units(GET_TEXT_F(MSG_UNITS_MM));
w.heading( GET_TEXT_F(MSG_OFFSETS_MENU));
w.color(Theme::x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), ExtUI::getNozzleOffset_mm(X, E1));
w.color(Theme::y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), ExtUI::getNozzleOffset_mm(Y, E1));
w.color(Theme::z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), ExtUI::getNozzleOffset_mm(Z, E1));
#if ENABLED(CALIBRATION_GCODE)
w.button(8, GET_TEXT_F(MSG_MEASURE_AUTOMATICALLY), !isPrinting());
#endif
w.increments();
}
bool NozzleOffsetScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
case 2: UI_DECREMENT(NozzleOffset_mm, X, E1); break;
case 3: UI_INCREMENT(NozzleOffset_mm, X, E1); break;
case 4: UI_DECREMENT(NozzleOffset_mm, Y, E1); break;
case 5: UI_INCREMENT(NozzleOffset_mm, Y, E1); break;
case 6: UI_DECREMENT(NozzleOffset_mm, Z, E1); break;
case 7: UI_INCREMENT(NozzleOffset_mm, Z, E1); break;
#if ENABLED(CALIBRATION_GCODE)
case 8: GOTO_SCREEN(ConfirmAutoCalibrationDialogBox); return true;
#endif
default:
return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_NOZZLE_OFFSETS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/nozzle_offsets_screen.cpp
|
C++
|
agpl-3.0
| 3,104
|
/***************************
* nozzle_offsets_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 FTDI_NOZZLE_OFFSETS_SCREEN
#define FTDI_NOZZLE_OFFSETS_SCREEN_CLASS NozzleOffsetScreen
class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<NOZZLE_OFFSET_SCREEN_CACHE> {
public:
static void onEntry();
static void onRedraw(draw_mode_t);
static bool onTouchHeld(uint8_t tag);
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/nozzle_offsets_screen.h
|
C++
|
agpl-3.0
| 1,761
|
/********************
* nudge_nozzle.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 FTDI_NUDGE_NOZZLE_SCREEN
using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
constexpr static NudgeNozzleScreenData &mydata = screen_data.NudgeNozzleScreen;
void NudgeNozzleScreen::onEntry() {
mydata.show_offsets = false;
#if HAS_MULTI_EXTRUDER
mydata.link_nozzles = true;
#endif
mydata.rel.reset();
BaseNumericAdjustmentScreen::onEntry();
}
void NudgeNozzleScreen::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_NUDGE_NOZZLE));
#if ENABLED(BABYSTEP_XY)
w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), mydata.rel.x / getAxisSteps_per_mm(X));
w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), mydata.rel.y / getAxisSteps_per_mm(Y));
#endif
w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), mydata.rel.z / getAxisSteps_per_mm(Z));
w.increments();
#if HAS_MULTI_EXTRUDER
w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), mydata.link_nozzles);
#endif
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE
w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), mydata.show_offsets);
if (mydata.show_offsets) {
char str[19];
w.draw_mode(BOTH);
w.color(other);
#if HAS_BED_PROBE
dtostrf(getZOffset_mm(), 4, 2, str);
strcat(str, " ");
strcat_P(str, GET_TEXT(MSG_UNITS_MM));
w.text_field(0, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), str);
#endif
#if HAS_MULTI_HOTEND
format_position(str, getNozzleOffset_mm(X, E1), getNozzleOffset_mm(Y, E1), getNozzleOffset_mm(Z, E1));
w.text_field(0, GET_TEXT_F(MSG_OFFSETS_MENU), str);
#endif
}
#endif
}
bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) {
const float inc = getIncrement();
#if HAS_MULTI_EXTRUDER
const bool link = mydata.link_nozzles;
#else
constexpr bool link = true;
#endif
int16_t steps;
switch (tag) {
case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); mydata.rel.x -= steps; break;
case 3: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps( steps, X, link); mydata.rel.x += steps; break;
case 4: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps(-steps, Y, link); mydata.rel.y -= steps; break;
case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); mydata.rel.y += steps; break;
case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); mydata.rel.z -= steps; break;
case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); mydata.rel.z += steps; break;
#if HAS_MULTI_EXTRUDER
case 8: mydata.link_nozzles = !link; break;
#endif
case 9: mydata.show_offsets = !mydata.show_offsets; break;
default: return false;
}
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE
SaveSettingsDialogBox::settingsChanged();
#endif
return true;
}
bool NudgeNozzleScreen::onTouchEnd(uint8_t tag) {
if (tag == 1) {
SaveSettingsDialogBox::promptToSaveSettings();
return true;
}
else
return BaseNumericAdjustmentScreen::onTouchEnd(tag);
}
void NudgeNozzleScreen::onIdle() {
reset_menu_timeout();
}
#endif // FTDI_NUDGE_NOZZLE_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/nudge_nozzle_screen.cpp
|
C++
|
agpl-3.0
| 4,698
|
/******************
* nudge_nozzle.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_NUDGE_NOZZLE_SCREEN
#define FTDI_NUDGE_NOZZLE_SCREEN_CLASS NudgeNozzleScreen
struct NudgeNozzleScreenData {
struct BaseNumericAdjustmentScreenData placeholder;
xyz_int_t rel;
#if HAS_MULTI_EXTRUDER
bool link_nozzles;
#endif
bool show_offsets;
};
class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ADJUST_OFFSETS_SCREEN_CACHE> {
public:
static void onEntry();
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t tag);
static bool onTouchHeld(uint8_t tag);
static void onIdle();
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/nudge_nozzle_screen.h
|
C++
|
agpl-3.0
| 1,980
|
/***********************************
* restore_failsafe_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_RESTORE_FAILSAFE_DIALOG_BOX
using namespace ExtUI;
void RestoreFailsafeDialogBox::onRedraw(draw_mode_t) {
drawMessage(GET_TEXT_F(MSG_EEPROM_RESET_WARNING));
drawYesNoButtons();
}
bool RestoreFailsafeDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1:
ExtUI::injectCommands(F("M502"));
AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_RESET));
// Remove RestoreFailsafeDialogBox from the stack
// so the alert box doesn't return to it.
current_screen.forget();
SaveSettingsDialogBox::settingsChanged();
return true;
default:
return DialogBoxBaseClass::onTouchEnd(tag);
}
}
#endif // FTDI_RESTORE_FAILSAFE_DIALOG_BOX
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/restore_failsafe_dialog_box.cpp
|
C++
|
agpl-3.0
| 2,186
|
/*********************************
* restore_failsafe_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_RESTORE_FAILSAFE_DIALOG_BOX
#define FTDI_RESTORE_FAILSAFE_DIALOG_BOX_CLASS RestoreFailsafeDialogBox
class RestoreFailsafeDialogBox : 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/generic/restore_failsafe_dialog_box.h
|
C++
|
agpl-3.0
| 1,740
|
/********************************
* save_settings_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_SAVE_SETTINGS_DIALOG_BOX
using namespace ExtUI;
bool SaveSettingsDialogBox::needs_save = false;
void SaveSettingsDialogBox::onRedraw(draw_mode_t) {
drawMessage(GET_TEXT_F(MSG_EEPROM_SAVE_PROMPT));
drawYesNoButtons();
}
bool SaveSettingsDialogBox::onTouchEnd(uint8_t tag) {
needs_save = false;
switch (tag) {
case 1:
injectCommands(F("M500"));
AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_SAVED));
// Remove SaveSettingsDialogBox from the stack
// so the alert box doesn't return to me.
current_screen.forget();
return true;
default:
return DialogBoxBaseClass::onTouchEnd(tag);
}
}
void SaveSettingsDialogBox::promptToSaveSettings() {
if (needs_save) {
// Remove current screen from the stack
// so SaveSettingsDialogBox doesn't return here.
GOTO_SCREEN(SaveSettingsDialogBox);
current_screen.forget();
}
else
GOTO_PREVIOUS(); // No save needed.
}
void SaveSettingsDialogBox::promptToSaveAndStay() {
if (needs_save) GOTO_SCREEN(SaveSettingsDialogBox);
}
#endif // FTDI_SAVE_SETTINGS_DIALOG_BOX
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/save_settings_dialog_box.cpp
|
C++
|
agpl-3.0
| 2,587
|
/******************************
* save_settings_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_SAVE_SETTINGS_DIALOG_BOX
#define FTDI_SAVE_SETTINGS_DIALOG_BOX_CLASS SaveSettingsDialogBox
class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
private:
static bool needs_save;
public:
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t tag);
static void promptToSaveSettings();
static void promptToSaveAndStay();
static void settingsChanged() {needs_save = true;}
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/save_settings_dialog_box.h
|
C++
|
agpl-3.0
| 1,894
|
/*************
* 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,
#if HAS_LEVELING
LEVELING_SCREEN_CACHE,
#if HAS_BED_PROBE
ZOFFSET_SCREEN_CACHE,
#endif
#if HAS_MESH
BED_MESH_VIEW_SCREEN_CACHE,
BED_MESH_EDIT_SCREEN_CACHE,
#endif
#endif
#if ENABLED(BABYSTEPPING)
ADJUST_OFFSETS_SCREEN_CACHE,
#endif
#if HAS_TRINAMIC_CONFIG
STEPPER_CURRENT_SCREEN_CACHE,
STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE,
#endif
#if HAS_MULTI_HOTEND
NOZZLE_OFFSET_SCREEN_CACHE,
#endif
#if ENABLED(BACKLASH_GCODE)
BACKLASH_COMPENSATION_SCREEN_CACHE,
#endif
#if HAS_JUNCTION_DEVIATION
JUNC_DEV_SCREEN_CACHE,
#else
JERK_SCREEN_CACHE,
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
CASE_LIGHT_SCREEN_CACHE,
#endif
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
FILAMENT_MENU_CACHE,
#endif
#if ENABLED(LIN_ADVANCE)
LINEAR_ADVANCE_SCREEN_CACHE,
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
FILAMENT_RUNOUT_SCREEN_CACHE,
#endif
#if HAS_MEDIA
FILES_SCREEN_CACHE,
#endif
#if ENABLED(CUSTOM_MENU_MAIN)
CUSTOM_USER_MENUS_SCREEN_CACHE,
#endif
CHANGE_FILAMENT_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 "base_screen.h"
#include "base_numeric_adjustment_screen.h"
#include "dialog_box_base_class.h"
#include "status_screen.h"
#include "main_menu.h"
#include "advanced_settings_menu.h"
#include "tune_menu.h"
#include "boot_screen.h"
#include "about_screen.h"
#include "kill_screen.h"
#include "alert_dialog_box.h"
#include "spinner_dialog_box.h"
#include "restore_failsafe_dialog_box.h"
#include "save_settings_dialog_box.h"
#include "confirm_start_print_dialog_box.h"
#include "confirm_abort_print_dialog_box.h"
#include "confirm_user_request_alert_box.h"
#include "touch_calibration_screen.h"
#include "touch_registers_screen.h"
#include "change_filament_screen.h"
#include "move_axis_screen.h"
#include "steps_screen.h"
#include "feedrate_percent_screen.h"
#include "max_velocity_screen.h"
#include "max_acceleration_screen.h"
#include "default_acceleration_screen.h"
#include "temperature_screen.h"
#include "interface_sounds_screen.h"
#include "interface_settings_screen.h"
#include "lock_screen.h"
#include "endstop_state_screen.h"
#include "display_tuning_screen.h"
#include "media_player_screen.h"
#if ENABLED(PRINTCOUNTER)
#include "statistics_screen.h"
#endif
#if HAS_TRINAMIC_CONFIG
#include "stepper_current_screen.h"
#include "stepper_bump_sensitivity_screen.h"
#endif
#if HAS_MULTI_HOTEND
#include "nozzle_offsets_screen.h"
#endif
#if HAS_LEVELING
#if ENABLED(TOUCH_UI_SYNDAVER_LEVEL)
#include "syndaver_level/leveling_menu.h"
#else
#include "leveling_menu.h"
#endif
#if HAS_BED_PROBE
#include "z_offset_screen.h"
#endif
#if HAS_MESH
#include "bed_mesh_base.h"
#include "bed_mesh_view_screen.h"
#include "bed_mesh_edit_screen.h"
#endif
#endif
#if ENABLED(CALIBRATION_GCODE)
#include "confirm_auto_calibration_dialog_box.h"
#endif
#if ENABLED(BABYSTEPPING)
#include "nudge_nozzle_screen.h"
#endif
#if ENABLED(BACKLASH_GCODE)
#include "backlash_compensation_screen.h"
#endif
#if HAS_JUNCTION_DEVIATION
#include "junction_deviation_screen.h"
#else
#include "jerk_screen.h"
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
#include "case_light_screen.h"
#endif
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
#include "filament_menu.h"
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#include "filament_runout_screen.h"
#endif
#if ENABLED(LIN_ADVANCE)
#include "linear_advance_screen.h"
#endif
#if HAS_MEDIA
#include "files_screen.h"
#endif
#if ENABLED(CUSTOM_MENU_MAIN)
#include "custom_user_menus.h"
#endif
#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
#include "developer_menu.h"
#include "confirm_erase_flash_dialog_box.h"
#include "widget_demo_screen.h"
#include "stress_test_screen.h"
#endif
#if NUM_LANGUAGES > 1
#include "language_menu.h"
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/screens.h
|
C
|
agpl-3.0
| 6,430
|
/**************************
* spinner_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"
#include "../screen_data.h"
#ifdef FTDI_SPINNER_DIALOG_BOX
#define GRID_COLS 2
#define GRID_ROWS 8
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
constexpr static SpinnerDialogBoxData &mydata = screen_data.SpinnerDialogBox;
void SpinnerDialogBox::onEntry() {
UIScreen::onEntry();
mydata.auto_hide = true;
}
void SpinnerDialogBox::onExit() {
CommandProcessor cmd;
cmd.stop().execute();
}
void SpinnerDialogBox::onRefresh() {
using namespace FTDI;
DLCache dlcache(SPINNER_CACHE);
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART);
if (dlcache.has_data())
dlcache.append();
else
dlcache.store(SPINNER_DL_SIZE);
cmd.spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
}
void SpinnerDialogBox::onRedraw(draw_mode_t) {
}
void SpinnerDialogBox::show(FSTR_P fstr) {
CommandProcessor cmd;
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), fstr, OPT_CENTER, font_large);
DLCache dlcache(SPINNER_CACHE);
if (!dlcache.store(SPINNER_DL_SIZE)) {
SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space");
cmd.cmd(CMD_DLSTART).cmd(CLEAR(true,true,true));
dlcache.store(SPINNER_DL_SIZE);
}
if (AT_SCREEN(SpinnerDialogBox))
cmd.spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
else
GOTO_SCREEN(SpinnerDialogBox);
mydata.auto_hide = false;
}
void SpinnerDialogBox::hide() {
GOTO_PREVIOUS();
}
void SpinnerDialogBox::enqueueAndWait(FSTR_P fstr, FSTR_P commands) {
show(fstr);
ExtUI::injectCommands(commands);
mydata.auto_hide = true;
}
void SpinnerDialogBox::enqueueAndWait(FSTR_P fstr, char *commands) {
show(fstr);
ExtUI::injectCommands(commands);
mydata.auto_hide = true;
}
void SpinnerDialogBox::onIdle() {
if (mydata.auto_hide && !commandsInQueue() && TERN1(HOST_KEEPALIVE_FEATURE, gcode.busy_state == gcode.NOT_BUSY)) {
mydata.auto_hide = false;
hide();
}
}
#endif // FTDI_SPINNER_DIALOG_BOX
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.cpp
|
C++
|
agpl-3.0
| 3,582
|
/************************
* spinner_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_SPINNER_DIALOG_BOX
#define FTDI_SPINNER_DIALOG_BOX_CLASS SpinnerDialogBox
struct SpinnerDialogBoxData {
bool auto_hide;
};
class SpinnerDialogBox : public UIScreen {
public:
static void onEntry();
static void onExit();
static void onRedraw(draw_mode_t);
static void onRefresh();
static void onIdle();
static void show(FSTR_P);
static void hide();
template<typename T>
static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);}
static void enqueueAndWait(FSTR_P message, char *commands);
static void enqueueAndWait(FSTR_P message, FSTR_P commands);
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/spinner_dialog_box.h
|
C++
|
agpl-3.0
| 2,076
|
/*************************
* 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 FTDI_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));
cmd.text(BTN_POS(3,6), BTN_SIZE(2,1), getFilamentUsed_str(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 // FTDI_STATISTICS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/statistics_screen.cpp
|
C++
|
agpl-3.0
| 3,413
|
/***********************
* 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 FTDI_STATISTICS_SCREEN
#define FTDI_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/generic/statistics_screen.h
|
C++
|
agpl-3.0
| 1,666
|
/*********************
* status_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 FTDI_STATUS_SCREEN
#include "../archim2-flash/flash_storage.h"
using namespace FTDI;
using namespace Theme;
#define GRID_COLS 3
#define GRID_ROWS 16
void StatusScreen::draw_axis_position(draw_mode_t what) {
CommandProcessor cmd;
#if ENABLED(TOUCH_UI_PORTRAIT)
#define X_LBL_POS BTN_POS(1, 9), BTN_SIZE(1,2)
#define Y_LBL_POS BTN_POS(1,11), BTN_SIZE(1,2)
#define Z_LBL_POS BTN_POS(1,13), BTN_SIZE(1,2)
#define X_VAL_POS BTN_POS(2, 9), BTN_SIZE(2,2)
#define Y_VAL_POS BTN_POS(2,11), BTN_SIZE(2,2)
#define Z_VAL_POS BTN_POS(2,13), BTN_SIZE(2,2)
#else
#define X_LBL_POS BTN_POS(1, 9), BTN_SIZE(1,2)
#define Y_LBL_POS BTN_POS(2, 9), BTN_SIZE(1,2)
#define Z_LBL_POS BTN_POS(3, 9), BTN_SIZE(1,2)
#define X_VAL_POS BTN_POS(1,11), BTN_SIZE(1,2)
#define Y_VAL_POS BTN_POS(2,11), BTN_SIZE(1,2)
#define Z_VAL_POS BTN_POS(3,11), BTN_SIZE(1,2)
#endif
#define _UNION_POS(x1,y1,w1,h1,x2,y2,w2,h2) x1,y1,max(x1+w1,x2+w2)-x1,max(y1+h1,y2+h2)-y1
#define UNION_POS(p1, p2) _UNION_POS(p1, p2)
if (what & BACKGROUND) {
cmd.tag(6)
.fgcolor(Theme::axis_label)
.font(Theme::font_large)
.button(UNION_POS(X_LBL_POS, X_VAL_POS), F(""), OPT_FLAT)
.button(UNION_POS(Y_LBL_POS, Y_VAL_POS), F(""), OPT_FLAT)
.button(UNION_POS(Z_LBL_POS, Z_VAL_POS), F(""), OPT_FLAT)
.font(Theme::font_medium)
.fgcolor(Theme::x_axis) .button(X_VAL_POS, F(""), OPT_FLAT)
.fgcolor(Theme::y_axis) .button(Y_VAL_POS, F(""), OPT_FLAT)
.fgcolor(Theme::z_axis) .button(Z_VAL_POS, F(""), OPT_FLAT)
.font(Theme::font_small)
.text ( X_LBL_POS, GET_TEXT_F(MSG_AXIS_X))
.text ( Y_LBL_POS, GET_TEXT_F(MSG_AXIS_Y))
.text ( Z_LBL_POS, GET_TEXT_F(MSG_AXIS_Z))
.colors(normal_btn);
}
if (what & FOREGROUND) {
using namespace ExtUI;
char x_str[15];
char y_str[15];
char z_str[15];
if (isAxisPositionKnown(X))
format_position(x_str, getAxisPosition_mm(X));
else
strcpy_P(x_str, PSTR("?"));
if (isAxisPositionKnown(Y))
format_position(y_str, getAxisPosition_mm(Y));
else
strcpy_P(y_str, PSTR("?"));
if (isAxisPositionKnown(Z))
format_position(z_str, getAxisPosition_mm(Z), 2);
else
strcpy_P(z_str, PSTR("?"));
cmd.tag(6)
.font(Theme::font_medium)
.text(X_VAL_POS, x_str)
.text(Y_VAL_POS, y_str)
.text(Z_VAL_POS, z_str);
}
}
#undef GRID_COLS
#define GRID_COLS TERN(TOUCH_UI_PORTRAIT, 8, 12)
void StatusScreen::draw_temperature(draw_mode_t what) {
using namespace Theme;
#define TEMP_RECT_1 BTN_POS(1,1), BTN_SIZE(4,4)
#define TEMP_RECT_2 BTN_POS(1,1), BTN_SIZE(8,2)
#define NOZ_1_POS BTN_POS(1,1), BTN_SIZE(4,2)
#define NOZ_2_POS BTN_POS(5,1), BTN_SIZE(4,2)
#define BED_POS BTN_POS(1,3), BTN_SIZE(4,2)
#define FAN_POS BTN_POS(5,3), BTN_SIZE(4,2)
#define _ICON_POS(x,y,w,h) x, y, w/4, h
#define _TEXT_POS(x,y,w,h) x + w/4, y, w - w/4, h
#define ICON_POS(pos) _ICON_POS(pos)
#define TEXT_POS(pos) _TEXT_POS(pos)
CommandProcessor cmd;
if (what & BACKGROUND) {
cmd.font(Theme::font_small)
.tag(5)
.fgcolor(temp) .button(TEMP_RECT_1, F(""), OPT_FLAT)
.button(TEMP_RECT_2, F(""), OPT_FLAT)
.fgcolor(fan_speed).button(FAN_POS, F(""), OPT_FLAT)
.tag(0);
// Draw Extruder Bitmap on Extruder Temperature Button
cmd.tag(5)
.cmd (BITMAP_SOURCE(Extruder_Icon_Info))
.cmd (BITMAP_LAYOUT(Extruder_Icon_Info))
.cmd (BITMAP_SIZE (Extruder_Icon_Info))
.icon(ICON_POS(NOZ_1_POS), Extruder_Icon_Info, icon_scale)
.icon(ICON_POS(NOZ_2_POS), Extruder_Icon_Info, icon_scale);
// Draw Bed Heat Bitmap on Bed Heat Button
cmd.cmd (BITMAP_SOURCE(Bed_Heat_Icon_Info))
.cmd (BITMAP_LAYOUT(Bed_Heat_Icon_Info))
.cmd (BITMAP_SIZE (Bed_Heat_Icon_Info))
.icon(ICON_POS(BED_POS), Bed_Heat_Icon_Info, icon_scale);
// Draw Fan Percent Bitmap on Bed Heat Button
cmd.cmd (BITMAP_SOURCE(Fan_Icon_Info))
.cmd (BITMAP_LAYOUT(Fan_Icon_Info))
.cmd (BITMAP_SIZE (Fan_Icon_Info))
.icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale);
TERN_(TOUCH_UI_USE_UTF8, load_utf8_bitmaps(cmd)); // Restore font bitmap handles
}
if (what & FOREGROUND) {
using namespace ExtUI;
char e0_str[20], e1_str[20], bed_str[20], fan_str[20];
sprintf_P(fan_str, PSTR("%-3d %%"), int8_t(getActualFan_percent(FAN0)));
if (isHeaterIdle(BED))
format_temp_and_idle(bed_str, getActualTemp_celsius(BED));
else
format_temp_and_temp(bed_str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED));
if (isHeaterIdle(H0))
format_temp_and_idle(e0_str, getActualTemp_celsius(H0));
else
format_temp_and_temp(e0_str, getActualTemp_celsius(H0), getTargetTemp_celsius(H0));
#if HAS_MULTI_EXTRUDER
if (isHeaterIdle(H1))
format_temp_and_idle(e1_str, getActualTemp_celsius(H1));
else
format_temp_and_temp(e1_str, getActualTemp_celsius(H1), getTargetTemp_celsius(H1));
#else
strcpy_P(e1_str, PSTR("-"));
#endif
cmd.tag(5)
.font(font_medium)
.text(TEXT_POS(NOZ_1_POS), e0_str)
.text(TEXT_POS(NOZ_2_POS), e1_str)
.text(TEXT_POS(BED_POS), bed_str)
.text(TEXT_POS(FAN_POS), fan_str);
}
}
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::draw_progress(draw_mode_t what) {
using namespace ExtUI;
using namespace Theme;
CommandProcessor cmd;
#undef GRID_COLS
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 3
#define PROGRESSZONE_POS BTN_POS(1,5), BTN_SIZE(3,2)
#define TIME_POS_X BTN_X(1)
#define TIME_POS_W BTN_W(1)
#define REMAINING_POS_X BTN_X(2)
#define REMAINING_POS_W BTN_W(1)
#define PROGRESS_POS_X BTN_X(3)
#define PROGRESS_POS_W BTN_W(1)
#define PROGRESSZONE_FIRSTLINE_Y BTN_Y(5)
#define PROGRESSBAR_POS BTN_POS(1,6), BTN_SIZE(3,1)
#else
#define GRID_COLS 6
#define PROGRESSZONE_POS BTN_POS(5,1), BTN_SIZE(2,4)
#if ENABLED(SHOW_REMAINING_TIME)
#define TIME_POS BTN_POS(5,1), BTN_SIZE(1,2)
#define REMAINING_POS BTN_POS(6,1), BTN_SIZE(1,2)
#else
#define TIME_POS BTN_POS(5,1), BTN_SIZE(2,2)
#endif
#define PROGRESS_POS BTN_POS(5,3), BTN_SIZE(2,2)
#define PROGRESSBAR_POS BTN_POS(5,2), BTN_SIZE(2,2)
#endif
if (what & BACKGROUND) {
cmd.tag(0).font(font_medium)
.fgcolor(progress).button(PROGRESSZONE_POS, F(""), OPT_FLAT);
}
if (what & FOREGROUND) {
const uint32_t elapsed = getProgress_seconds_elapsed();
char elapsed_str[10];
_format_time(elapsed_str, elapsed);
#if ENABLED(SHOW_REMAINING_TIME)
const uint32_t remaining = getProgress_seconds_remaining();
char remaining_str[10];
_format_time(remaining_str, remaining);
#endif
const uint16_t current_progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, getProgress_permyriad(), getProgress_percent() * 100);
constexpr uint16_t progress_range = 10000U;
const bool show_progress_bar = current_progress > 0 && current_progress < progress_range + 1;
if (show_progress_bar) {
cmd.tag(0).font(font_medium)
.bgcolor(progress)
.progress(PROGRESSBAR_POS, current_progress, progress_range, OPT_FLAT);
}
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
);
#if ENABLED(TOUCH_UI_PORTRAIT)
const uint16_t texts_pos_h = show_progress_bar ? (BTN_H(1)) : (BTN_H(2));
cmd.font(font_medium)
.tag(7).text(TIME_POS_X, PROGRESSZONE_FIRSTLINE_Y, TIME_POS_W, texts_pos_h, elapsed_str)
#if ENABLED(SHOW_REMAINING_TIME)
.text(REMAINING_POS_X, PROGRESSZONE_FIRSTLINE_Y, REMAINING_POS_W, texts_pos_h, remaining_str)
#endif
.text(PROGRESS_POS_X, PROGRESSZONE_FIRSTLINE_Y, PROGRESS_POS_W, texts_pos_h, progress_str);
#else
cmd.font(font_medium)
.tag(7).text(TIME_POS, elapsed_str)
#if ENABLED(SHOW_REMAINING_TIME)
.text(REMAINING_POS, remaining_str)
#endif
.text(PROGRESS_POS, progress_str);
#endif
}
}
void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
#undef GRID_COLS
#define GRID_COLS 4
if (what & FOREGROUND) {
using namespace ExtUI;
#if ENABLED(TOUCH_UI_PORTRAIT)
#define MEDIA_BTN_POS BTN_POS(1,15), BTN_SIZE(2,2)
#define MENU_BTN_POS BTN_POS(3,15), BTN_SIZE(2,2)
#else
#define MEDIA_BTN_POS BTN_POS(1,13), BTN_SIZE(2,4)
#define MENU_BTN_POS BTN_POS(3,13), BTN_SIZE(2,4)
#endif
const bool has_media = isMediaInserted() && !isPrintingFromMedia();
CommandProcessor cmd;
cmd.colors(normal_btn)
.font(Theme::font_medium)
.colors(has_media ? action_btn : normal_btn)
.enabled(has_media && !isPrinting())
.tag(3).button(MEDIA_BTN_POS, isPrinting() ? GET_TEXT_F(MSG_PRINTING) : GET_TEXT_F(MSG_BUTTON_MEDIA))
.colors(!has_media ? action_btn : normal_btn)
.tag(4).button(MENU_BTN_POS, GET_TEXT_F(MSG_BUTTON_MENU));
}
}
void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
#undef GRID_COLS
#define GRID_COLS 1
#if ENABLED(TOUCH_UI_PORTRAIT)
#define STATUS_POS BTN_POS(1,7), BTN_SIZE(1,2)
#else
#define STATUS_POS BTN_POS(1,5), BTN_SIZE(1,4)
#endif
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.fgcolor(Theme::status_msg)
.tag(0)
.button(STATUS_POS, F(""), OPT_FLAT);
draw_text_box(cmd, STATUS_POS, message, OPT_CENTER, font_large);
}
}
void StatusScreen::setStatusMessage(FSTR_P fmsg) {
#ifdef __AVR__
char buff[strlen_P(FTOP(fmsg)) + 1];
strcpy_P(buff, FTOP(fmsg));
setStatusMessage((const char *)buff);
#else
setStatusMessage(FTOP(fmsg));
#endif
}
void StatusScreen::setStatusMessage(const char *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(Theme::bg_color))
.cmd(CLEAR(true,true,true));
draw_temperature(BACKGROUND);
draw_status_message(BACKGROUND, message);
draw_interaction_buttons(BACKGROUND);
draw_progress(BACKGROUND);
draw_axis_position(BACKGROUND);
storeBackground();
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_MSG("New status message: ", message);
#endif
if (AT_SCREEN(StatusScreen)) {
current_screen.onRefresh();
}
}
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 + 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::onStartup() {
UIFlashStorage::initialize();
}
void StatusScreen::onRedraw(draw_mode_t what) {
if (what & FOREGROUND) {
draw_temperature(FOREGROUND);
draw_progress(FOREGROUND);
draw_axis_position(FOREGROUND);
draw_interaction_buttons(FOREGROUND);
}
}
void StatusScreen::onEntry() {
BaseScreen::onEntry();
onRefresh();
}
void StatusScreen::onIdle() {
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
onRefresh();
refresh_timer.start();
}
BaseScreen::onIdle();
}
bool StatusScreen::onTouchEnd(uint8_t tag) {
using namespace ExtUI;
switch (tag) {
#if HAS_MEDIA
case 3: GOTO_SCREEN(FilesScreen); break;
#endif
case 4:
if (isPrinting()) {
GOTO_SCREEN(TuneMenu);
}
else {
GOTO_SCREEN(MainMenu);
}
break;
case 5: GOTO_SCREEN(TemperatureScreen); break;
case 6:
if (isPrinting()) {
#if ENABLED(BABYSTEPPING)
GOTO_SCREEN(NudgeNozzleScreen);
#elif HAS_BED_PROBE
GOTO_SCREEN(ZOffsetScreen);
#else
return false;
#endif
}
else {
GOTO_SCREEN(MoveAxisScreen);
}
break;
case 7: GOTO_SCREEN(FeedratePercentScreen); break;
default:
return true;
}
// If a passcode is enabled, the LockScreen will prevent the
// user from proceeding.
LockScreen::check_passcode();
return true;
}
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 // FTDI_STATUS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.cpp
|
C++
|
agpl-3.0
| 15,143
|
/*******************
* status_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 FTDI_STATUS_SCREEN
#define FTDI_STATUS_SCREEN_CLASS StatusScreen
class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,STATUS_SCREEN_DL_SIZE> {
private:
static void draw_axis_position(draw_mode_t);
static void draw_temperature(draw_mode_t);
static void draw_progress(draw_mode_t);
static void draw_interaction_buttons(draw_mode_t);
static void draw_status_message(draw_mode_t, const char * const);
static void _format_time(char *outstr, uint32_t time);
public:
static void loadBitmaps();
static void setStatusMessage(const char *);
static void setStatusMessage(FSTR_P);
static void onRedraw(draw_mode_t);
static void onStartup();
static void onEntry();
static void onIdle();
static bool onTouchEnd(uint8_t tag);
static void onMediaInserted();
static void onMediaRemoved();
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/status_screen.h
|
C++
|
agpl-3.0
| 2,286
|
/***************************************
* stepper_bump_sensitivity_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 FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
void StepperBumpSensitivityScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(0, BaseNumericAdjustmentScreen::DEFAULT_LOWEST);
w.heading( GET_TEXT_F(MSG_TMC_HOMING_THRS));
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getTMCBumpSensitivity(X), ENABLED(X_SENSORLESS));
w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_AXIS_Y), getTMCBumpSensitivity(Y), ENABLED(Y_SENSORLESS));
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getTMCBumpSensitivity(Z), ENABLED(Z_SENSORLESS));
w.increments();
}
bool StepperBumpSensitivityScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
case 2: UI_DECREMENT(TMCBumpSensitivity, X); break;
case 3: UI_INCREMENT(TMCBumpSensitivity, X); break;
case 4: UI_DECREMENT(TMCBumpSensitivity, Y); break;
case 5: UI_INCREMENT(TMCBumpSensitivity, Y); break;
case 6: UI_DECREMENT(TMCBumpSensitivity, Z); break;
case 7: UI_INCREMENT(TMCBumpSensitivity, Z); break;
default:
return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/stepper_bump_sensitivity_screen.cpp
|
C++
|
agpl-3.0
| 2,783
|
/*************************************
* stepper_bump_sensitivity_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 FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN
#define FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN_CLASS StepperBumpSensitivityScreen
class StepperBumpSensitivityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_BUMP_SENSITIVITY_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/generic/stepper_bump_sensitivity_screen.h
|
C++
|
agpl-3.0
| 1,815
|
/******************************
* stepper_current_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 FTDI_STEPPER_CURRENT_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
void StepperCurrentScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(0);
w.units(GET_TEXT_F(MSG_UNITS_MILLIAMP));
w.heading( GET_TEXT_F(MSG_TMC_CURRENT));
#if AXIS_IS_TMC(X)
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getAxisCurrent_mA(X) );
#endif
#if AXIS_IS_TMC(X2)
w.color(x_axis) .adjuster( 4, GET_TEXT_F(MSG_AXIS_X2), getAxisCurrent_mA(X2) );
#endif
#if AXIS_IS_TMC(Y)
w.color(y_axis) .adjuster( 6, GET_TEXT_F(MSG_AXIS_Y), getAxisCurrent_mA(Y) );
#endif
#if AXIS_IS_TMC(Y2)
w.color(x_axis) .adjuster( 8, GET_TEXT_F(MSG_AXIS_Y2), getAxisCurrent_mA(Y2) );
#endif
#if AXIS_IS_TMC(Z)
w.color(z_axis) .adjuster(10, GET_TEXT_F(MSG_AXIS_Z), getAxisCurrent_mA(Z) );
#endif
#if AXIS_IS_TMC(Z2)
w.color(z_axis) .adjuster(12, GET_TEXT_F(MSG_AXIS_Z2), getAxisCurrent_mA(Z2) );
#endif
#if AXIS_IS_TMC(E0)
w.color(e_axis) .adjuster(14, GET_TEXT_F(
#if EXTRUDERS == 1
MSG_AXIS_E
#else
MSG_AXIS_E1
#endif
), getAxisCurrent_mA(E0) );
#endif
#if AXIS_IS_TMC(E1)
w.color(e_axis).adjuster(16, GET_TEXT_F(MSG_AXIS_E2), getAxisCurrent_mA(E1) );
#endif
#if AXIS_IS_TMC(E2)
w.color(e_axis).adjuster(18, GET_TEXT_F(MSG_AXIS_E3), getAxisCurrent_mA(E2) );
#endif
#if AXIS_IS_TMC(E3)
w.color(e_axis).adjuster(20, GET_TEXT_F(MSG_AXIS_E4), getAxisCurrent_mA(E3) );
#endif
w.increments();
}
bool StepperCurrentScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
#if AXIS_IS_TMC(X)
case 2: UI_DECREMENT(AxisCurrent_mA, X ); break;
case 3: UI_INCREMENT(AxisCurrent_mA, X ); break;
#endif
#if AXIS_IS_TMC(X2)
case 4: UI_DECREMENT(AxisCurrent_mA, X2 ); break;
case 5: UI_INCREMENT(AxisCurrent_mA, X2 ); break;
#endif
#if AXIS_IS_TMC(Y)
case 6: UI_DECREMENT(AxisCurrent_mA, Y ); break;
case 7: UI_INCREMENT(AxisCurrent_mA, Y ); break;
#endif
#if AXIS_IS_TMC(Y2)
case 8: UI_DECREMENT(AxisCurrent_mA, Y2 ); break;
case 9: UI_INCREMENT(AxisCurrent_mA, Y2 ); break;
#endif
#if AXIS_IS_TMC(Z)
case 10: UI_DECREMENT(AxisCurrent_mA, Z ); break;
case 11: UI_INCREMENT(AxisCurrent_mA, Z ); break;
#endif
#if AXIS_IS_TMC(Z2)
case 12: UI_DECREMENT(AxisCurrent_mA, Z2 ); break;
case 13: UI_INCREMENT(AxisCurrent_mA, Z2 ); break;
#endif
#if AXIS_IS_TMC(E0)
case 14: UI_DECREMENT(AxisCurrent_mA, E0); break;
case 15: UI_INCREMENT(AxisCurrent_mA, E0); break;
#endif
#if AXIS_IS_TMC(E1)
case 16: UI_DECREMENT(AxisCurrent_mA, E1); break;
case 17: UI_INCREMENT(AxisCurrent_mA, E1); break;
#endif
#if AXIS_IS_TMC(E2)
case 18: UI_DECREMENT(AxisCurrent_mA, E2); break;
case 19: UI_INCREMENT(AxisCurrent_mA, E2); break;
#endif
#if AXIS_IS_TMC(E3)
case 20: UI_DECREMENT(AxisCurrent_mA, E3); break;
case 21: UI_INCREMENT(AxisCurrent_mA, E3); break;
#endif
default:
return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_STEPPER_CURRENT_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/stepper_current_screen.cpp
|
C++
|
agpl-3.0
| 4,748
|
/****************************
* stepper_current_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 FTDI_STEPPER_CURRENT_SCREEN
#define FTDI_STEPPER_CURRENT_SCREEN_CLASS StepperCurrentScreen
class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_CURRENT_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/generic/stepper_current_screen.h
|
C++
|
agpl-3.0
| 1,745
|
/********************
* steps_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 FTDI_STEPS_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
void StepsScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(0);
w.units(GET_TEXT_F(MSG_UNITS_STEP_MM));
w.heading( GET_TEXT_F(MSG_STEPS_PER_MM));
w.color(x_axis) .adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getAxisSteps_per_mm(X) );
w.color(y_axis) .adjuster( 4, GET_TEXT_F(MSG_AXIS_Y), getAxisSteps_per_mm(Y) );
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisSteps_per_mm(Z) );
#if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_AXIS_E), getAxisSteps_per_mm(E0) );
#elif HAS_MULTI_EXTRUDER
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), getAxisSteps_per_mm(E0) );
w.color(e_axis) .adjuster(10, GET_TEXT_F(MSG_AXIS_E2), getAxisSteps_per_mm(E1) );
#if EXTRUDERS > 2
w.color(e_axis) .adjuster(12, GET_TEXT_F(MSG_AXIS_E3), getAxisSteps_per_mm(E2) );
#endif
#if EXTRUDERS > 3
w.color(e_axis) .adjuster(14, GET_TEXT_F(MSG_AXIS_E4), getAxisSteps_per_mm(E3) );
#endif
#endif
w.increments();
}
bool StepsScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
case 2: UI_DECREMENT(AxisSteps_per_mm, X); break;
case 3: UI_INCREMENT(AxisSteps_per_mm, X); break;
case 4: UI_DECREMENT(AxisSteps_per_mm, Y); break;
case 5: UI_INCREMENT(AxisSteps_per_mm, Y); break;
case 6: UI_DECREMENT(AxisSteps_per_mm, Z); break;
case 7: UI_INCREMENT(AxisSteps_per_mm, Z); break;
case 8: UI_DECREMENT(AxisSteps_per_mm, E0); break;
case 9: UI_INCREMENT(AxisSteps_per_mm, E0); break;
#if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT(AxisSteps_per_mm, E1); break;
case 11: UI_INCREMENT(AxisSteps_per_mm, E1); break;
#endif
#if EXTRUDERS > 2
case 12: UI_DECREMENT(AxisSteps_per_mm, E2); break;
case 13: UI_INCREMENT(AxisSteps_per_mm, E2); break;
#endif
#if EXTRUDERS > 3
case 14: UI_DECREMENT(AxisSteps_per_mm, E3); break;
case 15: UI_INCREMENT(AxisSteps_per_mm, E3); break;
#endif
default:
return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_STEPS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/steps_screen.cpp
|
C++
|
agpl-3.0
| 3,730
|
/******************
* steps_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 FTDI_STEPS_SCREEN
#define FTDI_STEPS_SCREEN_CLASS StepsScreen
class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPS_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/generic/steps_screen.h
|
C++
|
agpl-3.0
| 1,667
|
/**************************
* stress_test_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 FTDI_STRESS_TEST_SCREEN
#define STRESS_TEST_CHANGE_INTERVAL 6000
#define GRID_COLS 4
#define GRID_ROWS 9
using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
constexpr static StressTestScreenData &mydata = screen_data.StressTestScreen;
void StressTestScreen::drawDots(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
CommandProcessor cmd;
for (uint8_t i = 0; i < 100; i++) {
cmd.cmd(BEGIN(POINTS))
.cmd(POINT_SIZE(20*16))
.cmd(COLOR_RGB(random(0xFFFFFF)))
.cmd(VERTEX2F((x + random(w)) * 16,(y + random(h)) * 16));
}
}
bool StressTestScreen::watchDogTestNow() {
return mydata.next_watchdog_trigger &&
ELAPSED(millis(), mydata.next_watchdog_trigger);
}
void StressTestScreen::onRedraw(draw_mode_t) {
using namespace ExtUI;
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.font(font_medium)
.text(BTN_POS(1,1), BTN_SIZE(4,1), FPSTR(mydata.message));
drawDots(BTN_POS(1,3), BTN_SIZE(4,4));
cmd.font(font_medium).enabled(!watchDogTestNow()).colors(action_btn).tag(1).button(BTN_POS(2,8), BTN_SIZE(2,1), F("Exit"));
}
bool StressTestScreen::onTouchEnd(uint8_t tag) {
CommandProcessor cmd;
switch (tag) {
case 1:
runTestOnBootup(false);
GOTO_SCREEN(StatusScreen);
break;
default:
return false;
}
return true;
}
void StressTestScreen::runTestOnBootup(bool enable) {
// Use a magic value in passcode to indicate
// whether or not we need to re-run the test
// at startup.
LockScreen::set_hash(enable ? 0xDEAD : 0);
injectCommands(F("M500"));
}
void StressTestScreen::startupCheck() {
if (LockScreen::get_hash() == 0xDEAD)
GOTO_SCREEN(StressTestScreen);
}
void StressTestScreen::onEntry() {
mydata.next_watchdog_trigger = millis() + 10000 + random(40000);
mydata.message = PSTR("Test 1: Stress testing...");
// Turn off heaters.
coolDown();
runTestOnBootup(true);
}
void StressTestScreen::recursiveLockup() {
mydata.message = PSTR("Test 2: Printer will restart.");
current_screen.onRefresh();
recursiveLockup();
}
void StressTestScreen::iterativeLockup() {
mydata.message = PSTR("Test 3: Printer will restart.");
for (;;) current_screen.onRefresh();
}
void StressTestScreen::onIdle() {
current_screen.onRefresh();
reset_menu_timeout();
if (!commandsInQueue()) {
if (!isPositionKnown()) {
injectCommands_P(G28_STR);
}
else {
injectCommands(F(
"G0 X100 Y100 Z100 F6000\n"
"T0\nG4 S1"
E_TERN_("\nT1\nG4 S1")
"\nG0 X150 Y150 Z150"
));
}
}
if (refresh_timer.elapsed(STRESS_TEST_CHANGE_INTERVAL)) {
setTargetFan_percent(random(100),FAN0);
}
if (watchDogTestNow()) {
if (random(2) % 2)
iterativeLockup();
else
recursiveLockup();
}
BaseScreen::onIdle();
}
#endif // FTDI_STRESS_TEST_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/stress_test_screen.cpp
|
C++
|
agpl-3.0
| 4,435
|
/************************
* stress_test_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 FTDI_STRESS_TEST_SCREEN
#define FTDI_STRESS_TEST_SCREEN_CLASS StressTestScreen
struct StressTestScreenData {
uint32_t next_watchdog_trigger;
const char* message;
};
class StressTestScreen : public BaseScreen, public UncachedScreen {
private:
static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
static bool watchDogTestNow();
static void recursiveLockup();
static void iterativeLockup();
static void runTestOnBootup(bool enable);
public:
static void startupCheck();
static void onEntry();
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/generic/stress_test_screen.h
|
C++
|
agpl-3.0
| 2,086
|
/*********************
* string_format.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 "../config.h"
#if ENABLED(TOUCH_UI_FTDI_EVE)
#include "../screens.h"
#define ROUND(val) uint16_t((val)+0.5)
#pragma GCC diagnostic push
#if GCC_VERSION <= 50000
#pragma GCC diagnostic ignored "-Wno-format"
#endif
/**
* Formats a temperature string (e.g. "100°C")
*/
void format_temp(char *str, const_celsius_float_t t1) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
sprintf_P(str, PSTR("%s" S_FMT), num1, GET_TEXT(MSG_UNITS_C));
#else
sprintf_P(str, PSTR("%3d" S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C));
#endif
}
/**
* Formats a temperature string for an idle heater (e.g. "100 °C / idle")
*/
void format_temp_and_idle(char *str, const_celsius_float_t t1) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
sprintf_P(str, PSTR("%s" S_FMT " / " S_FMT), num1, GET_TEXT(MSG_UNITS_C), GET_TEXT(MSG_IDLE));
#else
sprintf_P(str, PSTR("%3d" S_FMT " / " S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C), GET_TEXT(MSG_IDLE));
#endif
}
/**
* Formats a temperature string for an active heater (e.g. "100 / 200°C")
*/
void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_float_t t2) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7], num2[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
dtostrf(t2, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num2);
sprintf_P(str, PSTR("%s / %s" S_FMT), num1, num2, GET_TEXT(MSG_UNITS_C));
#else
sprintf_P(str, PSTR("%3d / %3d" S_FMT), ROUND(t1), ROUND(t2), GET_TEXT(MSG_UNITS_C));
#endif
}
/**
* Formats a temperature string for a material (e.g. "100°C (PLA)")
*/
void format_temp_and_material(char *str, const_celsius_float_t t1, const char *material) {
#ifdef TOUCH_UI_LCD_TEMP_PRECISION
char num1[7];
dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
sprintf_P(str, PSTR("%s" S_FMT " (" S_FMT ")"), num1, GET_TEXT(MSG_UNITS_C), material);
#else
sprintf_P(str, PSTR("%3d" S_FMT " (" S_FMT ")"), ROUND(t1), GET_TEXT(MSG_UNITS_C), material);
#endif
}
/**
* Formats a position value (e.g. "10 mm")
*/
void format_position(char *str, float p, uint8_t decimals) {
dtostrf(p, 4 + decimals, decimals, str);
strcat_P(str, PSTR(" "));
strcat_P(str, GET_TEXT(MSG_UNITS_MM));
}
/**
* Formats a position vector (e.g. "10; 20; 30 mm")
*/
void format_position(char *str, float x, float y, float z) {
char num1[7], num2[7], num3[7];
dtostrf(x, 4, 2, num1);
dtostrf(y, 4, 2, num2);
dtostrf(z, 4, 2, num3);
sprintf_P(str, PSTR("%s; %s; %s " S_FMT), num1, num2, num3, GET_TEXT(MSG_UNITS_MM));
}
#pragma GCC diagnostic pop
#endif // TOUCH_UI_FTDI_EVE
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
|
C++
|
agpl-3.0
| 4,194
|
/*******************
* string_format.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
void format_temp(char *str, const_celsius_float_t t1);
void format_temp_and_idle(char *str, const_celsius_float_t t1);
void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_float_t t2);
void format_temp_and_material(char *str, const_celsius_float_t t1, const char *material);
void format_position(char *str, float p, uint8_t decimals = 1);
void format_position(char *str, float x, float y, float z);
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.h
|
C
|
agpl-3.0
| 1,752
|
/**************************
* temperature_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 FTDI_TEMPERATURE_SCREEN
using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
void TemperatureScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
#if TOUCH_UI_LCD_TEMP_SCALING == 10
w.precision(1, DEFAULT_MIDRANGE)
#else
w.precision(0, getTargetTemp_celsius(E0) == 0 ? DEFAULT_HIGHEST : DEFAULT_MIDRANGE)
#endif
.color(temp).units(GET_TEXT_F(MSG_UNITS_C));
w.heading(GET_TEXT_F(MSG_TEMPERATURE));
w.button(30, GET_TEXT_F(MSG_COOLDOWN));
#ifndef NO_TOOLHEAD_HEATER_GCODE
#if ENABLED(TOUCH_UI_COCOA_PRESS)
w.adjuster( 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0));
w.adjuster( 4, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1));
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater())
w.adjuster(6, GET_TEXT_F(MSG_EXTERNAL), getTargetTemp_celsius(E2));
#endif
#elif HOTENDS == 1
w.adjuster( 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0));
#else
w.adjuster( 2, F(STR_E0), getTargetTemp_celsius(E0));
w.adjuster( 4, F(STR_E1), getTargetTemp_celsius(E1));
#if HOTENDS > 2
w.adjuster( 6, F(STR_E2), getTargetTemp_celsius(E2));
#endif
#if HOTENDS > 3
w.adjuster( 8, F(STR_E3), getTargetTemp_celsius(E3));
#endif
#endif
#endif
#if HAS_HEATED_BED
w.adjuster( 20, GET_TEXT_F(MSG_BED), getTargetTemp_celsius(BED));
#endif
#if HAS_HEATED_CHAMBER
w.adjuster( 22, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER));
#endif
#if HAS_FAN0
w.color(fan_speed).units(GET_TEXT_F(MSG_UNITS_PERCENT));
w.adjuster( 10, GET_TEXT_F(MSG_FAN_SPEED), getTargetFan_percent(FAN0));
#endif
w.increments();
}
bool TemperatureScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
switch (tag) {
case 20: UI_DECREMENT(TargetTemp_celsius, BED); break;
case 21: UI_INCREMENT(TargetTemp_celsius, BED); break;
case 22: UI_DECREMENT(TargetTemp_celsius, CHAMBER); break;
case 23: UI_INCREMENT(TargetTemp_celsius, CHAMBER); break;
#ifndef NO_TOOLHEAD_HEATER_GCODE
case 2: UI_DECREMENT(TargetTemp_celsius, E0); break;
case 3: UI_INCREMENT(TargetTemp_celsius, E0); break;
#endif
#if HAS_MULTI_HOTEND
case 4: UI_DECREMENT(TargetTemp_celsius, E1); break;
case 5: UI_INCREMENT(TargetTemp_celsius, E1); break;
#endif
#if HOTENDS > 2
case 6: UI_DECREMENT(TargetTemp_celsius, E2); break;
case 7: UI_INCREMENT(TargetTemp_celsius, E2); break;
#endif
#if HOTENDS > 3
case 8: UI_DECREMENT(TargetTemp_celsius, E3); break;
case 9: UI_INCREMENT(TargetTemp_celsius, E3); break;
#endif
#if HAS_FAN
case 10: UI_DECREMENT(TargetFan_percent, FAN0); break;
case 11: UI_INCREMENT(TargetFan_percent, FAN0); break;
#endif
case 30:
coolDown();
TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0, CHAMBER));
break;
default:
return false;
}
return true;
}
#endif // FTDI_TEMPERATURE_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/temperature_screen.cpp
|
C++
|
agpl-3.0
| 4,522
|
/************************
* temperature_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 FTDI_TEMPERATURE_SCREEN
#define FTDI_TEMPERATURE_SCREEN_CLASS TemperatureScreen
class TemperatureScreen : public BaseNumericAdjustmentScreen, public CachedScreen<TEMPERATURE_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/generic/temperature_screen.h
|
C++
|
agpl-3.0
| 1,715
|
/********************************
* touch_calibration_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 FTDI_TOUCH_CALIBRATION_SCREEN
using namespace FTDI;
using namespace Theme;
#define GRID_COLS 4
#define GRID_ROWS 16
#define TEXT_POS BTN_POS(1,1), BTN_SIZE(4,12)
void TouchCalibrationScreen::onEntry() {
CommandProcessor cmd;
BaseScreen::onEntry();
if (CLCD::is_touching()) {
// Ask the user to release the touch before starting,
// as otherwise the first calibration point could
// be misinterpreted.
cmd.cmd(CMD_DLSTART)
.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled));
draw_text_box(cmd, TEXT_POS, GET_TEXT_F(MSG_TOUCH_CALIBRATION_START), OPT_CENTER, font_large);
cmd.cmd(DL::DL_DISPLAY)
.cmd(CMD_SWAP)
.execute();
while (CLCD::is_touching()) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_MSG("Waiting for touch release");
#endif
}
}
// Force a refresh
cmd.cmd(CMD_DLSTART);
onRedraw(FOREGROUND);
cmd.cmd(DL::DL_DISPLAY);
cmd.execute();
}
void TouchCalibrationScreen::onRefresh() {
// Don't do the regular refresh, as this would
// cause the calibration be restarted on every
// touch.
}
void TouchCalibrationScreen::onRedraw(draw_mode_t) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled));
draw_text_box(cmd, TEXT_POS, GET_TEXT_F(MSG_TOUCH_CALIBRATION_PROMPT), OPT_CENTER, font_large);
cmd.cmd(CMD_CALIBRATE);
}
void TouchCalibrationScreen::onIdle() {
if (!CLCD::is_touching() && !CommandProcessor::is_processing()) {
GOTO_PREVIOUS();
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_MSG("Calibration routine finished");
#endif
}
}
#endif // FTDI_TOUCH_CALIBRATION_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/touch_calibration_screen.cpp
|
C++
|
agpl-3.0
| 3,227
|
/******************************
* touch_calibration_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 FTDI_TOUCH_CALIBRATION_SCREEN
#define FTDI_TOUCH_CALIBRATION_SCREEN_CLASS TouchCalibrationScreen
class TouchCalibrationScreen : public BaseScreen, public UncachedScreen {
public:
static void onRefresh();
static void onEntry();
static void onRedraw(draw_mode_t);
static void onIdle();
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/touch_calibration_screen.h
|
C++
|
agpl-3.0
| 1,754
|
/******************************
* touch_registers_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 FTDI_TOUCH_REGISTERS_SCREEN
using namespace FTDI;
using namespace Theme;
#define GRID_COLS 2
#define GRID_ROWS 7
void TouchRegistersScreen::onRedraw(draw_mode_t) {
const uint32_t T_Transform_A = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_A);
const uint32_t T_Transform_B = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_B);
const uint32_t T_Transform_C = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_C);
const uint32_t T_Transform_D = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_D);
const uint32_t T_Transform_E = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_E);
const uint32_t T_Transform_F = CLCD::mem_read_32(CLCD::REG::TOUCH_TRANSFORM_F);
char b[20];
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.tag(0);
cmd.tag(0)
.font(font_xsmall)
.fgcolor(transformA) .button(BTN_POS(1,1), BTN_SIZE(1,1), F("TOUCH_XFORM_A"))
.fgcolor(transformB) .button(BTN_POS(1,2), BTN_SIZE(1,1), F("TOUCH_XFORM_B"))
.fgcolor(transformC) .button(BTN_POS(1,3), BTN_SIZE(1,1), F("TOUCH_XFORM_C"))
.fgcolor(transformD) .button(BTN_POS(1,4), BTN_SIZE(1,1), F("TOUCH_XFORM_D"))
.fgcolor(transformE) .button(BTN_POS(1,5), BTN_SIZE(1,1), F("TOUCH_XFORM_E"))
.fgcolor(transformF) .button(BTN_POS(1,6), BTN_SIZE(1,1), F("TOUCH_XFORM_F"))
.fgcolor(transformVal).button(BTN_POS(2,1), BTN_SIZE(1,1), F(""), OPT_FLAT)
.fgcolor(transformVal).button(BTN_POS(2,2), BTN_SIZE(1,1), F(""), OPT_FLAT)
.fgcolor(transformVal).button(BTN_POS(2,3), BTN_SIZE(1,1), F(""), OPT_FLAT)
.fgcolor(transformVal).button(BTN_POS(2,4), BTN_SIZE(1,1), F(""), OPT_FLAT)
.fgcolor(transformVal).button(BTN_POS(2,5), BTN_SIZE(1,1), F(""), OPT_FLAT)
.fgcolor(transformVal).button(BTN_POS(2,6), BTN_SIZE(1,1), F(""), OPT_FLAT);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_A); cmd.text( BTN_POS(2,1), BTN_SIZE(1,1), b);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_B); cmd.text( BTN_POS(2,2), BTN_SIZE(1,1), b);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_C); cmd.text( BTN_POS(2,3), BTN_SIZE(1,1), b);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_D); cmd.text( BTN_POS(2,4), BTN_SIZE(1,1), b);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_E); cmd.text( BTN_POS(2,5), BTN_SIZE(1,1), b);
sprintf_P(b, PSTR("0x%08lX"), T_Transform_F); cmd.text( BTN_POS(2,6), BTN_SIZE(1,1), b);
cmd.colors(action_btn).font(font_medium)
.tag(1).button(BTN_POS(2,7), BTN_SIZE(1,1), F("Back"));
}
bool TouchRegistersScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
default:
return false;
}
return true;
}
#endif // FTDI_TOUCH_REGISTERS_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/touch_registers_screen.cpp
|
C++
|
agpl-3.0
| 4,212
|
/****************************
* touch_registers_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 FTDI_TOUCH_REGISTERS_SCREEN
#define FTDI_TOUCH_REGISTERS_SCREEN_CLASS TouchRegistersScreen
class TouchRegistersScreen : 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/generic/touch_registers_screen.h
|
C++
|
agpl-3.0
| 1,699
|
/*******************
* 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_TUNE_MENU
#include "../../../../feature/host_actions.h"
using namespace FTDI;
using namespace Theme;
#define GRID_COLS 2
#define GRID_ROWS TERN(TOUCH_UI_PORTRAIT, 9, 5)
void TuneMenu::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true));
}
#if ENABLED(TOUCH_UI_PORTRAIT)
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define FILAMENT_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define NUDGE_NOZ_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define SPEED_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define PAUSE_POS BTN_POS(1,6), BTN_SIZE(2,1)
#define STOP_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define ADVANCED_SETTINGS_POS BTN_POS(1,9), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(2,9), BTN_SIZE(1,1)
#else
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define NUDGE_NOZ_POS BTN_POS(2,1), BTN_SIZE(1,1)
#define FIL_CHANGE_POS BTN_POS(1,2), BTN_SIZE(1,1)
#define SPEED_POS BTN_POS(2,2), BTN_SIZE(1,1)
#define PAUSE_POS BTN_POS(1,3), BTN_SIZE(1,1)
#define STOP_POS BTN_POS(2,3), BTN_SIZE(1,1)
#define FILAMENT_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define CASE_LIGHT_POS BTN_POS(2,4), BTN_SIZE(1,1)
#define ADVANCED_SETTINGS_POS BTN_POS(1,5), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(2,5), BTN_SIZE(1,1)
#endif
if (what & FOREGROUND) {
const bool sdOrHostPrinting = ExtUI::isPrinting();
const bool sdOrHostPaused = ExtUI::isPrintingPaused();
CommandProcessor cmd;
cmd.colors(normal_btn)
.font(font_medium)
.tag(2).button(TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
.enabled(!sdOrHostPrinting || sdOrHostPaused)
.tag(3).button(FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE))
.enabled(ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
.tag(9).button(FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
#if ENABLED(BABYSTEPPING) && HAS_MULTI_HOTEND
.tag(4).button(NUDGE_NOZ_POS, GET_TEXT_F(MSG_NUDGE_NOZZLE))
#elif ALL(HAS_LEVELING, HAS_BED_PROBE)
.tag(4).button(NUDGE_NOZ_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
#endif
.tag(5).button(SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED))
.enabled(sdOrHostPrinting)
.tag(sdOrHostPaused ? 7 : 6)
.button(PAUSE_POS, sdOrHostPaused ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
.enabled(sdOrHostPrinting)
.tag(8).button(STOP_POS, GET_TEXT_F(MSG_STOP_PRINT))
.enabled(ENABLED(CASE_LIGHT_ENABLE))
.tag(10).button(CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
.tag(11).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS))
.tag(1).colors(action_btn)
.button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));
}
}
bool TuneMenu::onTouchEnd(uint8_t tag) {
using namespace Theme;
using namespace ExtUI;
switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: GOTO_SCREEN(TemperatureScreen); break;
case 3: GOTO_SCREEN(ChangeFilamentScreen); break;
case 4:
#if ENABLED(BABYSTEPPING) && HAS_MULTI_HOTEND
GOTO_SCREEN(NudgeNozzleScreen);
#elif ALL(HAS_LEVELING, HAS_BED_PROBE)
GOTO_SCREEN(ZOffsetScreen);
#endif
break;
case 5: GOTO_SCREEN(FeedratePercentScreen); break;
case 6: pausePrint(); break;
case 7: resumePrint(); break;
case 8:
GOTO_SCREEN(ConfirmAbortPrintDialogBox);
current_screen.forget();
PUSH_SCREEN(StatusScreen);
break;
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
case 9: GOTO_SCREEN(FilamentMenu); break;
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
case 10: GOTO_SCREEN(CaseLightScreen); break;
#endif
case 11: GOTO_SCREEN(AdvancedSettingsMenu); break;
default:
return false;
}
return true;
}
void TuneMenu::pausePrint() {
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::isPrintingFromMedia())
ExtUI::pausePrint();
#ifdef ACTION_ON_PAUSE
else hostui.pause();
#endif
GOTO_SCREEN(StatusScreen);
}
void TuneMenu::resumePrint() {
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::awaitingUserConfirm())
ExtUI::setUserConfirmed();
else if (ExtUI::isPrintingFromMedia())
ExtUI::resumePrint();
#ifdef ACTION_ON_RESUME
else hostui.resume();
#endif
GOTO_SCREEN(StatusScreen);
}
#endif // FTDI_TUNE_MENU
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp
|
C++
|
agpl-3.0
| 6,018
|
/***************
* 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_TUNE_MENU
#define FTDI_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/generic/tune_menu.h
|
C++
|
agpl-3.0
| 1,699
|
/**************************
* widget_demo_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 FTDI_WIDGET_DEMO_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
uint16_t slider_val;
bool show_grid;
void WidgetsScreen::onEntry() {
BaseScreen::onEntry();
CLCD::turn_on_backlight();
SoundPlayer::set_volume(255);
}
void WidgetsScreen::onRedraw(draw_mode_t) {
using namespace ExtUI;
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
const uint16_t hrs = (slider_val*12/0xFFFFU);
const uint16_t m = (slider_val*12*60/0xFFFFU)%60;
const uint16_t s = (slider_val*12*60*60/0xFFFFU)%60;
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 3
#define GRID_ROWS 8
cmd.font(font_large)
.cmd(COLOR_RGB(bg_text_enabled))
.text (BTN_POS(1,1), BTN_SIZE(3,1), F("Sample Widgets"))
.tag(0).text (BTN_POS(2,6), BTN_SIZE(1,1), F("Show grid:"))
.colors(ui_toggle)
.tag(2).dial (BTN_POS(1,2), BTN_SIZE(1,2), slider_val)
.tag(0).clock (BTN_POS(1,4), BTN_SIZE(1,2), hrs, m, s, 0)
.gauge (BTN_POS(1,6), BTN_SIZE(1,2), 5, 4, slider_val, 0xFFFFU)
.font(font_medium)
.colors(ui_slider)
.tag(4).slider (BTN_POS(2,3), BTN_SIZE(2,1), slider_val, 0xFFFFU)
.tag(5).progress (BTN_POS(2,4), BTN_SIZE(2,1), slider_val, 0xFFFFU)
.tag(6).scrollbar (BTN_POS(2,5), BTN_SIZE(2,1), slider_val, 1000, 0xFFFFU)
.font(font_small)
.colors(ui_toggle)
.tag(7).toggle (BTN_POS(3,6), BTN_SIZE(1,1), F("no\xFFyes"), show_grid)
.colors(normal_btn)
.font(font_medium)
.tag(1)
.button (BTN_POS(2, 8), BTN_SIZE(1,1), F("1"))
.button (BTN_POS(3, 8), BTN_SIZE(1,1), F("2"))
.colors(action_btn)
.button (BTN_POS(1, 8), BTN_SIZE(1,1), F("Back"));
#else
#define GRID_COLS 4
#define GRID_ROWS 8
cmd.font(font_large)
.text (BTN_POS(1,1), BTN_SIZE(4,1), F("Sample Widgets"))
.tag(0).text (BTN_POS(3,6), BTN_SIZE(1,1), F("Show grid:"))
.colors(ui_toggle)
.tag(2).dial (BTN_POS(1,2), BTN_SIZE(1,3), slider_val)
.tag(3).dial (BTN_POS(1,5), BTN_SIZE(1,3), slider_val)
.tag(0).clock (BTN_POS(2,2), BTN_SIZE(1,3), hrs, m, s, 0)
.gauge (BTN_POS(2,5), BTN_SIZE(1,3), 5, 4, slider_val, 0xFFFFU)
.font(font_medium)
.colors(ui_slider)
.tag(4).slider (BTN_POS(3,3), BTN_SIZE(2,1), slider_val, 0xFFFFU)
.tag(5).progress (BTN_POS(3,4), BTN_SIZE(2,1), slider_val, 0xFFFFU)
.tag(6).scrollbar (BTN_POS(3,5), BTN_SIZE(2,1), slider_val, 1000, 0xFFFFU)
.font(font_small)
.colors(ui_toggle)
.tag(7).toggle (BTN_POS(4,6), BTN_SIZE(1,1), F("no\xFFyes"), show_grid)
.colors(normal_btn)
.font(font_medium)
.tag(1).button (BTN_POS(3, 8), BTN_SIZE(1,1), F("1"))
.button (BTN_POS(4, 8), BTN_SIZE(1,1), F("2"))
.colors(action_btn)
.button (BTN_POS(1, 8), BTN_SIZE(2,1), F("Back"));
#endif
cmd.cmd(COLOR_RGB(bg_text_enabled));
if (show_grid) DRAW_LAYOUT_GRID
}
bool WidgetsScreen::onTouchStart(uint8_t tag) {
CommandProcessor cmd;
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
#if ENABLED(TOUCH_UI_PORTRAIT)
case 2: cmd.track_circular (BTN_POS(1,2), BTN_SIZE(1,2), 2).execute(); break;
case 4: cmd.track_linear (BTN_POS(2,3), BTN_SIZE(2,1), 4).execute(); break;
case 5: cmd.track_linear (BTN_POS(2,4), BTN_SIZE(2,1), 5).execute(); break;
case 6: cmd.track_linear (BTN_POS(2,5), BTN_SIZE(2,1), 6).execute(); break;
#else
case 2: cmd.track_circular (BTN_POS(1,2), BTN_SIZE(1,3), 2).execute(); break;
case 3: cmd.track_circular (BTN_POS(1,5), BTN_SIZE(1,3), 3).execute(); break;
case 4: cmd.track_linear (BTN_POS(3,3), BTN_SIZE(2,1), 4).execute(); break;
case 5: cmd.track_linear (BTN_POS(3,4), BTN_SIZE(2,1), 5).execute(); break;
case 6: cmd.track_linear (BTN_POS(3,5), BTN_SIZE(2,1), 6).execute(); break;
#endif
case 7: show_grid = !show_grid; break;
default:
return false;
}
return true;
}
void WidgetsScreen::onIdle() {
if (refresh_timer.elapsed(TOUCH_UPDATE_INTERVAL)) {
refresh_timer.start();
uint16_t value;
CommandProcessor cmd;
switch (cmd.track_tag(value)) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
slider_val = value; break;
default:
return;
}
onRefresh();
}
BaseScreen::onIdle();
}
#endif // FTDI_WIDGET_DEMO_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/widget_demo_screen.cpp
|
C++
|
agpl-3.0
| 6,214
|
/************************
* widget_demo_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 FTDI_WIDGET_DEMO_SCREEN
#define FTDI_WIDGET_DEMO_SCREEN_CLASS WidgetsScreen
class WidgetsScreen : public BaseScreen, public UncachedScreen {
public:
static void onEntry();
static void onRedraw(draw_mode_t);
static bool onTouchStart(uint8_t tag);
static void onIdle();
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/widget_demo_screen.h
|
C++
|
agpl-3.0
| 1,720
|
/***********************
* 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 FTDI_Z_OFFSET_SCREEN
using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
#define SHEET_THICKNESS 0.1
constexpr static ZOffsetScreenData &mydata = screen_data.ZOffsetScreen;
void ZOffsetScreen::onEntry() {
mydata.z = SHEET_THICKNESS;
mydata.softEndstopState = getSoftEndstopState();
BaseNumericAdjustmentScreen::onEntry();
if (wizardRunning())
setSoftEndstopState(false);
}
void ZOffsetScreen::onExit() {
setSoftEndstopState(mydata.softEndstopState);
}
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() && !wizardRunning());
}
void ZOffsetScreen::move(float mm, int16_t steps) {
if (wizardRunning()) {
mydata.z += mm;
setAxisPosition_mm(mydata.z, Z);
}
else {
// Otherwise doing a manual adjustment, possibly during a print.
TERN(BABYSTEPPING, babystepAxis_steps(steps, Z), UNUSED(steps));
}
}
void ZOffsetScreen::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("After the printer finishes homing, adjust the Z Offset so that a sheet of paper can pass between the nozzle and bed with slight resistance."));
}
bool ZOffsetScreen::wizardRunning() {
// We can't store state after the call to the AlertBox, so
// check whether the current Z position equals mydata.z in order
// to know whether the user started the wizard.
return getAxisPosition_mm(Z) == mydata.z;
}
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: runWizard(); break;
case 4: UI_DECREMENT(ZOffset_mm); move(-increment, -steps); break;
case 5: UI_INCREMENT(ZOffset_mm); move( increment, steps); break;
default:
return false;
}
SaveSettingsDialogBox::settingsChanged();
return true;
}
#endif // FTDI_Z_OFFSET_SCREEN
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp
|
C++
|
agpl-3.0
| 4,268
|
/***********************
* 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 FTDI_Z_OFFSET_SCREEN
#define FTDI_Z_OFFSET_SCREEN_CLASS ZOffsetScreen
struct ZOffsetScreenData : public BaseNumericAdjustmentScreenData {
float z;
bool softEndstopState;
};
class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
private:
static void move(float mm, int16_t steps);
static void runWizard();
static bool wizardRunning();
public:
static void onEntry();
static void onExit();
static void onRedraw(draw_mode_t);
static bool onTouchHeld(uint8_t tag);
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h
|
C++
|
agpl-3.0
| 1,973
|
/****************
* language.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 "../../../../MarlinCore.h"
#if ENABLED(TOUCH_UI_FTDI_EVE)
#include "language.h"
uint8_t ftdi_language = 0;
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.cpp
|
C++
|
agpl-3.0
| 1,433
|
/**************
* language.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
#define LSTR PROGMEM Language_Str
#include "language_en.h"
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language.h
|
C
|
agpl-3.0
| 1,373
|
/*****************
* language_en.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
#include "language.h"
#if ENABLED(TOUCH_UI_UTF8_COPYRIGHT)
#define COPYRIGHT_SIGN u8"©"
#else
#define COPYRIGHT_SIGN u8"(c)"
#endif
#if ENABLED(TOUCH_UI_UTF8_WESTERN_CHARSET)
#define DEGREE_SIGN u8"°"
#else
#define DEGREE_SIGN u8" "
#endif
namespace Language_en {
LSTR MSG_BUTTON_OKAY = u8"Okay";
LSTR MSG_BUTTON_MENU = u8"Menu";
LSTR MSG_BUTTON_MEDIA = u8"Media";
LSTR MSG_BUTTON_OPEN = u8"Open";
LSTR MSG_CLEAN_NOZZLE = u8"Clean Nozzle";
LSTR MSG_VMAX_X = u8"Max X Speed";
LSTR MSG_VMAX_Y = u8"Max Y Speed";
LSTR MSG_VMAX_Z = u8"Max Z Speed";
LSTR MSG_ACCEL_PRINTING = u8"Printing";
LSTR MSG_ACCEL_TRAVEL = u8"Travel";
LSTR MSG_ACCEL_RETRACT = u8"Retraction";
LSTR MSG_AMAX_X = u8"Max X Accel.";
LSTR MSG_AMAX_Y = u8"Max Y Accel.";
LSTR MSG_AMAX_Z = u8"Max Z Accel.";
LSTR MSG_AXIS_X = u8"X";
LSTR MSG_AXIS_X2 = u8"X2";
LSTR MSG_AXIS_Y = u8"Y";
LSTR MSG_AXIS_Y2 = u8"Y2";
LSTR MSG_AXIS_Z = u8"Z";
LSTR MSG_AXIS_Z2 = u8"Z2";
LSTR MSG_AXIS_E = u8"E";
LSTR MSG_AXIS_E1 = u8"E1";
LSTR MSG_AXIS_E2 = u8"E2";
LSTR MSG_AXIS_E3 = u8"E3";
LSTR MSG_AXIS_E4 = u8"E4";
LSTR MSG_AXIS_ALL = u8"All";
LSTR MSG_HOME = u8"Home";
LSTR MSG_PRINT_STARTING = u8"Print starting";
LSTR MSG_PRINT_FINISHED = u8"Print finished";
LSTR MSG_PRINT_ERROR = u8"Print error";
LSTR MSG_ABOUT_TOUCH_PANEL_1 = u8"Color Touch Panel";
LSTR MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL;
LSTR MSG_LICENSE = u8"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. To view a copy of the GNU General "
"Public License, go to the following location: https://www.gnu.org/licenses.";
LSTR MSG_RUNOUT_1 = u8"Runout 1";
LSTR MSG_RUNOUT_2 = u8"Runout 2";
LSTR MSG_DISPLAY_MENU = u8"Display";
LSTR MSG_INTERFACE = u8"Interface";
LSTR MSG_MEASURE_AUTOMATICALLY = u8"Measure automatically";
LSTR MSG_H_OFFSET = u8"H Offset";
LSTR MSG_V_OFFSET = u8"V Offset";
LSTR MSG_TOUCH_SCREEN = u8"Touch Screen";
LSTR MSG_CALIBRATE = u8"Calibrate";
LSTR MSG_UNITS_MILLIAMP = u8"mA";
LSTR MSG_UNITS_MM = u8"mm";
LSTR MSG_UNITS_MM_S = u8"mm/s";
LSTR MSG_UNITS_MM_S2 = u8"mm/s" SUPERSCRIPT_TWO;
LSTR MSG_UNITS_STEP_MM = u8"st/mm";
LSTR MSG_UNITS_PERCENT = u8"%";
LSTR MSG_UNITS_C = DEGREE_SIGN u8"C";
LSTR MSG_IDLE = u8"idle";
LSTR MSG_SET_MAXIMUM = u8"Set Maximum";
LSTR MSG_PRINT_SPEED = u8"Print Speed";
LSTR MSG_LINEAR_ADVANCE_K = u8"K";
LSTR MSG_LINEAR_ADVANCE_K1 = u8"K E1";
LSTR MSG_LINEAR_ADVANCE_K2 = u8"K E2";
LSTR MSG_LINEAR_ADVANCE_K3 = u8"K E3";
LSTR MSG_LINEAR_ADVANCE_K4 = u8"K E4";
LSTR MSG_NUDGE_NOZZLE = u8"Nudge Nozzle";
LSTR MSG_ADJUST_BOTH_NOZZLES = u8"Adjust Both Nozzles";
LSTR MSG_SHOW_OFFSETS = u8"Show Offsets";
LSTR MSG_INCREMENT = u8"Increment";
LSTR MSG_ERASE_FLASH_WARNING = u8"Are you sure? SPI flash will be erased.";
LSTR MSG_ERASING = u8"Erasing...";
LSTR MSG_ERASED = u8"SPI flash erased";
LSTR MSG_CALIBRATION_WARNING = u8"For best results, unload the filament and clean the hotend prior to starting calibration. Continue?";
LSTR MSG_START_PRINT_CONFIRMATION = u8"Start printing %s?";
LSTR MSG_ABORT_WARNING = u8"Are you sure you want to cancel the print?";
LSTR MSG_EXTRUDER_SELECTION = u8"Extruder Selection";
LSTR MSG_CURRENT_TEMPERATURE = u8"Current Temp";
LSTR MSG_REMOVAL_TEMPERATURE = u8"Removal Temp";
LSTR MSG_CAUTION = u8"Caution:";
LSTR MSG_HOT = u8"Hot!";
LSTR MSG_UNLOAD_FILAMENT = u8"Unload/Retract";
LSTR MSG_LOAD_FILAMENT = u8"Load/Extrude";
LSTR MSG_MOMENTARY = u8"Momentary";
LSTR MSG_CONTINUOUS = u8"Continuous";
LSTR MSG_PRINT_MENU = u8"Print Menu";
LSTR MSG_FINE_MOTION = u8"Fine motion";
LSTR MSG_ENABLE_MEDIA = u8"Enable Media";
LSTR MSG_INSERT_MEDIA = u8"Insert Media...";
LSTR MSG_LCD_BRIGHTNESS = u8"LCD brightness";
LSTR MSG_SOUND_VOLUME = u8"Sound volume";
LSTR MSG_SCREEN_LOCK = u8"Screen lock";
LSTR MSG_BOOT_SCREEN = u8"Boot screen";
LSTR MSG_SOUNDS = u8"Sounds";
LSTR MSG_CLICK_SOUNDS = u8"Click sounds";
LSTR MSG_EEPROM_RESTORED = u8"Settings restored from backup";
LSTR MSG_EEPROM_RESET = u8"Settings restored to default";
LSTR MSG_EEPROM_SAVED = u8"Settings saved!";
LSTR MSG_EEPROM_SAVE_PROMPT = u8"Settings applied. Save these settings for next power-on?";
LSTR MSG_EEPROM_RESET_WARNING = u8"Are you sure? Customizations will be lost.";
LSTR MSG_PASSCODE_REJECTED = u8"Wrong passcode!";
LSTR MSG_PASSCODE_ACCEPTED = u8"Passcode accepted!";
LSTR MSG_PASSCODE_SELECT = u8"Select Passcode:";
LSTR MSG_PASSCODE_REQUEST = u8"Enter Passcode:";
LSTR MSG_TOUCH_CALIBRATION_START = u8"Release to begin screen calibration";
LSTR MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate";
LSTR MSG_BED_MAPPING_DONE = u8"Bed mapping finished";
LSTR MSG_BED_MAPPING_INCOMPLETE = u8"Not all points probed";
LSTR MSG_LEVELING = u8"Leveling";
LSTR MSG_AXIS_LEVELING = u8"Axis Leveling";
LSTR MSG_PROBE_BED = u8"Probe Mesh";
LSTR MSG_PRINT_TEST = u8"Print Test (PLA)";
LSTR MSG_MOVE_Z_TO_TOP = u8"Raise Z to Top";
LSTR MSG_MAX_SPEED_NO_UNITS = u8"Max Speed";
//LSTR MSG_FTDI_HEATER_TIMEOUT = u8"Idle timeout, temperature decreased. Press Okay to reheat and again to resume.";
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
LSTR MSG_MOVE_TO_HOME = u8"Move to Home";
LSTR MSG_RAISE_PLUNGER = u8"Raise Plunger";
LSTR MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis";
LSTR MSG_BED_TEMPERATURE = u8"Bed Temperature";
LSTR MSG_HOME_XYZ_WARNING = u8"About to move to home position. Ensure the top and the bed of the printer are clear.\n\nContinue?";
LSTR MSG_HOME_E_WARNING = u8"About to re-home plunger and auto-level. Remove syringe prior to proceeding.\n\nContinue?";
#endif
#ifdef TOUCH_UI_COCOA_PRESS
LSTR MSG_BODY = u8"Body";
LSTR MSG_SELECT_CHOCOLATE_TYPE = u8"Select Chocolate Type";
LSTR MSG_EXTERNAL = u8"External";
LSTR MSG_CHOCOLATE = u8"Chocolate";
LSTR MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge";
LSTR MSG_LOAD_UNLOAD = u8"Load/Unload";
LSTR MSG_START_STOP = u8"Start/Stop";
LSTR MSG_LOAD = u8"Load";
LSTR MSG_UNLOAD = u8"Unload";
LSTR MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate";
LSTR MSG_PREHEAT_FINISHED = u8"Preheat finished";
LSTR MSG_PREHEAT = u8"Preheat";
LSTR MSG_ELAPSED_PRINT = u8"Elapsed Print";
LSTR MSG_XYZ_MOVE = u8"XYZ Move";
LSTR MSG_E_MOVE = u8"Extrusion Move";
#endif
}; // namespace Language_en
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/language/language_en.h
|
C++
|
agpl-3.0
| 9,623
|
/******************
* pin_mappings.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 file defines mappings from the ULTRA_LCD pins functions to new
* functions for the FTDI display. These mappings allows any board that
* support ULTRA_LCD via EXP1 and EXP2 connectors to use FTDI modules
* without adding new pin definitions to the board.
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(F6_TFT_PINMAP) // FYSETC F6 - ATmega2560
#define CLCD_SPI_CS 33
#define CLCD_MOD_RESET 31
#elif ENABLED(S6_TFT_PINMAP) // FYSETC S6 - STM32F4
#define CLCD_SPI_CS PC7
#define CLCD_MOD_RESET PC6
#elif ENABLED(CR10_TFT_PINMAP) // FYSETC S6 - STM32F4 - with TOUCH_UI_ULTIPANEL
#define CLCD_USE_SOFT_SPI
#define CLCD_SOFT_SPI_SCLK LCD_PINS_D4 // PORTA1 Pin 6
#define CLCD_SOFT_SPI_MOSI LCD_PINS_EN // PORTC1 Pin 8
#define CLCD_SPI_CS LCD_PINS_RS // PORTA3 Pin 7
#define CLCD_SOFT_SPI_MISO 16 // PORTC0 BTN_ENC Pin 2
#define CLCD_MOD_RESET 11 // PORTD3 BTN_EN1 Pin 3
#define CLCD_AUX_0 10 // PORTD2 BTN_EN2 Pin 5
#define CLCD_AUX_1 BEEPER_PIN // PORTA4 Pin 1
#elif ENABLED(AO_EXP1_DEPRECATED_PINMAP)
/**
* This LulzBot pinout re-purposes the UltraLCD
* connector EXP1 for Software SPI (rev B, obsolete)
*/
#define CLCD_MOD_RESET LCD_PINS_D4
#define CLCD_SPI_CS LCD_PINS_D5
#define CLCD_AUX_0 LCD_PINS_EN
#define CLCD_AUX_1 BTN_ENC
#define CLCD_AUX_2 BEEPER_PIN
#define CLCD_USE_SOFT_SPI
#define CLCD_SOFT_SPI_SCLK LCD_PINS_D7
#define CLCD_SOFT_SPI_MOSI LCD_PINS_D6
#define CLCD_SOFT_SPI_MISO LCD_PINS_RS
#elif ENABLED(AO_EXP1_PINMAP)
/**
* AO_EXP1_PINMAP with TOUCH_UI_ULTIPANEL
*
* This LulzBot mapping re-purposes the UltraLCD
* connector EXP1 for Software SPI for display (rev C):
*
* EXP2: FTDI: SD -or- USB [1]: ULTRA_LCD:
* 1 MISO MISO MISO --> BEEPER
* 2 SCLK SCLK SCLK --> BTN_ENC
* 3 PD_N - - --> LCDE
* 4 - CS_N CS_N --> LCDRS
* 5 CS_N - - --> LCD4
* 6 MOSI MOSI MOSI --> LCD5
* 7 - SD_DET INT --> LCD6
* 8 RESET - RESET --> LCD4
* 9 GND GND GND --> GND
* 10 5V 5V 5V --> 5V
*
* [1] At the moment, Marlin does not support SD or USB
* functionality over software SPI.
*/
#define CLCD_MOD_RESET LCD_PINS_EN
#define CLCD_SPI_CS LCD_PINS_D4
#define CLCD_USE_SOFT_SPI
#define CLCD_SOFT_SPI_SCLK BTN_ENC
#define CLCD_SOFT_SPI_MOSI LCD_PINS_D5
#define CLCD_SOFT_SPI_MISO BEEPER_PIN
#elif ENABLED(AO_EXP2_PINMAP)
/**
* AO_EXP2_PINMAP with TOUCH_UI_ULTIPANEL
*
* The LulzBot mapping for re-purposing the UltraLCD
* connector EXP2 for hardware SPI for display and SD card
* or USB (rev C):
*
* EXP2: FTDI: SD -or- USB: ULTRA_LCD:
* 1 MISO MISO MISO --> MISO
* 2 SCLK SCLK SCLK --> SCLK
* 3 PD_N - - --> BTN_EN2
* 4 - CS_N CS_N --> SD_CSEL
* 5 CS_N - - --> BTN_EN1
* 6 MOSI MOSI MOSI --> MOSI
* 7 - SD_DET INT --> SD_DET
* 8 RESET - RESET --> RESET
* 9 GND GND GND --> GND
* 10 5V 5V 5V --> KILL [3]
*
* [1] This configuration allows daisy-chaining of the
* display and SD/FD on EXP2, except for [2]
*
* [2] The Ultimachine Einsy boards have a level shifter
* on MISO enabled by SD_CSEL chip select, hence it
* is not possible to run both the display and the
* SD/FD on EXP2.
*
* [3] Archim Rambo provides 5V on this pin. On any other
* board, divert this wire from the ribbon cable and
* connect it to 5V at an endstop.
*/
#define CLCD_SPI_CS BTN_EN1
#define CLCD_MOD_RESET BTN_EN2
#if MB(EINSY_RAMBO, EINSY_RETRO) && !HAS_MEDIA
#define CLCD_SPI_EXTRA_CS SDSS
#endif
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/pin_mappings.h
|
C
|
agpl-3.0
| 6,018
|
/*****************
* screen_data.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 "ftdi_eve_lib/ftdi_eve_lib.h"
// To save RAM, store state information related to a particular screen
// in a union. The values should be initialized in the onEntry method.
/**
* The DECL_DATA_IF_INCLUDED macro:
*
* union screen_data_t {
* DECL_DATA_IF_INCLUDED(FTDI_EXAMPLE_SCREEN)
* }
*
* Is a shorthand for:
*
* union screen_data_t {
* #ifdef FTDI_EXAMPLE_SCREEN
* struct ExampleScreenData ExampleScreen;
* #endif
* }
*
*/
#define __DECL_DATA_IF_INCLUDED(CLASS) struct CLASS ## Data CLASS ;
#define _DECL_DATA_IF_INCLUDED(CLASS) __DECL_DATA_IF_INCLUDED(CLASS)
#define DECL_DATA_IF_INCLUDED(HEADER) TERN_(HEADER, _DECL_DATA_IF_INCLUDED(HEADER ## _CLASS))
union screen_data_t {
DECL_DATA_IF_INCLUDED(FTDI_INTERFACE_SETTINGS_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_LOCK_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_SPINNER_DIALOG_BOX)
DECL_DATA_IF_INCLUDED(FTDI_CONFIRM_START_PRINT_DIALOG_BOX)
DECL_DATA_IF_INCLUDED(FTDI_CHANGE_FILAMENT_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_FILES_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_MOVE_AXIS_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_BED_MESH_VIEW_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_BED_MESH_EDIT_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_STRESS_TEST_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_NUDGE_NOZZLE_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_Z_OFFSET_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_BASE_NUMERIC_ADJ_SCREEN)
DECL_DATA_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX)
DECL_DATA_IF_INCLUDED(COCOA_STATUS_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_PREHEAT_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_LOAD_CHOCOLATE_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_FILES_SCREEN)
DECL_DATA_IF_INCLUDED(COCOA_Z_OFFSET_WIZARD)
};
extern screen_data_t screen_data;
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screen_data.h
|
C
|
agpl-3.0
| 3,088
|
/***************
* screens.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 "screens.h"
tiny_timer_t refresh_timer;
/**
* DECL_SCREEN_IF_INCLUDED allows for a concise
* definition of SCREEN_TABLE:
*
* SCREEN_TABLE {
* DECL_SCREEN_IF_INCLUDED(MY_HEADER)
* }
*
* Is a shorthand for:
*
* SCREEN_TABLE {
* #ifdef MY_HEADER
* DECL_SCREEN(MY_HEADER),
* #endif
* }
*
*/
#define COMMA ,
#define __DECL_SCREEN_IF_INCLUDED(O,C) THIRD(O, DECL_SCREEN(C) COMMA,)
#define _DECL_SCREEN_IF_INCLUDED(O,C) __DECL_SCREEN_IF_INCLUDED(O ## COMMA, C)
#define DECL_SCREEN_IF_INCLUDED(H) _DECL_SCREEN_IF_INCLUDED(H, H ## _CLASS)
SCREEN_TABLE {
DECL_SCREEN_IF_INCLUDED(FTDI_BOOT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_LANGUAGE_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_TOUCH_CALIBRATION_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STATUS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_MAIN_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_TUNE_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_ADVANCED_SETTINGS_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_USER_REQUEST_ALERT_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_RESTORE_FAILSAFE_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_SAVE_SETTINGS_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_START_PRINT_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_CUSTOM_USER_MENUS)
DECL_SCREEN_IF_INCLUDED(FTDI_SPINNER_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_ABOUT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STATISTICS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_NUDGE_NOZZLE_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_MOVE_AXIS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STEPS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STEPPER_CURRENT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_LEVELING_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_Z_OFFSET_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_BED_MESH_VIEW_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_BED_MESH_EDIT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_NOZZLE_OFFSETS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_BACKLASH_COMP_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_FEEDRATE_PERCENT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_FLOW_PERCENT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_MAX_VELOCITY_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_MAX_ACCELERATION_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_DEFAULT_ACCELERATION_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_JUNCTION_DEVIATION_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_JERK_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_CASE_LIGHT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_FILAMENT_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_FILAMENT_RUNOUT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_LINEAR_ADVANCE_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_TEMPERATURE_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_CHANGE_FILAMENT_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_INTERFACE_SETTINGS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_INTERFACE_SOUNDS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_LOCK_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_FILES_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_ENDSTOP_STATE_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_BIO_PRINTING_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_BIO_CONFIRMOME_XYZ)
DECL_SCREEN_IF_INCLUDED(FTDI_BIO_CONFIRMOME_E)
DECL_SCREEN_IF_INCLUDED(FTDI_DEVELOPER_MENU)
DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX)
DECL_SCREEN_IF_INCLUDED(FTDI_WIDGET_DEMO_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_TOUCH_REGISTERS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_STRESS_TEST_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_MEDIA_PLAYER_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_DISPLAY_TUNING_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_STATUS_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_MAIN_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_ADVANCED_SETTINGS_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_PREHEAT_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_PREHEAT_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_LOAD_CHOCOLATE_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_LEVELING_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_XYZ_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_E_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_CONFIRM_START_PRINT)
DECL_SCREEN_IF_INCLUDED(COCOA_FILES_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_Z_OFFSET_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_Z_OFFSET_WIZARD)
DECL_SCREEN_IF_INCLUDED(COCOA_ABOUT_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_STATISTICS_SCREEN)
};
SCREEN_TABLE_POST
#include "screen_data.h"
screen_data_t screen_data;
#endif // TOUCH_UI_FTDI_EVE
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp
|
C++
|
agpl-3.0
| 5,857
|
/*************
* 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
#include "config.h"
#if ENABLED(TOUCH_UI_FTDI_EVE)
#include "ftdi_eve_lib/ftdi_eve_lib.h"
#include "language/language.h"
#include "theme/theme.h"
#include "generic/string_format.h"
#ifndef BED_LEVELING_COMMANDS
#define BED_LEVELING_COMMANDS "G29"
#endif
extern tiny_timer_t refresh_timer;
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
#include "bioprinter/screens.h"
#elif ENABLED(TOUCH_UI_COCOA_PRESS)
#include "cocoa_press/screens.h"
#elif ENABLED(TOUCH_UI_SYNDAVER_LEVEL)
#include "syndaver_level/screens.h"
#else
#include "generic/screens.h"
#endif
#endif // TOUCH_UI_FTDI_EVE
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.h
|
C
|
agpl-3.0
| 1,974
|
/*************
* bitmaps.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 Theme {
using namespace FTDI;
constexpr PROGMEM bitmap_info_t Extruder_Icon_Info = {
.format = L1,
.linestride = 3,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8000,
.width = 24,
.height = 23,
};
constexpr PROGMEM unsigned char Extruder_Icon[69] = {
0xFC, 0xFF, 0x3F,
0xFE, 0xFF, 0x7F,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0xFE, 0xFF, 0x7F,
0xFC, 0xFF, 0x3F,
0xFC, 0xFF, 0x3F,
0xFE, 0xFF, 0x7F,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0x03, 0x00, 0xC0,
0xFE, 0xFF, 0x7F,
0xFE, 0xFF, 0x7F,
0xE0, 0xFF, 0x07,
0xC0, 0xFF, 0x03,
0x80, 0x81, 0x01,
0x00, 0xC3, 0x00,
0x00, 0x66, 0x00,
0x00, 0x3C, 0x00,
0x00, 0x3C, 0x00
};
constexpr PROGMEM bitmap_info_t Bed_Heat_Icon_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8069,
.width = 32,
.height = 23,
};
constexpr PROGMEM unsigned char Bed_Heat_Icon[92] = {
0x80, 0x81, 0x81, 0x01,
0x80, 0x81, 0x81, 0x01,
0x00, 0x03, 0x03, 0x03,
0x00, 0x03, 0x03, 0x03,
0x00, 0x06, 0x06, 0x06,
0x00, 0x06, 0x06, 0x06,
0x00, 0x03, 0x03, 0x03,
0x00, 0x03, 0x03, 0x03,
0x80, 0x81, 0x81, 0x01,
0x80, 0x81, 0x81, 0x01,
0xC0, 0xC0, 0xC0, 0x00,
0xC0, 0xC0, 0xC0, 0x00,
0x60, 0x60, 0x60, 0x00,
0x60, 0x60, 0x60, 0x00,
0xC0, 0xC0, 0xC0, 0x00,
0xC0, 0xC0, 0xC0, 0x00,
0x80, 0x81, 0x81, 0x01,
0x80, 0x81, 0x81, 0x01,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0xC0,
0xFF, 0xFF, 0xFF, 0xFF
};
constexpr PROGMEM bitmap_info_t Fan_Icon_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8161,
.width = 32,
.height = 32,
};
constexpr PROGMEM unsigned char Fan_Icon[128] = {
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x1F, 0x00, 0x00, 0xF8,
0x0F, 0xC0, 0x1F, 0xF0,
0x07, 0xE0, 0x0F, 0xE0,
0x03, 0xF0, 0x07, 0xC0,
0x03, 0xF8, 0x07, 0xC0,
0x03, 0xF8, 0x07, 0xC0,
0x03, 0xF0, 0x07, 0xC0,
0x03, 0xE0, 0x07, 0xC0,
0x03, 0xC0, 0x03, 0xC0,
0x0B, 0x00, 0x00, 0xC3,
0x1B, 0xC0, 0x83, 0xC7,
0xFB, 0xE3, 0xC7, 0xCF,
0xFB, 0xF7, 0xEF, 0xDF,
0xFB, 0xF7, 0xEF, 0xDF,
0xFB, 0xF7, 0xEF, 0xDF,
0xFB, 0xF7, 0xEF, 0xDF,
0xF3, 0xE3, 0xC7, 0xDF,
0xE3, 0xC1, 0x03, 0xD8,
0xC3, 0x00, 0x00, 0xD0,
0x03, 0xC0, 0x03, 0xC0,
0x03, 0xE0, 0x07, 0xC0,
0x03, 0xE0, 0x0F, 0xC0,
0x03, 0xE0, 0x1F, 0xC0,
0x03, 0xE0, 0x1F, 0xC0,
0x03, 0xE0, 0x0F, 0xC0,
0x07, 0xF0, 0x07, 0xE0,
0x0F, 0xF8, 0x03, 0xF0,
0x1F, 0x00, 0x00, 0xF8,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
constexpr PROGMEM bitmap_info_t TD_Icon_Info = {
.format = L1,
.linestride = 7,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8289,
.width = 50,
.height = 20,
};
constexpr PROGMEM unsigned char TD_Icon[140] = {
0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, // Thumb Drive Widget
0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x06, 0x00, 0x00, 0x00, 0xC0, 0x01,
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03,
0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03,
0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x06, 0x00, 0x00, 0x00, 0xC0, 0x01,
0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x3F, 0x00
};
constexpr PROGMEM bitmap_info_t File_Icon_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8429,
.width = 25,
.height = 32,
};
const unsigned char File_Icon[128] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0x02, 0xC0, 0x00, 0x00,
0x02, 0x40, 0x01, 0x00, 0x02, 0x40, 0x02, 0x00, 0x02, 0x40, 0x04, 0x00,
0x02, 0x40, 0x08, 0x00, 0x02, 0x40, 0x10, 0x00, 0x02, 0x40, 0x20, 0x00,
0x02, 0x40, 0x40, 0x00, 0x02, 0xC0, 0xFF, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00, 0x02, 0x00, 0x80, 0x00,
0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
};
constexpr PROGMEM bitmap_info_t Clock_Icon_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8557,
.width = 32,
.height = 32,
};
const unsigned char Clock_Icon[128] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x7E, 0x7E, 0x00,
0x00, 0x07, 0xE0, 0x00, 0xC0, 0x01, 0x80, 0x03, 0xE0, 0x80, 0x00, 0x07,
0x30, 0x80, 0x01, 0x0E, 0x30, 0x80, 0x01, 0x0C, 0x18, 0x80, 0x01, 0x18,
0x0C, 0x80, 0x01, 0x10, 0x0C, 0x80, 0x01, 0x30, 0x04, 0x80, 0x01, 0x30,
0x06, 0x80, 0x01, 0x20, 0x06, 0x80, 0x01, 0x60, 0x06, 0x80, 0x01, 0x60,
0x06, 0x80, 0xFF, 0x60, 0x06, 0x80, 0xFF, 0x60, 0x06, 0x00, 0x00, 0x60,
0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x30,
0x0C, 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x10, 0x18, 0x00, 0x00, 0x18,
0x30, 0x00, 0x00, 0x0C, 0x70, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00, 0x07,
0xC0, 0x01, 0x80, 0x03, 0x00, 0x07, 0xE0, 0x00, 0x00, 0xFE, 0x7F, 0x00,
0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
};
constexpr PROGMEM bitmap_info_t Light_Bulb_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8685,
.width = 31,
.height = 32,
};
const unsigned char Light_Bulb[128] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x20, 0x00, 0x00, 0x02,
0x40, 0x00, 0x00, 0x01, 0x80, 0x00, 0x80, 0x00, 0x00, 0x01, 0x40, 0x00,
0x00, 0xF0, 0x07, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x6C, 0x18, 0x00,
0x00, 0x34, 0x10, 0x00, 0x00, 0x1A, 0x20, 0x00, 0x00, 0x0A, 0x20, 0x00,
0x3E, 0x0A, 0x20, 0x3E, 0x00, 0x02, 0x20, 0x00, 0x00, 0x02, 0x20, 0x00,
0x00, 0x06, 0x30, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x08, 0x08, 0x00,
0x00, 0x08, 0x08, 0x00, 0x00, 0x11, 0x44, 0x00, 0x80, 0x10, 0x84, 0x00,
0x40, 0x10, 0x04, 0x01, 0x20, 0xF0, 0x07, 0x02, 0x00, 0xE0, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
};
constexpr PROGMEM bitmap_info_t Chamber_Icon_Info = {
.format = L1,
.linestride = 4,
.filter = BILINEAR,
.wrapx = BORDER,
.wrapy = BORDER,
.RAMG_offset = 8813,
.width = 32,
.height = 32,
};
const unsigned char Chamber_Icon[128] PROGMEM = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0xF8,
0x0F, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xC0,
0x03, 0x00, 0x00, 0xC0, 0x83, 0x81, 0x81, 0xC1, 0x83, 0x81, 0x81, 0xC1,
0x03, 0x03, 0x03, 0xC3, 0x03, 0x03, 0x03, 0xC3, 0x03, 0x06, 0x06, 0xC6,
0x03, 0x06, 0x06, 0xC6, 0x03, 0x03, 0x03, 0xC3, 0x03, 0x03, 0x03, 0xC3,
0x83, 0x81, 0x81, 0xC1, 0x83, 0x81, 0x81, 0xC1, 0xC3, 0xC0, 0xC0, 0xC0,
0xC3, 0xC0, 0xC0, 0xC0, 0x63, 0x60, 0x60, 0xC0, 0x63, 0x60, 0x60, 0xC0,
0xC3, 0xC0, 0xC0, 0xC0, 0xC3, 0xC0, 0xC0, 0xC0, 0x83, 0x81, 0x81, 0xC1,
0x83, 0x81, 0x81, 0xC1, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0,
0x07, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0xF8,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
constexpr PROGMEM uint32_t UTF8_FONT_OFFSET = 10000;
constexpr PROGMEM uint32_t BACKGROUND_OFFSET = 40000;
} // namespace Theme
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/bitmaps.h
|
C++
|
agpl-3.0
| 10,414
|
/************
* colors.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
namespace Theme {
#if ENABLED(TOUCH_UI_COCOA_THEME)
constexpr int accent_hue = 23;
// Browns and Oranges
constexpr uint32_t accent_color_1 = hsl_to_rgb(12.8,0.597,0.263); // Darkest
constexpr uint32_t accent_color_2 = hsl_to_rgb(12.8,0.597,0.263);
constexpr uint32_t accent_color_3 = hsl_to_rgb( 9.6,0.664,0.443);
constexpr uint32_t accent_color_4 = hsl_to_rgb(16.3,0.873,0.537);
constexpr uint32_t accent_color_5 = hsl_to_rgb(23.0,0.889,0.539);
constexpr uint32_t accent_color_6 = hsl_to_rgb(23.0,0.889,0.539); // Lightest
#else
// Use linear accent colors
#if ANY(TOUCH_UI_ROYAL_THEME, TOUCH_UI_FROZEN_THEME)
// Dark blue accent colors
constexpr int accent_hue = 216;
constexpr float accent_sat = 0.7;
#else
// Green accent colors
constexpr int accent_hue = 68;
constexpr float accent_sat = 0.68;
#endif
// Shades of accent color
constexpr uint32_t accent_color_0 = hsl_to_rgb(accent_hue, accent_sat, 0.15); // Darkest
constexpr uint32_t accent_color_1 = hsl_to_rgb(accent_hue, accent_sat, 0.26);
constexpr uint32_t accent_color_2 = hsl_to_rgb(accent_hue, accent_sat, 0.39);
constexpr uint32_t accent_color_3 = hsl_to_rgb(accent_hue, accent_sat, 0.52);
constexpr uint32_t accent_color_4 = hsl_to_rgb(accent_hue, accent_sat, 0.65);
constexpr uint32_t accent_color_5 = hsl_to_rgb(accent_hue, accent_sat, 0.78);
constexpr uint32_t accent_color_6 = hsl_to_rgb(accent_hue, accent_sat, 0.91); // Lightest
#endif
// Shades of gray
constexpr float gray_sat = 0.14;
constexpr uint32_t gray_color_0 = hsl_to_rgb(accent_hue, gray_sat, 0.15); // Darkest
constexpr uint32_t gray_color_1 = hsl_to_rgb(accent_hue, gray_sat, 0.26);
constexpr uint32_t gray_color_2 = hsl_to_rgb(accent_hue, gray_sat, 0.39);
constexpr uint32_t gray_color_3 = hsl_to_rgb(accent_hue, gray_sat, 0.52);
constexpr uint32_t gray_color_4 = hsl_to_rgb(accent_hue, gray_sat, 0.65);
constexpr uint32_t gray_color_5 = hsl_to_rgb(accent_hue, gray_sat, 0.78);
constexpr uint32_t gray_color_6 = hsl_to_rgb(accent_hue, gray_sat, 0.91); // Lightest
#if ENABLED(TOUCH_UI_ROYAL_THEME)
constexpr uint32_t theme_darkest = accent_color_1;
constexpr uint32_t theme_dark = accent_color_4;
constexpr uint32_t bg_color = gray_color_0;
constexpr uint32_t axis_label = gray_color_1;
constexpr uint32_t bg_text_enabled = accent_color_6;
constexpr uint32_t bg_text_disabled = gray_color_0;
constexpr uint32_t bg_normal = accent_color_4;
constexpr uint32_t fg_disabled = gray_color_0;
constexpr uint32_t fg_normal = accent_color_0;
constexpr uint32_t fg_action = accent_color_1;
constexpr uint32_t logo_bg_rgb = accent_color_1;
constexpr uint32_t logo_fill_rgb = accent_color_0;
constexpr uint32_t logo_stroke_rgb = accent_color_4;
constexpr uint32_t bed_mesh_lines_rgb = 0xFFFFFF;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
#elif ANY(TOUCH_UI_COCOA_THEME, TOUCH_UI_FROZEN_THEME)
constexpr uint32_t theme_darkest = accent_color_1;
constexpr uint32_t theme_dark = accent_color_4;
constexpr uint32_t bg_color = 0xFFFFFF;
constexpr uint32_t axis_label = gray_color_5;
constexpr uint32_t bg_text_enabled = accent_color_1;
constexpr uint32_t bg_text_disabled = gray_color_1;
constexpr uint32_t bg_normal = accent_color_4;
constexpr uint32_t fg_disabled = gray_color_6;
constexpr uint32_t fg_normal = accent_color_1;
constexpr uint32_t fg_action = accent_color_4;
constexpr uint32_t logo_bg_rgb = accent_color_5;
constexpr uint32_t logo_fill_rgb = accent_color_6;
constexpr uint32_t logo_stroke_rgb = accent_color_2;
constexpr uint32_t bed_mesh_lines_rgb = accent_color_6;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
#define BED_MESH_POINTS_GRAY
#else
constexpr uint32_t theme_darkest = gray_color_1;
constexpr uint32_t theme_dark = gray_color_2;
constexpr uint32_t bg_color = gray_color_1;
constexpr uint32_t axis_label = gray_color_2;
constexpr uint32_t bg_text_enabled = 0xFFFFFF;
constexpr uint32_t bg_text_disabled = gray_color_2;
constexpr uint32_t bg_normal = gray_color_1;
constexpr uint32_t fg_disabled = gray_color_1;
constexpr uint32_t fg_normal = gray_color_2;
constexpr uint32_t fg_action = accent_color_2;
constexpr uint32_t logo_bg_rgb = accent_color_4;
constexpr uint32_t logo_fill_rgb = accent_color_3;
constexpr uint32_t logo_stroke_rgb = 0x000000;
constexpr uint32_t bed_mesh_lines_rgb = 0xFFFFFF;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
#endif
constexpr uint32_t shadow_rgb = gray_color_6;
constexpr uint32_t stroke_rgb = accent_color_1;
constexpr uint32_t fill_rgb = accent_color_3;
#if ENABLED(TOUCH_UI_COCOA_PRESS)
constexpr uint32_t syringe_rgb = 0xFFFFFF;
constexpr uint32_t fluid_rgb = accent_color_5;
#else
constexpr uint32_t syringe_rgb = accent_color_5;
constexpr uint32_t fluid_rgb = accent_color_3;
#endif
#if ENABLED(TOUCH_UI_ROYAL_THEME)
constexpr uint32_t x_axis = hsl_to_rgb(0, 1.00, 0.26);
constexpr uint32_t y_axis = hsl_to_rgb(120, 1.00, 0.13);
constexpr uint32_t z_axis = hsl_to_rgb(240, 1.00, 0.10);
#else
constexpr uint32_t x_axis = hsl_to_rgb(0, 1.00, 0.5);
constexpr uint32_t y_axis = hsl_to_rgb(120, 1.00, 0.37);
constexpr uint32_t z_axis = hsl_to_rgb(240, 1.00, 0.37);
#endif
constexpr uint32_t e_axis = axis_label;
constexpr uint32_t feedrate = axis_label;
constexpr uint32_t other = axis_label;
// Status screen
constexpr uint32_t progress = axis_label;
constexpr uint32_t status_msg = axis_label;
#if ENABLED(TOUCH_UI_ROYAL_THEME)
constexpr uint32_t fan_speed = hsl_to_rgb(240, 0.5, 0.13);
constexpr uint32_t temp = hsl_to_rgb(343, 1.0, 0.23);
#else
constexpr uint32_t fan_speed = hsl_to_rgb(204, 0.47, 0.41);
constexpr uint32_t temp = hsl_to_rgb(311, 0.51, 0.35);
#endif
constexpr uint32_t disabled_icon = gray_color_1;
// Calibration Registers Screen
constexpr uint32_t transformA = 0x3010D0;
constexpr uint32_t transformB = 0x4010D0;
constexpr uint32_t transformC = 0x5010D0;
constexpr uint32_t transformD = 0x6010D0;
constexpr uint32_t transformE = 0x7010D0;
constexpr uint32_t transformF = 0x8010D0;
constexpr uint32_t transformVal = 0x104010;
constexpr btn_colors disabled_btn = {.bg = bg_color, .grad = fg_disabled, .fg = fg_disabled, .rgb = fg_disabled };
constexpr btn_colors normal_btn = {.bg = fg_action, .grad = 0xFFFFFF, .fg = fg_normal, .rgb = 0xFFFFFF };
constexpr btn_colors action_btn = {.bg = bg_color, .grad = 0xFFFFFF, .fg = fg_action, .rgb = 0xFFFFFF };
constexpr btn_colors red_btn = {.bg = 0xFF5555, .grad = 0xFFFFFF, .fg = 0xFF0000, .rgb = 0xFFFFFF };
constexpr btn_colors ui_slider = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = accent_color_3 };
constexpr btn_colors ui_toggle = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = 0xFFFFFF };
// Temperature color scale
const rgb_t cool_rgb ( 0, 0, 0);
const rgb_t low_rgb (128, 0, 0);
const rgb_t med_rgb (255, 128, 0);
const rgb_t high_rgb (255, 255, 128);
};
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h
|
C++
|
agpl-3.0
| 9,801
|
/***********
* fonts.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 Theme {
#ifdef TOUCH_UI_800x480
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 28;
constexpr int16_t font_small = 29;
constexpr int16_t font_medium = 30;
constexpr int16_t font_large = 30;
constexpr int16_t font_xlarge = 31;
#else
constexpr int16_t font_tiny = 27;
constexpr int16_t font_xsmall = 29;
constexpr int16_t font_small = 30;
constexpr int16_t font_medium = 30;
constexpr int16_t font_large = 31;
constexpr int16_t font_xlarge = 31;
#endif
constexpr float icon_scale = 1.0;
#elif defined(TOUCH_UI_480x272)
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 26;
constexpr int16_t font_medium = 27;
constexpr int16_t font_large = 28;
constexpr int16_t font_xlarge = 29;
constexpr float icon_scale = 0.7;
#else
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 27;
constexpr int16_t font_medium = 28;
constexpr int16_t font_large = 30;
constexpr int16_t font_xlarge = 30;
constexpr float icon_scale = 0.6;
#endif
#elif defined(TOUCH_UI_320x240)
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 26;
constexpr int16_t font_medium = 27;
constexpr int16_t font_large = 27;
constexpr int16_t font_xlarge = 28;
constexpr float icon_scale = 0.6;
#else
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 26;
constexpr int16_t font_medium = 27;
constexpr int16_t font_large = 29;
constexpr int16_t font_xlarge = 30;
constexpr float icon_scale = 0.5;
#endif
#endif
}
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/fonts.h
|
C++
|
agpl-3.0
| 3,468
|
/****************************************************************************
* 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 logo_fill[] = {0x419D, 0x546F, 0x3D05, 0x5615, 0x3942, 0x5A92, 0x36B7, 0x6136, 0x35C8, 0x6950, 0x35C8, 0x96B0, 0x36B7, 0x9ECA, 0x3942, 0xA56E, 0x3D05, 0xA9EB, 0x419D, 0xAB91, 0xBE60, 0xAB91, 0xC2F8, 0xA9EB, 0xC6BB, 0xA56E, 0xC946, 0x9ECA, 0xCA35, 0x96B0, 0xCA32, 0x546C, 0x419D, 0x546F};
const PROGMEM uint16_t logo_stroke[] = {0xADF3, 0x546C, 0x419D, 0x546F, 0x3D05, 0x5615, 0x3942, 0x5A92, 0x36B7, 0x6136, 0x35C8, 0x6950, 0x35C8, 0x96B0, 0x36B7, 0x9ECA, 0x3942, 0xA56E, 0x3D05, 0xA9EB, 0x419D, 0xAB91, 0xBE60, 0xAB91, 0xC2F8, 0xA9EB, 0xC6BB, 0xA56E, 0xC946, 0x9ECA, 0xCA35, 0x96B0, 0xCA32, 0x546C, 0xADF3, 0x546C, 0xFFFF, 0x419D, 0x5913, 0xB08C, 0x5913, 0xC794, 0x8250, 0xC794, 0x96B0, 0xC6DA, 0x9CFF, 0xC4E1, 0xA229, 0xC1F4, 0xA5A5, 0xBE60, 0xA6ED, 0x419D, 0xA6ED, 0x3E09, 0xA5A5, 0x3B1C, 0xA229, 0x3923, 0x9CFF, 0x3869, 0x96B0, 0x3869, 0x6950, 0x3923, 0x6301, 0x3B1C, 0x5DD7, 0x3E09, 0x5A5B, 0x419D, 0x5913, 0xFFFF, 0xAC7A, 0x8620, 0xAC7A, 0x9373, 0xA767, 0x9373, 0xA767, 0x75CB, 0xA1C6, 0x75CB, 0xA1C6, 0x9373, 0xA1C6, 0x9C8E, 0xA767, 0x9C8E, 0xAC7A, 0x9C8E, 0xB21C, 0x9C8E, 0xB21C, 0x9373, 0xB21C, 0x85E7, 0xB350, 0x8093, 0xB65F, 0x7E86, 0xB9D5, 0x8165, 0xBA83, 0x85E7, 0xBA83, 0x9C8E, 0xBEFE, 0x9C8E, 0xC024, 0x99E1, 0xC024, 0x8620, 0xBF7B, 0x7F22, 0xBD8F, 0x79A9, 0xBA7E, 0x7617, 0xB65F, 0x74D0, 0xB24F, 0x7622, 0xAF30, 0x79C6, 0xAD2F, 0x7F43, 0xAC7A, 0x8620, 0xAC7A, 0x8620, 0xAC7A, 0x8620, 0xFFFF, 0x8179, 0x9C8E, 0x7CE9, 0x9C8E, 0x7747, 0x9C8E, 0x7747, 0x92EC, 0x7747, 0x8949, 0x75A2, 0x81A3, 0x71A6, 0x7E73, 0x6DAB, 0x818B, 0x6C05, 0x88FC, 0x6DAF, 0x9019, 0x71C7, 0x92EC, 0x7505, 0x92EC, 0x7505, 0x9C8E, 0x7118, 0x9C8E, 0x6CD3, 0x9B06, 0x696B, 0x96D6, 0x6729, 0x909E, 0x6658, 0x88FC, 0x672D, 0x8133, 0x6980, 0x7AC7, 0x6D13, 0x766C, 0x71A6, 0x74D0, 0x7632, 0x766D, 0x79C2, 0x7AD1, 0x7C14, 0x8153, 0x7CE9, 0x8949, 0x7CE9, 0x92EC, 0x8179, 0x92EC, 0x8179, 0x8620, 0x822E, 0x7F43, 0x842E, 0x79C6, 0x874E, 0x7622, 0x8B5E, 0x74D0, 0x8F7C, 0x7617, 0x928E, 0x79A9, 0x9479, 0x7F22, 0x9523, 0x8620, 0x9523, 0x87DB, 0x8F81, 0x87DB, 0x8F81, 0x85E7, 0x8ED4, 0x8165, 0x8B5E, 0x7E86, 0x884F, 0x8093, 0x871A, 0x85E7, 0x871A, 0x92EC, 0x871A, 0x9C8F, 0x8179, 0x9C8F, 0x8179, 0x9C8E, 0x8179, 0x9C8E, 0xFFFF, 0x6515, 0x79DB, 0x644C, 0x7281, 0x6218, 0x6C86, 0x5EB2, 0x6882, 0x5A56, 0x670A, 0x55D9, 0x68E0, 0x5272, 0x6DD0, 0x4F0B, 0x68E0, 0x4A8E, 0x670A, 0x4638, 0x6882, 0x42D5, 0x6C86, 0x40A2, 0x7281, 0x3FD9, 0x79DB, 0x3FD9, 0x9AC9, 0x40E4, 0x9C8E, 0x456F, 0x9C8E, 0x456F, 0x79B5, 0x46D4, 0x735D, 0x4A8E, 0x70C0, 0x4E3E, 0x735D, 0x4FA1, 0x79B5, 0x4FA1, 0x9C8E, 0x554D, 0x9C8E, 0x554D, 0x79B5, 0x56A7, 0x735D, 0x5A56, 0x70C0, 0x5E0C, 0x735D, 0x5F74, 0x79B5, 0x5F74, 0x9C8E, 0x6515, 0x9C8E, 0x6515, 0x79DB, 0x6515, 0x79DB, 0x6515, 0x79DB, 0xFFFF, 0x9672, 0x8C4C, 0x9714, 0x9379, 0x98F5, 0x98D2, 0x9C0B, 0x9BF4, 0xA04C, 0x9C7B, 0xA04C, 0x9373, 0x9D2B, 0x920C, 0x9C1E, 0x8C4C, 0x9C1E, 0x648E, 0x9672, 0x648E, 0x9672, 0x8C4C, 0x9672, 0x8C4C, 0x9672, 0x8C4C, 0xFFFF, 0xA767, 0x7194, 0xA767, 0x6C02, 0xA692, 0x687A, 0xA496, 0x670A, 0xA291, 0x687A, 0xA1BB, 0x6C02, 0xA1BB, 0x7194, 0xA767, 0x7194, 0xA767, 0x7194, 0xA767, 0x7194};
#define LOGO_BACKGROUND logo_bg_rgb
#define LOGO_PAINT_PATHS \
LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) \
LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke)
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_landscape.h
|
C++
|
agpl-3.0
| 4,779
|
/****************************************************************************
* 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 logo_fill[] = {0x3C19, 0x70C5, 0x371A, 0x7159, 0x3302, 0x72EA, 0x303D, 0x753C, 0x2F39, 0x7811, 0x2F39, 0x87ED, 0x303D, 0x8AC2, 0x3302, 0x8D14, 0x371A, 0x8EA5, 0x3C19, 0x8F39, 0xC3E4, 0x8F39, 0xC8E3, 0x8EA5, 0xCCFB, 0x8D14, 0xCFC0, 0x8AC2, 0xD0C4, 0x87ED, 0xD0C0, 0x70C4, 0x3C19, 0x70C5};
const PROGMEM uint16_t logo_stroke[] = {0x3C19, 0x70C5, 0x371A, 0x7159, 0x3302, 0x72EA, 0x303D, 0x753C, 0x2F39, 0x7811, 0x2F39, 0x87ED, 0x303D, 0x8AC2, 0x3302, 0x8D14, 0x371A, 0x8EA5, 0x3C19, 0x8F39, 0xC3E4, 0x8F39, 0xC8E3, 0x8EA5, 0xCCFB, 0x8D14, 0xCFC0, 0x8AC2, 0xD0C4, 0x87ED, 0xD0C0, 0x70C4, 0x3C19, 0x70C5, 0xFFFF, 0x3C19, 0x7264, 0xB4D6, 0x7264, 0xCDE7, 0x80CE, 0xCDE7, 0x87ED, 0xCD1D, 0x8A21, 0xCAF7, 0x8BEF, 0xC7C8, 0x8D27, 0xC3E4, 0x8D9A, 0x3C19, 0x8D9A, 0x3835, 0x8D27, 0x3506, 0x8BEF, 0x32E0, 0x8A21, 0x3216, 0x87ED, 0x3216, 0x7811, 0x32E0, 0x75DD, 0x3506, 0x740F, 0x3835, 0x72D7, 0x3C19, 0x7264, 0xFFFF, 0xB069, 0x8223, 0xB069, 0x86CB, 0xAAE2, 0x86CB, 0xAAE2, 0x7C6E, 0xA4C2, 0x7C6E, 0xA4C2, 0x86CB, 0xA4C2, 0x89FA, 0xAAE2, 0x89FA, 0xB069, 0x89FA, 0xB689, 0x89FA, 0xB689, 0x86CB, 0xB689, 0x820F, 0xB7D9, 0x8033, 0xBB2E, 0x7F7B, 0xBEF2, 0x807C, 0xBFAE, 0x820F, 0xBFAE, 0x89FA, 0xC48F, 0x89FA, 0xC5CF, 0x890A, 0xC5CF, 0x8223, 0xC517, 0x7FB2, 0xC300, 0x7DC8, 0xBFA9, 0x7C88, 0xBB2E, 0x7C16, 0xB6C1, 0x7C8C, 0xB35B, 0x7DD2, 0xB12D, 0x7FBD, 0xB069, 0x8223, 0xB069, 0x8223, 0xB069, 0x8223, 0xFFFF, 0x819B, 0x89FA, 0x7CA3, 0x89FA, 0x7682, 0x89FA, 0x7682, 0x869C, 0x7682, 0x833E, 0x74B7, 0x8092, 0x7062, 0x7F74, 0x6C0C, 0x8089, 0x6A41, 0x8323, 0x6C10, 0x859F, 0x7085, 0x869C, 0x740C, 0x869C, 0x740C, 0x89FA, 0x6FC7, 0x89FA, 0x6B21, 0x8971, 0x676C, 0x87FA, 0x64F8, 0x85CE, 0x6414, 0x8323, 0x64FC, 0x806A, 0x6784, 0x7E2C, 0x6B67, 0x7CA6, 0x7062, 0x7C16, 0x7555, 0x7CA6, 0x7935, 0x7E2F, 0x7BBC, 0x8076, 0x7CA3, 0x833E, 0x7CA3, 0x869C, 0x819A, 0x869C, 0x819A, 0x8223, 0x825F, 0x7FBD, 0x848D, 0x7DD2, 0x87F3, 0x7C8C, 0x8C60, 0x7C16, 0x90DB, 0x7C88, 0x9432, 0x7DC8, 0x9648, 0x7FB2, 0x9701, 0x8223, 0x9701, 0x82BE, 0x90E0, 0x82BE, 0x90E0, 0x820F, 0x9024, 0x807C, 0x8C60, 0x7F7B, 0x890B, 0x8033, 0x87BB, 0x820F, 0x87BB, 0x869C, 0x87BB, 0x89FA, 0x819B, 0x89FA, 0x819B, 0x89FA, 0x819B, 0x89FA, 0xFFFF, 0x62B5, 0x7DD9, 0x61DA, 0x7B47, 0x5F73, 0x7931, 0x5BC1, 0x77C9, 0x5702, 0x7746, 0x521F, 0x77EA, 0x4E6B, 0x79A4, 0x4AB8, 0x77EA, 0x45D5, 0x7746, 0x411D, 0x77C9, 0x3D6E, 0x7931, 0x3B09, 0x7B47, 0x3A2E, 0x7DD9, 0x3A2E, 0x895C, 0x3B51, 0x89FA, 0x4043, 0x89FA, 0x4043, 0x7DCC, 0x41C6, 0x7B95, 0x45D5, 0x7AAB, 0x49D9, 0x7B95, 0x4B5B, 0x7DCC, 0x4B5B, 0x89FA, 0x5188, 0x89FA, 0x5188, 0x7DCC, 0x52FF, 0x7B95, 0x5702, 0x7AAB, 0x5B0C, 0x7B95, 0x5C94, 0x7DCC, 0x5C94, 0x89FA, 0x62B5, 0x89FA, 0x62B5, 0x7DD9, 0x62B5, 0x7DD9, 0x62B5, 0x7DD9, 0xFFFF, 0x986E, 0x844B, 0x991E, 0x86CD, 0x9B2A, 0x88AC, 0x9E85, 0x89C4, 0xA327, 0x89F3, 0xA327, 0x86CB, 0x9FBF, 0x864E, 0x9E9A, 0x844B, 0x9E9A, 0x7668, 0x986E, 0x7668, 0x986E, 0x844B, 0x986E, 0x844B, 0x986E, 0x844B, 0xFFFF, 0xAAE2, 0x7AF5, 0xAAE2, 0x7902, 0xA9FB, 0x77C7, 0xA7D2, 0x7746, 0xA59F, 0x77C7, 0xA4B6, 0x7902, 0xA4B6, 0x7AF5, 0xAAE2, 0x7AF5, 0xAAE2, 0x7AF5, 0xAAE2, 0x7AF5};
#define LOGO_BACKGROUND logo_bg_rgb
#define LOGO_PAINT_PATHS \
LOGO_PAINT_PATH(logo_fill_rgb, logo_fill) \
LOGO_PAINT_PATH(logo_stroke_rgb, logo_stroke)
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/marlin_bootscreen_portrait.h
|
C++
|
agpl-3.0
| 4,763
|
/**************
* sounds.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 "sounds.h"
namespace Theme {
using namespace FTDI;
const PROGMEM SoundPlayer::sound_t chimes[] = {
{CHIMES, NOTE_G3, 5},
{CHIMES, NOTE_E4, 5},
{CHIMES, NOTE_C4, 5},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t sad_trombone[] = {
{TRUMPET, NOTE_A3S, 10},
{TRUMPET, NOTE_A3 , 10},
{TRUMPET, NOTE_G3S, 10},
{TRUMPET, NOTE_G3, 20},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t twinkle[] = {
{GLOCKENSPIEL, NOTE_C4, 1},
{GLOCKENSPIEL, NOTE_E4, 1},
{GLOCKENSPIEL, NOTE_G4, 16},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t fanfare[] = {
{TRUMPET, NOTE_A3, 4},
{SILENCE, REST, 1},
{TRUMPET, NOTE_A3, 2},
{SILENCE, REST, 1},
{TRUMPET, NOTE_A3, 2},
{SILENCE, REST, 1},
{TRUMPET, NOTE_E4, 10},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t media_inserted[] = {
{MUSIC_BOX, NOTE_C4, 2},
{MUSIC_BOX, NOTE_E4, 2},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t media_removed[] = {
{MUSIC_BOX, NOTE_E4, 2},
{MUSIC_BOX, NOTE_C4, 2},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t js_bach_toccata[] = {
{ORGAN, NOTE_A4, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_A4, 35},
{SILENCE, REST, 12},
{ORGAN, NOTE_G4, 4},
{ORGAN, NOTE_F4, 4},
{ORGAN, NOTE_E4, 4},
{ORGAN, NOTE_D4, 4},
{ORGAN, NOTE_C4S, 16},
{ORGAN, NOTE_D4, 32},
{SILENCE, REST, 42},
{ORGAN, NOTE_A3, 2},
{ORGAN, NOTE_G3, 2},
{ORGAN, NOTE_A3, 35},
{SILENCE, REST, 9},
{ORGAN, NOTE_E3, 8},
{ORGAN, NOTE_F3, 8},
{ORGAN, NOTE_C3S, 16},
{ORGAN, NOTE_D3, 27},
{SILENCE, REST, 42},
{ORGAN, NOTE_A2, 2},
{ORGAN, NOTE_G2, 2},
{ORGAN, NOTE_A2, 35},
{SILENCE, REST, 12},
{ORGAN, NOTE_G2, 4},
{ORGAN, NOTE_F2, 4},
{ORGAN, NOTE_E2, 4},
{ORGAN, NOTE_D2, 4},
{ORGAN, NOTE_C2S, 16},
{ORGAN, NOTE_D2, 32},
{SILENCE, REST, 52},
//{ORGAN, NOTE_D1, 28},
{ORGAN, NOTE_C3S, 9},
{ORGAN, NOTE_E3, 9},
{ORGAN, NOTE_G3, 9},
{ORGAN, NOTE_A3S, 9},
{ORGAN, NOTE_C4S, 9},
{ORGAN, NOTE_E4, 9},
{ORGAN, NOTE_D4, 20},
{SILENCE, REST, 30},
{ORGAN, NOTE_C4S, 4},
{ORGAN, NOTE_D4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_C4S, 2},
{ORGAN, NOTE_D4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_C4S, 2},
{ORGAN, NOTE_D4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_C4S, 2},
{ORGAN, NOTE_D4, 4},
{ORGAN, NOTE_E4, 4},
{ORGAN, NOTE_F4, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_F4, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_F4, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_E4, 2},
{ORGAN, NOTE_F4, 4},
{ORGAN, NOTE_G4, 4},
{ORGAN, NOTE_A4, 2},
{ORGAN, NOTE_A4S, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_A4, 2},
{ORGAN, NOTE_A4S, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_A4, 2},
{ORGAN, NOTE_A4S, 2},
{ORGAN, NOTE_G4, 2},
{ORGAN, NOTE_A4, 4},
{SILENCE, REST, 36},
{ORGAN, NOTE_C5S, 4},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_C5S, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_C5S, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_C5S, 2},
{ORGAN, NOTE_D5, 4},
{ORGAN, NOTE_E5, 4},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_F5, 4},
{ORGAN, NOTE_G5, 4},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_A5S, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_A5S, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_A5S, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_A5, 4},
{SILENCE, REST, 32},
{ORGAN, NOTE_A5, 4},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_A5S, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_A5S, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_G5, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_C5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_A5, 2},
{ORGAN, NOTE_C5, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_F5, 2},
{ORGAN, NOTE_A4S, 2},
{ORGAN, NOTE_D5, 2},
{ORGAN, NOTE_E5, 2},
{ORGAN, NOTE_A4S, 2},
{ORGAN, NOTE_C5, 2},
{ORGAN, NOTE_E5, 2},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t js_bach_joy[] = {
{PIANO, NOTE_G3, 4},
{PIANO, NOTE_A3, 4},
{PIANO, NOTE_B3, 4},
{PIANO, NOTE_D4, 3},
{SILENCE, REST, 1},
{PIANO, NOTE_C4, 3},
{SILENCE, REST, 1},
{PIANO, NOTE_C4, 4},
{PIANO, NOTE_E4, 3},
{SILENCE, REST, 1},
{PIANO, NOTE_D4, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_D4, 4},
{PIANO, NOTE_G4 , 3},
{SILENCE, REST, 1},
{PIANO, NOTE_F4S, 4},
{PIANO, NOTE_G4, 4},
{PIANO, NOTE_D4, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_B3, 3},
{SILENCE, REST, 1},
{PIANO, NOTE_G3, 4},
{PIANO, NOTE_A3, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_B3, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_C4, 4},
{PIANO, NOTE_D4, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_E4, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_D4, 4},
{PIANO, NOTE_C4, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_B3, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_A3, 4},
{PIANO, NOTE_B3, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_G3, 2},
{SILENCE, REST, 2},
{PIANO, NOTE_G3, 8},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t flagpole[] = {
{TRIANGLE_WAVE, NOTE_G3, 2},
{TRIANGLE_WAVE, NOTE_C4, 2},
{TRIANGLE_WAVE, NOTE_E4, 2},
{TRIANGLE_WAVE, NOTE_G4, 2},
{TRIANGLE_WAVE, NOTE_C5, 2},
{TRIANGLE_WAVE, NOTE_E5, 2},
{TRIANGLE_WAVE, NOTE_G5, 5},
{TRIANGLE_WAVE, NOTE_E5, 2},
{TRIANGLE_WAVE, NOTE_G3S, 2},
{TRIANGLE_WAVE, NOTE_C4, 2},
{TRIANGLE_WAVE, NOTE_D4S, 2},
{TRIANGLE_WAVE, NOTE_G4S, 2},
{TRIANGLE_WAVE, NOTE_C5, 2},
{TRIANGLE_WAVE, NOTE_D5S, 2},
{TRIANGLE_WAVE, NOTE_G5S, 5},
{TRIANGLE_WAVE, NOTE_D5S, 5},
{TRIANGLE_WAVE, NOTE_A3S, 2},
{TRIANGLE_WAVE, NOTE_D4, 2},
{TRIANGLE_WAVE, NOTE_F4, 2},
{TRIANGLE_WAVE, NOTE_A4S, 2},
{TRIANGLE_WAVE, NOTE_D5, 2},
{TRIANGLE_WAVE, NOTE_F5, 2},
{TRIANGLE_WAVE, NOTE_A5S, 5},
{SILENCE, REST, 1},
{TRIANGLE_WAVE, NOTE_A5S, 1},
{SILENCE, REST, 1},
{TRIANGLE_WAVE, NOTE_A5S, 1},
{SILENCE, REST, 1},
{TRIANGLE_WAVE, NOTE_A5S, 1},
{SILENCE, REST, 1},
{TRIANGLE_WAVE, NOTE_A5S, 8},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t big_band[] = {
{XYLOPHONE, NOTE_F4, 3},
{XYLOPHONE, NOTE_G4, 3},
{XYLOPHONE, NOTE_F4, 3},
{XYLOPHONE, NOTE_D4, 3},
{XYLOPHONE, NOTE_A3S, 3},
{SILENCE, REST, 3},
{TRUMPET, NOTE_F4, 3},
{TRUMPET, NOTE_G4, 3},
{TRUMPET, NOTE_F4, 3},
{TRUMPET, NOTE_D4, 3},
{TRUMPET, NOTE_A3S, 3},
{SILENCE, REST, 3},
{TUBA, NOTE_A2S, 6},
{TUBA, NOTE_A2S, 6},
{TUBA, NOTE_A2S, 4},
{TUBA, NOTE_A2S, 6},
{TUBA, NOTE_A2S, 6},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t beats[] = {
{SILENCE, REST, 8},
{NOTCH, NOTE_C4, 8},
{KICKDRUM, NOTE_C4, 8},
{HIHAT, NOTE_C4, 8},
{COWBELL, NOTE_C4, 8},
{SILENCE, REST, 8},
{NOTCH, NOTE_C4, 8},
{KICKDRUM, NOTE_C4, 8},
{HIHAT, NOTE_C4, 8},
{COWBELL, NOTE_C4, 8},
{SILENCE, REST, 8},
{NOTCH, NOTE_C4, 8},
{KICKDRUM, NOTE_C4, 8},
{HIHAT, NOTE_C4, 8},
{COWBELL, NOTE_C4, 8},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t beeping[] = {
{BEEPING, NOTE_C4, 64},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t alarm[] = {
{ALARM, NOTE_C4, 64},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t warble[] = {
{WARBLE, NOTE_C4, 64},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t carousel[] = {
{CAROUSEL, NOTE_C4, 64},
{SILENCE, END_SONG, 0}
};
const PROGMEM SoundPlayer::sound_t all_instruments[] = {
{HARP},
{XYLOPHONE},
{TUBA},
{GLOCKENSPIEL},
{ORGAN},
{TRUMPET},
{PIANO},
{CHIMES},
{MUSIC_BOX},
{BELL},
{CLICK},
{SWITCH},
{COWBELL},
{NOTCH},
{HIHAT},
{KICKDRUM},
{SWITCH},
{POP},
{CLACK},
{CHACK},
{SILENCE, END_SONG, 0}
};
} // namespace Theme
#define N_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
const SoundList::list_t SoundList::list[] = {
{"Silence", FTDI::silence},
{"Twinkle", Theme::twinkle},
{"Chimes", Theme::chimes},
{"Fanfare", Theme::fanfare},
{"Sad Trombone", Theme::sad_trombone},
{"Big Band", Theme::big_band},
{"Beeping", Theme::beeping},
{"Alarm", Theme::alarm},
{"Warble", Theme::warble},
{"Carousel", Theme::carousel},
{"Beats", Theme::beats},
{"Bach Joy", Theme::js_bach_joy},
{"Bach Toccata", Theme::js_bach_toccata},
{"Flagpole", Theme::flagpole}
};
const uint8_t SoundList::n = N_ELEMENTS(SoundList::list);
#endif // TOUCH_UI_FTDI_EVE
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/sounds.cpp
|
C++
|
agpl-3.0
| 12,799
|
/************
* sounds.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 Theme {
using namespace FTDI;
extern const PROGMEM SoundPlayer::sound_t chimes[];
extern const PROGMEM SoundPlayer::sound_t sad_trombone[];
extern const PROGMEM SoundPlayer::sound_t twinkle[];
extern const PROGMEM SoundPlayer::sound_t fanfare[];
extern const PROGMEM SoundPlayer::sound_t media_inserted[];
extern const PROGMEM SoundPlayer::sound_t media_removed[];
extern const PROGMEM SoundPlayer::sound_t js_bach_toccata[];
extern const PROGMEM SoundPlayer::sound_t js_bach_joy[];
extern const PROGMEM SoundPlayer::sound_t big_band[];
extern const PROGMEM SoundPlayer::sound_t beats[];
extern const PROGMEM SoundPlayer::sound_t beeping[];
extern const PROGMEM SoundPlayer::sound_t alarm[];
extern const PROGMEM SoundPlayer::sound_t warble[];
extern const PROGMEM SoundPlayer::sound_t carousel[];
extern const PROGMEM SoundPlayer::sound_t all_instruments[];
} // namespace Theme
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/sounds.h
|
C++
|
agpl-3.0
| 2,309
|
/***********
* theme.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 "bitmaps.h"
#include "colors.h"
#include "fonts.h"
#include "sounds.h"
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/theme.h
|
C
|
agpl-3.0
| 1,463
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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/ia_creality/FileNavigator.cpp
* ****************************************
* Extensible_UI implementation for Creality DWIN
* 10SPro, Max, CR10V2
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
* Written by Insanity Automation
* ***************************************/
#include "../../../inc/MarlinConfigPre.h"
#if DGUS_LCD_UI_IA_CREALITY
#include "ia_creality_rts.h"
#include "FileNavigator.h"
#include <WString.h>
ExtUI::FileList FileNavigator::filelist; // ExtUI file API
char FileNavigator::currentDirPath[MAX_PATH_LEN]; // Current folder path
uint16_t FileNavigator::lastindex;
uint8_t FileNavigator::folderdepth;
uint16_t FileNavigator::currentindex; // override the panel request
FileNavigator filenavigator;
FileNavigator::FileNavigator() { reset(); }
void FileNavigator::reset() {
currentDirPath[0] = '\0';
folderdepth = 0;
currentindex = 0;
lastindex = 0;
// Start at root folder
while (!filelist.isAtRootDir()) filelist.upDir();
refresh();
}
void FileNavigator::refresh() { filelist.refresh(); }
bool FileNavigator::getIndexisDir(uint16_t index){
filelist.seek(index);
return filelist.isDir();
}
const char *FileNavigator::getIndexName(uint16_t index){
filelist.seek(index);
return filelist.shortFilename();
}
uint16_t FileNavigator::maxFiles() {
return filelist.count();
}
void FileNavigator::getFiles(uint16_t index) {
uint16_t files = DISPLAY_FILES, fcnt = 0;
if (index == 0)
currentindex = 0;
else {
// Each time we change folder we reset the file index to 0 and keep track
// of the current position as the TFT panel isn't aware of folder trees.
--currentindex; // go back a file to take account of the .. added to the root.
if (index > lastindex)
currentindex += files + 1;
else if (currentindex >= files)
currentindex -= files - 1;
else
currentindex = 0;
}
lastindex = index;
// Clear currently drawn screen
for (int i = 0; i < DISPLAY_FILES; i++) {
for (int j = 0; j < 20; j++)
rts.sendData(0, SDFILE_ADDR + (i * 20) + j);
}
for (int j = 0; j < 10; j++) {
rts.sendData(0, Printfilename + j); // clear screen.
rts.sendData(0, Choosefilename + j); // clear filename
}
for (int j = 0; j < 8; j++)
rts.sendData(0, FilenameCount + j);
for (int j = 1; j <= DISPLAY_FILES; j++) {
rts.sendData(10, FilenameIcon + j);
rts.sendData(10, FilenameIcon1 + j);
}
if (currentindex == 0 && folderdepth > 0) { // Add a link to go up a folder
files--;
rts.sendData("Up Directory", SDFILE_ADDR);
fcnt++;
}
else if (currentindex == DISPLAY_FILES && folderdepth > 0)
currentindex--;
for (uint16_t seek = currentindex; seek < currentindex + files; seek++) {
if (filelist.seek(seek)) {
const int filelen = strlen(filelist.filename());
if (filelen > 20) {
char *buf = (char *)filelist.filename();
buf[18] = '\0'; // cutoff at screen edge
rts.sendData(buf, (SDFILE_ADDR + (fcnt * 20)));
}
else
rts.sendData(filelist.filename(), (SDFILE_ADDR + (fcnt * 20)));
if (filelist.isDir()) {
rts.sendData((uint8_t)4, FilenameIcon + (fcnt+1));
rts.sendData((unsigned long)0x041F, (FilenameNature + ((1+fcnt) * 16))); // Change BG of selected line to Blue
}
else {
rts.sendData((uint8_t)0, FilenameIcon + (fcnt+1));
rts.sendData((unsigned long)0xFFFF, (FilenameNature + ((1+fcnt) * 16))); // white
}
SERIAL_ECHOLNPGM("-", seek, " '", filelist.filename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
fcnt++;
}
}
}
void FileNavigator::changeDIR(char *folder) {
if (folderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
strcat(currentDirPath, folder);
strcat(currentDirPath, "/");
filelist.changeDir(folder);
refresh();
folderdepth++;
currentindex = 0;
}
void FileNavigator::upDIR() {
filelist.upDir();
refresh();
folderdepth--;
currentindex = 0;
// Remove the last child folder from the stored path
if (folderdepth == 0) {
currentDirPath[0] = '\0';
reset();
}
else {
char *pos = nullptr;
for (uint8_t f = 0; f < folderdepth; f++)
pos = strchr(currentDirPath, '/');
pos[1] = '\0';
}
}
char* FileNavigator::getCurrentDirPath() { return currentDirPath; }
#endif // DGUS_LCD_UI_IA_CREALITY
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ia_creality/FileNavigator.cpp
|
C++
|
agpl-3.0
| 5,370
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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
/* ****************************************
* lcd/extui/ia_creality/FileNavigator.h
* ****************************************
* Extensible_UI implementation for Creality DWIN
* 10SPro, Max, CRX and others
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
* Written by Insanity Automation
* ***************************************/
#include "../ui_api.h"
#define MAX_FOLDER_DEPTH 4 // Limit folder depth TFT has a limit for the file path
#define MAX_PATH_LEN 16 * MAX_FOLDER_DEPTH // Maximum number of characters in a SD file path
#define DISPLAY_FILES 4
class FileNavigator {
public:
FileNavigator();
static void reset();
static void getFiles(uint16_t);
static void upDIR();
static void changeDIR(char *);
static void refresh();
static char* getCurrentDirPath();
static uint8_t folderdepth;
static uint16_t currentindex;
static bool getIndexisDir(uint16_t);
const char *getIndexName(uint16_t);
static uint16_t maxFiles();
private:
static ExtUI::FileList filelist;
static char currentDirPath[MAX_PATH_LEN];
static uint16_t lastindex;
};
extern FileNavigator filenavigator;
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ia_creality/FileNavigator.h
|
C++
|
agpl-3.0
| 2,080
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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/ia_creality/ia_creality_extui.cpp
* ****************************************
* Extensible_UI implementation for Creality DWIN
* 10SPro, Max, CRX, and others
* Based original Creality release, ported to Marlin ExtUI
* Written by Insanity Automation, sponsored by Tiny Machines 3D
*
* ***************************************/
#include "../../../inc/MarlinConfigPre.h"
#if DGUS_LCD_UI_IA_CREALITY
#include "ia_creality_rts.h"
#include "FileNavigator.h"
#include "../ui_api.h"
namespace ExtUI {
uint8_t dwin_settings_version = 1;
void onStartup() { rts.onStartup(); }
void onIdle() { rts.onIdle(); }
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
rts.sendData(ExchangePageBase + 88, ExchangepageAddr);
int16_t j = 0;
char outmsg[40];
char killMsg[strlen_P(FTOP(error)) + strlen_P(FTOP(component)) + 3];
sprintf_P(killMsg, PSTR(S_FMT ": " S_FMT), FTOP(error), FTOP(component));
while (j < 4) outmsg[j++] = '*';
while (const char c = killMsg[j - 4]) outmsg[j++] = c;
while (j < 40) outmsg[j++] = '*';
rts.sendData(outmsg, MacVersion);
delay_ms(10);
}
void onMediaInserted() {
filenavigator.reset();
filenavigator.getFiles(0);
fileIndex = 0;
recordcount = 0;
}
void onMediaError() {
filenavigator.reset();
for (int16_t i = 0; i < MaxFileNumber; i++)
for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j);
for (int16_t j = 0; j < 10; j++) {
rts.sendData(0, Printfilename + j); // clean screen.
rts.sendData(0, Choosefilename + j); // clean filename
}
for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j);
for (int16_t j = 1; j <= MaxFileNumber; j++) {
rts.sendData(10, FilenameIcon + j);
rts.sendData(10, FilenameIcon1 + j);
}
}
void onMediaRemoved() {
filenavigator.reset();
for (int16_t i = 0; i < MaxFileNumber; i++)
for (int16_t j = 0; j < 10; j++) rts.sendData(0, SDFILE_ADDR + i * 10 + j);
for (int16_t j = 0; j < 10; j++) {
rts.sendData(0, Printfilename + j); // clean screen.
rts.sendData(0, Choosefilename + j); // clean filename
}
for (int16_t j = 0; j < 8; j++) rts.sendData(0, FilenameCount + j);
for (int16_t j = 1; j <= MaxFileNumber; j++) {
rts.sendData(10, FilenameIcon + j);
rts.sendData(10, FilenameIcon1 + j);
}
}
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, const uint16_t/*=0*/) {
rts.sendData(StartSoundSet, SoundAddr);
}
void onPrintTimerStarted() {
if (waitway == 7) return;
printerStatusKey[1] = 3;
show_status = true;
delay_ms(1);
rts.sendData(ExchangePageBase + 53, ExchangepageAddr);
}
void onPrintTimerPaused() {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // Display Pause Screen
onStatusChanged(F("Pausing..."));
}
void onPrintTimerStopped() {
if (waitway == 3) return;
#if FAN_COUNT > 0
for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(FanOff, (fan_t)i);
#endif
printerStatusKey[0] = 0;
show_status = true;
tpShowStatus = false;
rts.sendData(ExchangePageBase + 51, ExchangepageAddr);
}
void onFilamentRunout() {
printerStatusKey[1] = 4;
tpShowStatus = false;
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
}
void onFilamentRunout(extruder_t extruder) {
printerStatusKey[1] = 4;
tpShowStatus = false;
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
}
void onUserConfirmRequired(const char *const msg) {
printerStatusKey[1] = 4;
tpShowStatus = false;
if (lastPauseMsgState == ExtUI::pauseModeStatus && msg == (const char*)GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD))
return;
switch (ExtUI::pauseModeStatus) {
case PAUSE_MESSAGE_WAITING: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Press Yes to Continue"));
break;
}
case PAUSE_MESSAGE_INSERT: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Load Filament to Continue"));
break;
}
case PAUSE_MESSAGE_HEAT: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Add Filament and Press Yes to Reheat"));
break;
}
#if DISABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
case PAUSE_MESSAGE_PURGE: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
char newMsg[40] = "Yes to ";
strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, PSTR(" No to Purge"));
onStatusChanged(newMsg);
break;
}
#endif
case PAUSE_MESSAGE_OPTION: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
char newMsg[40] = "Yes to ";
strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, PSTR(" No to Purge"));
onStatusChanged(newMsg);
break;
}
case PAUSE_MESSAGE_PARKING: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Parking..."));
break;
}
case PAUSE_MESSAGE_CHANGING: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Beginning Filament Change"));
break;
}
case PAUSE_MESSAGE_UNLOAD: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Unloading..."));
break;
}
case PAUSE_MESSAGE_LOAD: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Reloading..."));
break;
}
case PAUSE_MESSAGE_RESUME:
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
case PAUSE_MESSAGE_PURGE: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
onStatusChanged(F("Press Yes to Stop Purge"));
break;
}
#endif
case PAUSE_MESSAGE_HEATING: {
rts.sendData(ExchangePageBase + 68, ExchangepageAddr);
onStatusChanged(F("Reheating"));
break;
}
case PAUSE_MESSAGE_STATUS:
default: {
setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
setUserConfirmed();
break;
}
}
lastPauseMsgState = ExtUI::pauseModeStatus;
}
// 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 statMsg) {
for (int16_t j = 0; j < 20; j++) // Clear old message
rts.sendData(' ', StatusMessageString + j);
rts.sendData(statMsg, StatusMessageString);
}
void onFactoryReset() {
dwin_settings.settings_size = sizeof(creality_dwin_settings_t);
dwin_settings.settings_version = dwin_settings_version;
dwin_settings.display_standby = true;
dwin_settings.display_sound = true;
dwin_settings.display_volume = 32;
dwin_settings.standby_brightness = 15;
dwin_settings.screen_brightness = 100;
dwin_settings.standby_time_seconds = 60;
dwin_settings.screen_rotation = 0;
onStartup();
startprogress = 0;
show_status = true;
}
static_assert(eeprom_data_size >= sizeof(creality_dwin_settings_t), "Insufficient space in EEPROM for UI parameters");
void onStoreSettings(char *buff) {
// Write to buffer
memcpy(buff, &dwin_settings, sizeof(creality_dwin_settings_t));
}
void onLoadSettings(const char *buff) {
creality_dwin_settings_t eepromSettings;
memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t));
// If size is not the same, discard settings
if (eepromSettings.settings_size != sizeof(creality_dwin_settings_t)) {
onFactoryReset();
return;
}
if (eepromSettings.settings_version != dwin_settings_version) {
onFactoryReset();
return;
}
// Copy into final location
memcpy(&dwin_settings, &eepromSettings, sizeof(creality_dwin_settings_t));
rts.setTouchScreenConfiguration();
}
void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written,
// whether successful or not.
}
void onSettingsLoaded(const bool success) {
#if HAS_MESH
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
const bool zig = outer & 1;
const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer };
rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2));
++abl_probe_index;
}
rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off
setLevelingActive(true);
}
else {
rts.sendData(2, AutoLevelIcon); /*Off*/
setLevelingActive(false);
}
#endif
rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z);
rts.setTouchScreenConfiguration();
}
void onPostprocessSettings() {}
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {
#if HAS_MESH
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
const bool zig = outer & 1;
const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer };
rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2);
++abl_probe_index;
}
rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off
setLevelingActive(true);
}
else {
rts.sendData(2, AutoLevelIcon); /*Off*/
setLevelingActive(false);
}
#endif
}
#endif
#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
if (waitway == 3)
if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1)))
rts.sendData(ExchangePageBase + 64, ExchangepageAddr);
#if HAS_MESH
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
const bool zig = outer & 1; // != ((PR_OUTER_END) & 1);
const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer };
if (point.x == xpos && outer == ypos)
rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2));
++abl_probe_index;
}
#endif
}
#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() {
startprogress = 254;
show_status = true;
tpShowStatus = false;
no_reentry = false;
rts.sendData(ExchangePageBase + 76, ExchangepageAddr);
}
#endif
#if HAS_PID_HEATING
void onPIDTuning(const pidresult_t rst) {
// Called for temperature PID tuning result
rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp);
rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp);
rts.sendData(uint16_t(getPID_Kp(E0)) * 10, HotendPID_P);
rts.sendData(uint16_t(getPID_Ki(E0)) * 10, HotendPID_I);
rts.sendData(uint16_t(getPID_Kd(E0)) * 10, HotendPID_D);
#if ENABLED(PIDTEMPBED)
rts.sendData(uint16_t(getBedPID_Kp()) * 10, BedPID_P);
rts.sendData(uint16_t(getBedPID_Ki()) * 10, BedPID_I);
rts.sendData(uint16_t(getBedPID_Kd()) * 10, BedPID_D);
#endif
onStatusChanged(F("PID Tune Finished"));
}
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 onHomingStart() {}
void onHomingDone() {}
void onPrintDone() {}
void onSteppersDisabled() {}
void onSteppersEnabled() {}
void onAxisDisabled(const axis_t) {}
void onAxisEnabled(const axis_t) {}
} // ExtUI
#endif // DGUS_LCD_UI_IA_CREALITY
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
|
C++
|
agpl-3.0
| 13,980
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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/ia_creality/ia_creality_rts.cpp
* ****************************************
* Creality DWIN Resistive Touch Screen
* 10SPro, Max, CRX, and others
* Based original Creality release
* Written by Insanity Automation, sponsored by Tiny Machines 3D
*
* ***************************************/
#include "../../../inc/MarlinConfigPre.h"
#if DGUS_LCD_UI_IA_CREALITY
#include "ia_creality_rts.h"
#include "FileNavigator.h"
#include "../ui_api.h"
using namespace ExtUI;
#include <string.h> // for memset
// Singleton instance
RTS rts;
// Static data
DB RTS::recdat, RTS::snddat;
uint8_t RTS::databuf[DATA_BUF_SIZE];
rx_datagram_state_t RTS::rx_datagram_state = DGUS_IDLE;
uint8_t RTS::rx_datagram_len = 0;
// Local data
uint16_t fileIndex = 0;
uint8_t recordcount = 0;
uint8_t waitway_lock = 0;
uint8_t startprogress = 0;
char waitway = 0;
int16_t recnum = 0;
float changeMaterialBuf[2] = { 0 };
char nozzleTempStatus[3] = { 0 };
char printerStatusKey[2] = { 0 };
uint8_t axisPageNum = 0; // 0 for 10mm, 1 for 1mm, 2 for 0.1mm
bool show_status = true;
bool tpShowStatus = false; // true for only opening time and percentage, false for closing time and percentage.
bool autoHomeKey = false;
uint8_t autoHomeIconNum;
int16_t userConfValidation = 0;
uint8_t lastPauseMsgState = 0;
creality_dwin_settings_t dwin_settings;
bool no_reentry = false;
uint8_t reentryCount = 0;
uint16_t idleThrottling = 0;
bool pause_resume_selected = false;
#if HAS_PID_HEATING
uint16_t pid_hotendAutoTemp = 150;
uint16_t pid_bedAutoTemp = 70;
#endif
#ifndef IA_CREALITY_BOOT_DELAY
#define IA_CREALITY_BOOT_DELAY 500
#endif
void RTS::onStartup() {
DWIN_SERIAL.begin(115200);
recdat.head[0] = snddat.head[0] = FHONE;
recdat.head[1] = snddat.head[1] = FHTWO;
ZERO(databuf);
delay_ms(IA_CREALITY_BOOT_DELAY); // Delay to allow screen startup
setTouchScreenConfiguration();
sendData(StartSoundSet, SoundAddr);
delay_ms(400); // Delay to allow screen to configure
onStatusChanged(MACHINE_NAME " Ready");
sendData(100, FeedrateDisplay);
/***************turn off motor*****************/
sendData(11, FilenameIcon);
/***************transmit temperature to screen*****************/
sendData(0, NozzlePreheat);
sendData(0, BedPreheat);
sendData(getActualTemp_celsius(H0), NozzleTemp);
sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp);
sendData(getActualTemp_celsius(BED), Bedtemp);
/***************transmit Fan speed to screen*****************/
sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon);
/***************transmit Printer information to screen*****************/
for (int16_t j = 0; j < 20; j++) // clean filename
sendData(0, MacVersion + j);
char sizebuf[20] = {0};
sprintf(sizebuf, "%d X %d X %d", Y_BED_SIZE, X_BED_SIZE, Z_MAX_POS);
sendData(MACHINE_NAME, MacVersion);
sendData(SHORT_BUILD_VERSION, SoftVersion);
sendData(sizebuf, PrinterSize);
sendData(WEBSITE_URL, CorpWebsite);
/**************************some info init*******************************/
sendData(0, PrintscheduleIcon);
sendData(0, PrintscheduleIcon + 1);
/************************clean screen*******************************/
for (int16_t i = 0; i < MaxFileNumber; i++)
for (int16_t j = 0; j < 10; j++) sendData(0, SDFILE_ADDR + i * 10 + j);
for (int16_t j = 0; j < 10; j++) {
sendData(0, Printfilename + j); // clean screen.
sendData(0, Choosefilename + j); // clean filename
}
for (int16_t j = 0; j < 8; j++) sendData(0, FilenameCount + j);
for (int16_t j = 1; j <= MaxFileNumber; j++) {
sendData(10, FilenameIcon + j);
sendData(10, FilenameIcon1 + j);
}
}
void RTS::onIdle() {
while (rts.receiveData() > 0 && (rts.recdat.data[0] != 0 || rts.recdat.addr != 0))
rts.handleData();
if (no_reentry && reentryCount < 120) { reentryCount++; return; }
reentryCount = 0;
if (idleThrottling++ < 750) return;
// Always send temperature data
rts.sendData(getActualTemp_celsius(getActiveTool()), NozzleTemp);
rts.sendData(getActualTemp_celsius(BED), Bedtemp);
rts.sendData(getTargetTemp_celsius(getActiveTool()), NozzlePreheat);
rts.sendData(getTargetTemp_celsius(BED), BedPreheat);
rts.sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp);
rts.sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat);
TERN_(HAS_MULTI_HOTEND, rts.sendData(uint8_t(getActiveTool() + 1), ActiveToolVP));
if (awaitingUserConfirm() && (lastPauseMsgState != ExtUI::pauseModeStatus || userConfValidation > 99)) {
if (ExtUI::pauseModeStatus < PAUSE_MESSAGE_COUNT)
ui.pause_show_message(ExtUI::pauseModeStatus);
else
ExtUI::onUserConfirmRequired(F("Confirm Continue"));
userConfValidation = 0;
}
else if (pause_resume_selected && !awaitingUserConfirm()) {
rts.sendData(ExchangePageBase + 53, ExchangepageAddr);
pause_resume_selected = false;
userConfValidation = 0;
}
else if (awaitingUserConfirm()) {
if (pause_resume_selected) {
pause_resume_selected = false;
userConfValidation = 100;
}
else
userConfValidation++;
}
no_reentry = true;
idleThrottling = 0;
if (waitway && !commandsInQueue())
waitway_lock++;
else
waitway_lock = 0;
if (waitway_lock > 100) {
waitway_lock = 0;
waitway = 0; // clear waitway if nothing is going on
}
switch (waitway) {
case 1:
if (isPositionKnown()) {
show_status = true;
rts.sendData(ExchangePageBase + 54, ExchangepageAddr);
waitway = 0;
}
break;
case 2:
if (isPositionKnown() && !commandsInQueue()) waitway = 0;
break;
case 3:
//if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED)-1))) {
rts.sendData(ExchangePageBase + 64, ExchangepageAddr);
waitway = 7;
//return;
//}
break;
case 4:
if (autoHomeKey && isPositionKnown() && !commandsInQueue()) { // Manual Move Home Done
//rts.sendData(ExchangePageBase + 71 + axisPageNum, ExchangepageAddr);
autoHomeKey = false;
waitway = 0;
}
break;
case 5:
if (isPositionKnown() && !commandsInQueue()) {
show_status = true;
waitway = 0;
rts.sendData(ExchangePageBase + 78, ExchangepageAddr); // exchange to 78 page
}
break;
case 6:
if (!commandsInQueue()) {
setAxisPosition_mm(BED_TRAMMING_HEIGHT, axis_t(Z));
waitway = 0;
}
break;
case 7:
if (!commandsInQueue()) waitway = 0;
break;
}
TERN_(HAS_MESH, rts.sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon));
TERN_(HAS_FILAMENT_SENSOR, rts.sendData(getFilamentRunoutEnabled() ? 3 : 2, RunoutToggle));
TERN_(CASE_LIGHT_ENABLE, rts.sendData(getCaseLightState() ? 3 : 2, LedToggle));
TERN_(POWER_LOSS_RECOVERY, rts.sendData(getPowerLossRecoveryEnabled() ? 3 : 2, PowerLossToggle));
if (startprogress == 0) {
startprogress += 25;
delay_ms(3000); // Delay to show bootscreen
}
else if (startprogress < 250) {
if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often
onMediaInserted();
else
injectCommands(F("M22\nM21"));
startprogress = 254;
show_status = true;
tpShowStatus = false;
rts.sendData(ExchangePageBase + 45, ExchangepageAddr);
no_reentry = false;
return;
}
if (startprogress <= 100)
rts.sendData(startprogress, StartIcon);
else
rts.sendData(startprogress - 100, StartIcon + 1);
//rts.sendData((startprogress++) % 5, ExchFlmntIcon);
if (isPrinting()) {
rts.sendData(getActualFan_percent((fan_t)getActiveTool()), FanKeyIcon);
rts.sendData(getProgress_seconds_elapsed() / 3600, Timehour);
rts.sendData((getProgress_seconds_elapsed() % 3600) / 60, Timemin);
if (getProgress_percent() > 0) {
const uint16_t perc = getProgress_percent() + 1;
if (perc <= 50) {
rts.sendData(uint16_t(perc) * 2, PrintscheduleIcon);
rts.sendData(0, PrintscheduleIcon + 1);
}
else {
rts.sendData(100, PrintscheduleIcon);
rts.sendData(uint16_t(perc) * 2 - 100, PrintscheduleIcon + 1);
}
}
else {
rts.sendData(0, PrintscheduleIcon);
rts.sendData(0, PrintscheduleIcon + 1);
}
rts.sendData(uint16_t(getProgress_percent()), Percentage);
}
else { // Not printing settings
rts.sendData(map(constrain(dwin_settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay);
rts.sendData(dwin_settings.screen_brightness, DisplayBrightness);
rts.sendData(dwin_settings.standby_brightness, DisplayStandbyBrightness);
rts.sendData(dwin_settings.standby_time_seconds, DisplayStandbySeconds);
if (dwin_settings.display_standby)
rts.sendData(3, DisplayStandbyEnableIndicator);
else
rts.sendData(2, DisplayStandbyEnableIndicator);
rts.sendData(getAxisSteps_per_mm(X) * 10, StepMM_X);
rts.sendData(getAxisSteps_per_mm(Y) * 10, StepMM_Y);
rts.sendData(getAxisSteps_per_mm(Z) * 10, StepMM_Z);
rts.sendData(getAxisSteps_per_mm(E0) * 10, StepMM_E);
rts.sendData(getAxisMaxAcceleration_mm_s2(X) / 100, Accel_X);
rts.sendData(getAxisMaxAcceleration_mm_s2(Y) / 100, Accel_Y);
rts.sendData(getAxisMaxAcceleration_mm_s2(Z) / 10, Accel_Z);
rts.sendData(getAxisMaxAcceleration_mm_s2(E0), Accel_E);
rts.sendData(getAxisMaxFeedrate_mm_s(X), Feed_X);
rts.sendData(getAxisMaxFeedrate_mm_s(Y), Feed_Y);
rts.sendData(getAxisMaxFeedrate_mm_s(Z), Feed_Z);
rts.sendData(getAxisMaxFeedrate_mm_s(E0), Feed_E);
rts.sendData(getAxisMaxJerk_mm_s(X) * 100, Jerk_X);
rts.sendData(getAxisMaxJerk_mm_s(Y) * 100, Jerk_Y);
rts.sendData(getAxisMaxJerk_mm_s(Z) * 100, Jerk_Z);
rts.sendData(getAxisMaxJerk_mm_s(E0) * 100, Jerk_E);
#if HAS_HOTEND_OFFSET
rts.sendData(getNozzleOffset_mm(X, E1) * 10, T2Offset_X);
rts.sendData(getNozzleOffset_mm(Y, E1) * 10, T2Offset_Y);
rts.sendData(getNozzleOffset_mm(Z, E1) * 10, T2Offset_Z);
rts.sendData(getAxisSteps_per_mm(E1) * 10, T2StepMM_E);
#endif
#if HAS_BED_PROBE
rts.sendData(getProbeOffset_mm(X) * 100, ProbeOffset_X);
rts.sendData(getProbeOffset_mm(Y) * 100, ProbeOffset_Y);
#endif
#if HAS_PID_HEATING
rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp);
rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp);
rts.sendData(getPID_Kp(E0) * 10, HotendPID_P);
rts.sendData(getPID_Ki(E0) * 10, HotendPID_I);
rts.sendData(getPID_Kd(E0) * 10, HotendPID_D);
#if ENABLED(PIDTEMPBED)
rts.sendData(getBedPID_Kp() * 10, BedPID_P);
rts.sendData(getBedPID_Ki() * 10, BedPID_I);
rts.sendData(getBedPID_Kd() * 10, BedPID_D);
#endif
#endif
}
rts.sendData(getZOffset_mm() * 100, ProbeOffset_Z);
rts.sendData(uint16_t(getFlow_percent(E0)), Flowrate);
if (nozzleTempStatus[0] || nozzleTempStatus[2]) { // statuse of loadfilament and unloadfinement when temperature is less than
uint16_t IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool());
NOMORE(IconTemp, 100U);
rts.sendData(IconTemp, HeatPercentIcon);
if (getActualTemp_celsius(getActiveTool()) > EXTRUDE_MINTEMP && nozzleTempStatus[0] != 0) {
nozzleTempStatus[0] = 0;
rts.sendData(10 * changeMaterialBuf[0], FilamentUnit1);
rts.sendData(10 * changeMaterialBuf[1], FilamentUnit2);
rts.sendData(ExchangePageBase + 65, ExchangepageAddr);
}
else if (getActualTemp_celsius(getActiveTool()) >= getTargetTemp_celsius(getActiveTool()) && nozzleTempStatus[2]) {
nozzleTempStatus[2] = 0;
tpShowStatus = true;
rts.sendData(4, ExchFlmntIcon);
rts.sendData(ExchangePageBase + 83, ExchangepageAddr);
}
else if (nozzleTempStatus[2]) {
//rts.sendData((startprogress++) % 5, ExchFlmntIcon);
}
}
if (autoHomeKey) {
rts.sendData(autoHomeIconNum, AutoZeroIcon);
if (++autoHomeIconNum > 9) autoHomeIconNum = 0;
}
if (isMediaInserted()) {
const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1,
maxPageAdd = filenavigator.folderdepth ? 1 : 0,
maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) );
rts.sendData(currPage, FilesCurentPage);
rts.sendData(maxPages, FilesMaxPage);
}
else {
rts.sendData(0, FilesCurentPage);
rts.sendData(0, FilesMaxPage);
}
if (rts.recdat.addr != DisplayZaxis && rts.recdat.addr != DisplayYaxis && rts.recdat.addr != DisplayZaxis) {
rts.sendData(10 * getAxisPosition_mm(axis_t(X)), DisplayXaxis);
rts.sendData(10 * getAxisPosition_mm(axis_t(Y)), DisplayYaxis);
rts.sendData(10 * getAxisPosition_mm(axis_t(Z)), DisplayZaxis);
}
no_reentry = false;
}
RTS::RTS() {
recdat.head[0] = snddat.head[0] = FHONE;
recdat.head[1] = snddat.head[1] = FHTWO;
ZERO(databuf);
}
int16_t RTS::receiveData() {
uint8_t receivedbyte;
while (DWIN_SERIAL.available())
switch (rx_datagram_state) {
case DGUS_IDLE: // Waiting for the first header byte
receivedbyte = DWIN_SERIAL.read();
if (FHONE == receivedbyte) rx_datagram_state = DGUS_HEADER1_SEEN;
break;
case DGUS_HEADER1_SEEN: // Waiting for the second header byte
receivedbyte = DWIN_SERIAL.read();
rx_datagram_state = (FHTWO == receivedbyte) ? DGUS_HEADER2_SEEN : DGUS_IDLE;
break;
case DGUS_HEADER2_SEEN: // Waiting for the length byte
rx_datagram_len = DWIN_SERIAL.read();
//DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") ");
// Telegram min len is 3 (command and one word of payload)
rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE;
break;
case DGUS_WAIT_TELEGRAM: // wait for complete datagram to arrive.
if (DWIN_SERIAL.available() < rx_datagram_len) return -1;
uint8_t command = DWIN_SERIAL.read();
//DEBUGLCDCOMM_ECHOPGM("# ", command);
uint8_t readlen = rx_datagram_len - 1; // command is part of len.
uint8_t tmp[rx_datagram_len - 1];
uint8_t *ptmp = tmp;
while (readlen--) {
receivedbyte = DWIN_SERIAL.read();
//DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte);
*ptmp++ = receivedbyte;
}
//DEBUGLCDCOMM_ECHOPGM(" # ");
// mostly we'll get this: 5A A5 03 82 4F 4B -- ACK on 0x82, so discard it.
if (command == VarAddr_W && 'O' == tmp[0] && 'K' == tmp[1]) {
rx_datagram_state = DGUS_IDLE;
break;
}
/* AutoUpload, (and answer to) Command 0x83 :
* tmp[0 1 2 3 4 ... ]
* Example 5A A5 06 83 20 01 01 78 01 ……
* / / | | \ / | \ \
* Header | | | | \_____\_ DATA (Words!)
* DatagramLen / VPAdr |
* Command DataLen (in Words)
*/
if (command == VarAddr_R) {
const uint16_t vp = tmp[0] << 8 | tmp[1];
const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words)
recdat.addr = vp;
recdat.len = tmp[2];
for (uint16_t i = 0; i < dlen; i += 2) {
recdat.data[i / 2] = tmp[3 + i];
recdat.data[i / 2] = (recdat.data[i / 2] << 8 ) | tmp[4 + i];
}
rx_datagram_state = DGUS_IDLE;
return 2;
}
// discard anything else
rx_datagram_state = DGUS_IDLE;
}
return -1;
}
void RTS::sendData() {
if (snddat.head[0] == FHONE && snddat.head[1] == FHTWO && snddat.len >= 3) {
databuf[0] = snddat.head[0];
databuf[1] = snddat.head[1];
databuf[2] = snddat.len;
databuf[3] = snddat.command;
if (snddat.command == 0x80) { // to write data to the register
databuf[4] = snddat.addr;
for (int16_t i = 0; i < (snddat.len - 2); i++) databuf[5 + i] = snddat.data[i];
}
else if (snddat.len == 3 && (snddat.command == 0x81)) { // to read data from the register
databuf[4] = snddat.addr;
databuf[5] = snddat.bytelen;
}
else if (snddat.command == 0x82) { // to write data to the variate
databuf[4] = snddat.addr >> 8;
databuf[5] = snddat.addr & 0xFF;
for (int16_t i = 0; i < (snddat.len - 3); i += 2) {
databuf[6 + i] = snddat.data[i / 2] >> 8;
databuf[7 + i] = snddat.data[i / 2] & 0xFF;
}
}
else if (snddat.len == 4 && (snddat.command == 0x83)) { // to read data from the variate
databuf[4] = snddat.addr >> 8;
databuf[5] = snddat.addr & 0xFF;
databuf[6] = snddat.bytelen;
}
for (int16_t i = 0; i < (snddat.len + 3); i++) {
DWIN_SERIAL.write(databuf[i]);
delay_us(1);
}
memset(&snddat, 0, sizeof(snddat));
ZERO(databuf);
snddat.head[0] = FHONE;
snddat.head[1] = FHTWO;
}
}
void RTS::sendData(const String &s, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) {
if (s.length() < 1) return;
sendData(s.c_str(), addr, cmd);
}
void RTS::sendData(const char *str, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) {
int16_t len = strlen(str);
constexpr int16_t maxlen = DATA_BUF_SIZE - 6;
if (len > 0) {
if (len > maxlen) len = maxlen;
databuf[0] = FHONE;
databuf[1] = FHTWO;
databuf[2] = 3 + len;
databuf[3] = cmd;
databuf[4] = addr >> 8;
databuf[5] = addr & 0x00FF;
for (int16_t i = 0; i < len; i++) databuf[6 + i] = str[i];
for (int16_t i = 0; i < (len + 6); i++) {
DWIN_SERIAL.write(databuf[i]);
delay_us(1);
}
ZERO(databuf);
}
}
void RTS::sendData(const char c, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) {
snddat.command = cmd;
snddat.addr = addr;
snddat.data[0] = uint32_t(uint16_t(c) << 8);
snddat.len = 5;
sendData();
}
void RTS::sendData(const_float_t f, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) {
int16_t n = f;
if (cmd == VarAddr_W) {
snddat.data[0] = n;
snddat.len = 5;
}
else if (cmd == RegAddr_W) {
snddat.data[0] = n;
snddat.len = 3;
}
else if (cmd == VarAddr_R) {
snddat.bytelen = n;
snddat.len = 4;
}
snddat.command = cmd;
snddat.addr = addr;
sendData();
}
void RTS::sendData(const int n, const uint32_t addr, const uint8_t cmd/*=VarAddr_W*/) {
if (cmd == VarAddr_W) {
if ((unsigned int)n > 0xFFFF) {
snddat.data[0] = n >> 16;
snddat.data[1] = n & 0xFFFF;
snddat.len = 7;
}
else {
snddat.data[0] = n;
snddat.len = 5;
}
}
else if (cmd == RegAddr_W) {
snddat.data[0] = n;
snddat.len = 3;
}
else if (cmd == VarAddr_R) {
snddat.bytelen = n;
snddat.len = 4;
}
snddat.command = cmd;
snddat.addr = addr;
sendData();
}
void RTS::sendData(const unsigned long n, uint32_t addr, uint8_t cmd/*=VarAddr_W*/) {
if (cmd == VarAddr_W) {
if (n > 0xFFFF) {
snddat.data[0] = n >> 16;
snddat.data[1] = n & 0xFFFF;
//snddat.data[0] = n >> 24;
//snddat.data[1] = n >> 16;
//snddat.data[2] = n >> 8;
//snddat.data[3] = n;
snddat.len = 7;
}
else {
snddat.data[0] = n;
snddat.len = 5;
}
}
else if (cmd == VarAddr_R) {
snddat.bytelen = n;
snddat.len = 4;
}
snddat.command = cmd;
snddat.addr = addr;
sendData();
}
void RTS::handleData() {
int16_t Checkkey = -1;
if (waitway > 0) { // for waiting
memset(&recdat, 0, sizeof(recdat));
recdat.head[0] = FHONE;
recdat.head[1] = FHTWO;
return;
}
for (int16_t i = 0; Addrbuf[i] != 0; i++) {
if (recdat.addr == Addrbuf[i]) {
if (Addrbuf[i] == NzBdSet || Addrbuf[i] == NozzlePreheat || Addrbuf[i] == BedPreheat || Addrbuf[i] == Flowrate)
Checkkey = ManualSetTemp;
else if (WITHIN(Addrbuf[i], Stopprint, Resumeprint))
Checkkey = PrintChoice;
else if (WITHIN(Addrbuf[i], AutoZero, DisplayZaxis))
Checkkey = XYZEaxis;
else if (WITHIN(Addrbuf[i], FilamentUnit1, FilamentUnit2))
Checkkey = Filament;
else
Checkkey = i;
break;
}
}
switch (recdat.addr) {
case Flowrate:
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
case StepMM_X ... StepMM_E:
#endif
case ProbeOffset_X ... ProbeOffset_Y:
case HotendPID_AutoTmp ... BedPID_AutoTmp:
case HotendPID_P ... HotendPID_D:
case BedPID_P ... BedPID_D:
#if ENABLED(DUAL_X_CARRIAGE)
case T2Offset_X ... T2Offset_Z:
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
case T2StepMM_E:
#endif
#endif
case Accel_X ... Accel_E:
case Feed_X ... Feed_E:
case Jerk_X ... Jerk_E:
case RunoutToggle:
case PowerLossToggle:
case FanKeyIcon:
case LedToggle:
case e2Preheat: Checkkey = ManualSetTemp; break;
case ProbeOffset_Z: Checkkey = Zoffset_Value; break;
case VolumeDisplay: Checkkey = VolumeDisplay; break;
case DisplayBrightness: Checkkey = DisplayBrightness; break;
case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break;
case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break;
default:
if (WITHIN(recdat.addr, AutolevelVal, AutolevelVal + 2 * (5 * 5 - 1))) // Assuming 5x5 mesh or smaller
Checkkey = AutolevelVal;
else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1)))
Checkkey = Filename;
break;
}
if (Checkkey < 0) {
memset(&recdat, 0, sizeof(recdat));
recdat.head[0] = FHONE;
recdat.head[1] = FHTWO;
return;
}
#if ENABLED(LCD_BED_TRAMMING)
constexpr float lfrb[4] = BED_TRAMMING_INSET_LFRB;
#endif
switch (Checkkey) {
case Printfile: {
if (recdat.data[0] == 1) { // card
show_status = false;
filenavigator.getFiles(0);
fileIndex = 0;
recordcount = 0;
sendData(ExchangePageBase + 46, ExchangepageAddr);
}
else if (recdat.data[0] == 2) { // return after printing result.
show_status = true;
tpShowStatus = false;
stopPrint();
injectCommands(F("M84"));
sendData(11, FilenameIcon);
sendData(0, PrintscheduleIcon);
sendData(0, PrintscheduleIcon + 1);
sendData(0, Percentage);
delay_ms(2);
sendData(0, Timehour);
sendData(0, Timemin);
sendData(ExchangePageBase + 45, ExchangepageAddr); // exchange to 45 page
}
else if (recdat.data[0] == 3) { // Temperature control
show_status = true;
tpShowStatus = false;
if (getTargetFan_percent((fan_t)getActiveTool()) == 0)
sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off
else
sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on
}
else if (recdat.data[0] == 4) { // Settings
show_status = false;
}
} break;
case Adjust: {
if (recdat.data[0] == 1) {
show_status = false;
}
else if (recdat.data[0] == 2) {
show_status = true;
if (printerStatusKey[1] == 3) // during heating
sendData(ExchangePageBase + 53, ExchangepageAddr);
else if (printerStatusKey[1] == 4)
sendData(ExchangePageBase + 54, ExchangepageAddr);
else
sendData(ExchangePageBase + 53, ExchangepageAddr);
}
else if (recdat.data[0] == 3)
setTargetFan_percent(getTargetFan_percent((fan_t)getActiveTool()) != 0 ? 100 : 0, FAN0);
} break;
case Feedrate: {
setFeedrate_percent(recdat.data[0]);
} break;
case PrintChoice: {
if (recdat.addr == Stopprint) {
if (recdat.data[0] == 240) { // no
sendData(ExchangePageBase + 53, ExchangepageAddr);
}
else {
sendData(ExchangePageBase + 45, ExchangepageAddr);
sendData(0, Timehour);
sendData(0, Timemin);
stopPrint();
}
}
else if (recdat.addr == Pauseprint) {
if (recdat.data[0] != 0xF1)
break;
sendData(ExchangePageBase + 54, ExchangepageAddr);
pausePrint();
}
else if (recdat.addr == Resumeprint && recdat.data[0] == 1) {
resumePrint();
printerStatusKey[1] = 0;
show_status = true;
sendData(ExchangePageBase + 53, ExchangepageAddr);
}
if (recdat.addr == Resumeprint && recdat.data[0] == 2) { // warming
resumePrint();
nozzleTempStatus[2] = 1;
printerStatusKey[1] = 0;
show_status = true;
sendData(ExchangePageBase + 82, ExchangepageAddr);
}
} break;
#if HAS_BED_PROBE
case Zoffset: {
float tmp_zprobe_offset;
if (recdat.data[0] >= 32768)
tmp_zprobe_offset = (float(recdat.data[0]) - 65536) / 100;
else
tmp_zprobe_offset = float(recdat.data[0]) / 100;
if (WITHIN(tmp_zprobe_offset, PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, axis_t(Z));
if (tmpSteps == 0) tmpSteps = getZOffset_mm() < tmp_zprobe_offset ? 1 : -1;
smartAdjustAxis_steps(-tmpSteps, axis_t(Z), false);
char zOffs[20], tmp1[11];
sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1));
onStatusChanged(zOffs);
}
else {
onStatusChanged(F("Requested Offset Beyond Limits"));
}
sendData(getZOffset_mm() * 100, ProbeOffset_Z);
} break;
#endif // HAS_BED_PROBE
case TempControl: {
if (recdat.data[0] == 0) {
show_status = true;
tpShowStatus = false;
}
else if (recdat.data[0] == 1) {
if (getTargetFan_percent((fan_t)getActiveTool()) == 0)
sendData(ExchangePageBase + 60, ExchangepageAddr); // exchange to 60 page, the fans off
else
sendData(ExchangePageBase + 59, ExchangepageAddr); // exchange to 59 page, the fans on
}
else if (recdat.data[0] == 2) {
show_status = true;
}
else if (recdat.data[0] == 3) {
if (getTargetFan_percent((fan_t)getActiveTool()) == 0) { // turn on the fan
setTargetFan_percent(100, FAN0);
sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on
}
else { // turn off the fan
setTargetFan_percent(0, FAN0);
sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans on
}
}
else if (recdat.data[0] == 5) { // PLA mode
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, getActiveTool());
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, BED);
sendData(PREHEAT_1_TEMP_HOTEND, NozzlePreheat);
sendData(PREHEAT_1_TEMP_BED, BedPreheat);
}
else if (recdat.data[0] == 6) { // ABS mode
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, getActiveTool());
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, BED);
sendData(PREHEAT_2_TEMP_HOTEND, NozzlePreheat);
sendData(PREHEAT_2_TEMP_BED, BedPreheat);
}
else if (recdat.data[0] == 0xF1) {
//show_status = true;
#if FAN_COUNT > 0
for (uint8_t i = 0; i < FAN_COUNT; i++) setTargetFan_percent(0, (fan_t)i);
#endif
setTargetTemp_celsius(0.0, H0);
TERN_(HAS_MULTI_HOTEND, setTargetTemp_celsius(0.0, H1));
setTargetTemp_celsius(0.0, BED);
sendData(0, NozzlePreheat); delay_ms(1);
sendData(0, BedPreheat); delay_ms(1);
sendData(ExchangePageBase + 57, ExchangepageAddr);
printerStatusKey[1] = 2;
}
} break;
case ManualSetTemp: {
if (recdat.addr == NzBdSet) {
if (recdat.data[0] == 0) {
if (getTargetFan_percent((fan_t)getActiveTool()) == 0)
sendData(ExchangePageBase + 58, ExchangepageAddr); // exchange to 58 page, the fans off
else
sendData(ExchangePageBase + 57, ExchangepageAddr); // exchange to 57 page, the fans on
}
else if (recdat.data[0] == 1) {
setTargetTemp_celsius(0.0, getActiveTool());
sendData(0, NozzlePreheat);
}
else if (recdat.data[0] == 2) {
setTargetTemp_celsius(0.0, BED);
sendData(0, BedPreheat);
}
}
else if (recdat.addr == NozzlePreheat) {
setTargetTemp_celsius(float(recdat.data[0]), H0);
}
#if HAS_MULTI_HOTEND
else if (recdat.addr == e2Preheat) {
setTargetTemp_celsius(float(recdat.data[0]), H1);
}
#endif
else if (recdat.addr == BedPreheat) {
setTargetTemp_celsius(float(recdat.data[0]), BED);
}
else if (recdat.addr == Flowrate) {
setFlow_percent(int16_t(recdat.data[0]), getActiveTool());
}
#if HAS_PID_HEATING
else if (recdat.addr == HotendPID_AutoTmp) {
pid_hotendAutoTemp = uint16_t(recdat.data[0]);
}
else if (recdat.addr == BedPID_AutoTmp) {
pid_bedAutoTemp = uint16_t(recdat.data[0]);
}
#endif
else if (recdat.addr == Accel_X) {
setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, X);
}
else if (recdat.addr == Accel_Y) {
setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 100, Y);
}
else if (recdat.addr == Accel_Z) {
setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]) * 10, Z);
}
else if (recdat.addr == Accel_E) {
setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E0);
setAxisMaxAcceleration_mm_s2(uint16_t(recdat.data[0]), E1);
}
else if (recdat.addr == Feed_X) {
setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), X);
}
else if (recdat.addr == Feed_Y) {
setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Y);
}
else if (recdat.addr == Feed_Z) {
setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), Z);
}
else if (recdat.addr == Feed_E) {
setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E0);
setAxisMaxFeedrate_mm_s(uint16_t(recdat.data[0]), E1);
}
else if (recdat.addr == FanKeyIcon) {
setTargetFan_percent(uint16_t(recdat.data[0]), (fan_t)getActiveTool());
}
else {
float tmp_float_handling = float(recdat.data[0]);
if (tmp_float_handling >= 32768) tmp_float_handling -= 65536;
tmp_float_handling /= 100;
if (false) {}
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
else if (recdat.addr == StepMM_X) {
setAxisSteps_per_mm(tmp_float_handling * 10, X);
}
else if (recdat.addr == StepMM_Y) {
setAxisSteps_per_mm(tmp_float_handling * 10, Y);
}
else if (recdat.addr == StepMM_Z) {
setAxisSteps_per_mm(tmp_float_handling * 10, Z);
}
else if (recdat.addr == StepMM_E) {
setAxisSteps_per_mm(tmp_float_handling * 10, E0);
#if DISABLED(DUAL_X_CARRIAGE)
setAxisSteps_per_mm(tmp_float_handling * 10, E1);
#endif
}
#endif // EDITABLE_STEPS_PER_UNIT
#if ENABLED(DUAL_X_CARRIAGE)
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
else if (recdat.addr == T2StepMM_E) {
setAxisSteps_per_mm(tmp_float_handling * 10, E1);
}
#endif
else if (recdat.addr == T2Offset_X) {
setNozzleOffset_mm(tmp_float_handling * 10, X, E1);
}
else if (recdat.addr == T2Offset_Y) {
setNozzleOffset_mm(tmp_float_handling * 10, Y, E1);
}
else if (recdat.addr == T2Offset_Z) {
setNozzleOffset_mm(tmp_float_handling * 10, Z, E1);
}
#endif
#if HAS_BED_PROBE
else if (recdat.addr == ProbeOffset_X) {
setProbeOffset_mm(tmp_float_handling, X);
}
else if (recdat.addr == ProbeOffset_Y) {
setProbeOffset_mm(tmp_float_handling, Y);
}
else if (recdat.addr == ProbeOffset_Z) {
setProbeOffset_mm(tmp_float_handling, Z);
}
#endif
#if ENABLED(CLASSIC_JERK)
else if (recdat.addr == Jerk_X) {
setAxisMaxJerk_mm_s(tmp_float_handling, X);
}
else if (recdat.addr == Jerk_Y) {
setAxisMaxJerk_mm_s(tmp_float_handling, Y);
}
else if (recdat.addr == Jerk_Z) {
setAxisMaxJerk_mm_s(tmp_float_handling, Z);
}
else if (recdat.addr == Jerk_E) {
setAxisMaxJerk_mm_s(tmp_float_handling, E0);
setAxisMaxJerk_mm_s(tmp_float_handling, E1);
}
#endif
#if HAS_FILAMENT_SENSOR
else if (recdat.addr == RunoutToggle) {
setFilamentRunoutEnabled(!getFilamentRunoutEnabled());
}
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
else if (recdat.addr == PowerLossToggle) {
setPowerLossRecoveryEnabled(!getPowerLossRecoveryEnabled());
}
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
else if (recdat.addr == LedToggle) {
setCaseLightState(!getCaseLightState());
}
#endif
#if HAS_PID_HEATING
else if (recdat.addr == HotendPID_P) {
setPID(tmp_float_handling * 10, getPID_Ki(getActiveTool()), getPID_Kd(getActiveTool()), getActiveTool());
}
else if (recdat.addr == HotendPID_I) {
setPID(getPID_Kp(getActiveTool()), tmp_float_handling * 10, getPID_Kd(getActiveTool()), getActiveTool());
}
else if (recdat.addr == HotendPID_D) {
setPID(getPID_Kp(getActiveTool()), getPID_Ki(getActiveTool()), tmp_float_handling * 10, getActiveTool());
}
#if ENABLED(PIDTEMPBED)
else if (recdat.addr == BedPID_P) {
setBedPID(tmp_float_handling * 10, getBedPID_Ki(), getBedPID_Kd());
}
else if (recdat.addr == BedPID_I) {
setBedPID(getBedPID_Kp(), tmp_float_handling * 10, getBedPID_Kd());
}
else if (recdat.addr == BedPID_D) {
setBedPID(getBedPID_Kp(), getBedPID_Ki(), tmp_float_handling * 10);
}
#endif
#endif // HAS_PID_HEATING
}
} break;
case Setting: {
if (recdat.data[0] == 0) { // return to main page
show_status = true;
tpShowStatus = false;
}
else if (recdat.data[0] == 1) { // Bed Autoleveling
#if HAS_MESH
sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon);
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
const bool zig = outer & 1;
const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer };
sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2);
++abl_probe_index;
}
}
#endif
sendData(10, FilenameIcon); // Motor Icon
injectCommands(isPositionKnown() ? F("G1F1000Z0.0") : F("G28\nG1F1000Z0.0"));
waitway = 2;
sendData(ExchangePageBase + 64, ExchangepageAddr);
}
else if (recdat.data[0] == 2) { // Exchange filament
show_status = true;
tpShowStatus = false;
ZERO(changeMaterialBuf);
changeMaterialBuf[1] = changeMaterialBuf[0] = 10;
sendData(10 * changeMaterialBuf[0], FilamentUnit1); // It's changeMaterialBuf for show, instead of current_position.e in them.
sendData(10 * changeMaterialBuf[1], FilamentUnit2);
sendData(getActualTemp_celsius(H0), NozzleTemp);
sendData(getTargetTemp_celsius(H0), NozzlePreheat);
sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp);
sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat);
delay_ms(2);
sendData(ExchangePageBase + 65, ExchangepageAddr);
}
else if (recdat.data[0] == 3) { // Move
axisPageNum = 0;
sendData(ExchangePageBase + 71, ExchangepageAddr);
}
else if (recdat.data[0] == 4) { // Language
// Just loads language screen, now used for tools
}
else if (recdat.data[0] == 5) { // Printer Information
sendData(WEBSITE_URL, CorpWebsite);
}
else if (recdat.data[0] == 6) { // Diabalestepper
injectCommands(F("M84"));
sendData(11, FilenameIcon);
}
} break;
case ReturnBack: {
if (recdat.data[0] == 1) { // return to the tool page
show_status = false;
sendData(ExchangePageBase + 63, ExchangepageAddr);
}
else if (recdat.data[0] == 2) // return to the Level mode page
sendData(ExchangePageBase + 64, ExchangepageAddr);
} break;
case Bedlevel: {
switch (recdat.data[0]) {
case 1: // Z-axis to home
// Disallow Z homing if X or Y are unknown
injectCommands(isAxisPositionKnown(axis_t(X)) && isAxisPositionKnown(axis_t(Y)) ? F("G28Z\nG1F1500Z0.0") : F("G28\nG1F1500Z0.0"));
sendData(getZOffset_mm() * 100, ProbeOffset_Z);
break;
#if HAS_BED_PROBE
case 2: // Z-axis to Up
if (WITHIN((getZOffset_mm() + 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
smartAdjustAxis_steps(getAxisSteps_per_mm(Z) / 10, axis_t(Z), false);
//setZOffset_mm(getZOffset_mm() + 0.1);
sendData(getZOffset_mm() * 100, ProbeOffset_Z);
onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
}
break;
case 3: // Z-axis to Down
if (WITHIN((getZOffset_mm() - 0.1), PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX)) {
smartAdjustAxis_steps(-getAxisSteps_per_mm(Z) / 10, axis_t(Z), false);
//babystepAxis_steps(int16_t(-getAxisSteps_per_mm(Z)) / 10, axis_t(Z));
//setZOffset_mm(getZOffset_mm() - 0.1);
sendData(getZOffset_mm() * 100, ProbeOffset_Z);
onStatusChanged(MString<20>(GET_TEXT_F(MSG_UBL_Z_OFFSET), p_float_t(getZOffset_mm(), 3)));
}
break;
#endif // HAS_BED_PROBE
case 4: // Assistant Level
TERN_(HAS_MESH, setLevelingActive(false));
injectCommands(isPositionKnown() ? F("G1 F1000 Z0.0") : F("G28\nG1 F1000 Z0.0"));
waitway = 2;
sendData(ExchangePageBase + 84, ExchangepageAddr);
break;
case 5: { // AutoLevel "Measuring" Button
#if ENABLED(MESH_BED_LEVELING)
sendData(ExchangePageBase + 93, ExchangepageAddr);
#else
waitway = 3; // Only for prohibiting to receive message
sendData(3, AutolevelIcon);
uint8_t abl_probe_index = 0;
while (abl_probe_index < 25) {
sendData(0, AutolevelVal + abl_probe_index * 2);
++abl_probe_index;
}
sendData(ExchangePageBase + 64, ExchangepageAddr);
injectCommands(F(MEASURING_GCODE));
#endif
} break;
#if ENABLED(LCD_BED_TRAMMING)
case 6: // Bed Tramming, Centre 1
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_CENTER, axis_t(X));
setAxisPosition_mm(Y_CENTER, axis_t(Y));
waitway = 6;
break;
case 7: // Bed Tramming, Front Left 2
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6;
break;
case 8: // Bed Tramming, Front Right 3
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6;
break;
case 9: // Bed Tramming, Back Right 4
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6;
break;
case 10: // Bed Tramming, Back Left 5
setAxisPosition_mm(BED_TRAMMING_Z_HOP, axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6;
break;
#endif // LCD_BED_TRAMMING
case 11: { // Autolevel switch
#if HAS_MESH
const bool gla = !getLevelingActive();
setLevelingActive(gla);
sendData(gla ? 3 : 2, AutoLevelIcon);
#endif
#if HAS_BED_PROBE
sendData(getZOffset_mm() * 100, ProbeOffset_Z);
#endif
} break;
#if ENABLED(G26_MESH_VALIDATION)
case 12:
injectCommands(F("G26R255"));
onStatusChanged(F("Beginning G26.. Heating"));
break;
#endif
#if ENABLED(MESH_BED_LEVELING)
case 13:
injectCommands(F("G29S1"));
onStatusChanged(F("Begin Manual Mesh"));
break;
case 14:
injectCommands(F("G29S2"));
onStatusChanged(F("Moving to Next Mesh Point"));
break;
#endif
case 15:
injectCommands(F("M211S0\nG91\nG1Z-0.025\nG90\nM211S1"));
onStatusChanged(F("Moved down 0.025"));
break;
case 16:
injectCommands(F("M211S0\nG91\nG1Z0.025\nG90\nM211S1"));
onStatusChanged(F("Moved up 0.025"));
break;
case 17:
dwin_settings.display_volume = 0;
dwin_settings.display_sound = false;
setTouchScreenConfiguration();
break;
case 18:
dwin_settings.display_volume = 255;
dwin_settings.display_sound = true;
setTouchScreenConfiguration();
break;
case 19:
dwin_settings.screen_brightness = 10;
setTouchScreenConfiguration();
break;
case 20:
dwin_settings.screen_brightness = 100;
setTouchScreenConfiguration();
break;
case 21:
dwin_settings.display_standby ^= true;
setTouchScreenConfiguration();
break;
case 22:
dwin_settings.screen_rotation = 10 - dwin_settings.screen_rotation == 10 ? 0 : 10;
setTouchScreenConfiguration();
break;
case 23: // Set IDEX Autopark
injectCommands(F("M605S1\nG28X\nG1X0"));
break;
case 24: // Set IDEX Duplication
injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0"));
break;
case 25: // Set IDEX Mirrored Duplication
injectCommands(F("M605S1\nT0\nG28\nM605S2\nG28X\nG1X0\nM605S3"));
break;
case 26: // Set IDEX Full Control
injectCommands(F("M605S0\nG28X"));
break;
case 27: // Change Tool
setActiveTool(getActiveTool() == E0 ? E1 : E0, !isAxisPositionKnown(X));
break;
default: break;
}
sendData(10, FilenameIcon);
} break;
case XYZEaxis: {
axis_t axis = X;
float min = 0.0f, max = 0.0f;
waitway = 4;
if (recdat.addr == DisplayXaxis) {
axis = X; min = X_MIN_POS; max = X_MAX_POS;
}
else if (recdat.addr == DisplayYaxis) {
axis = Y; min = Y_MIN_POS; max = Y_MAX_POS;
}
else if (recdat.addr == DisplayZaxis) {
axis = Z; min = Z_MIN_POS; max = Z_MAX_POS;
}
else if (recdat.addr == AutoZero) {
if (recdat.data[0] == 3) { // autohome
waitway = 4;
injectCommands(F("G28\nG1 F1000 Z10"));
show_status = autoHomeKey = true;
autoHomeIconNum = 0;
sendData(10, FilenameIcon);
}
else {
axisPageNum = recdat.data[0];
waitway = 0;
}
} break;
float targetPos = float(recdat.data[0]) / 10;
LIMIT(targetPos, min, max);
setAxisPosition_mm(targetPos, axis);
waitway = 0;
sendData(10, FilenameIcon);
} break;
case Filament: {
uint16_t IconTemp;
if (recdat.addr == Exchfilament) {
if (getActualTemp_celsius(getActiveTool()) < EXTRUDE_MINTEMP && recdat.data[0] < 5) {
sendData(int16_t(EXTRUDE_MINTEMP), 0x1020);
delay_ms(5);
sendData(ExchangePageBase + 66, ExchangepageAddr);
break;
}
switch (recdat.data[0]) {
case 1: // Unload filament1
setAxisPosition_mm(getAxisPosition_mm(E0) - changeMaterialBuf[0], E0);
break;
case 2: // Load filament1
setAxisPosition_mm(getAxisPosition_mm(E0) + changeMaterialBuf[0], E0);
break;
case 3: // Unload filament2
setAxisPosition_mm(getAxisPosition_mm(E1) - changeMaterialBuf[1], E1);
break;
case 4: // Load filament2
setAxisPosition_mm(getAxisPosition_mm(E1) + changeMaterialBuf[1], E1);
break;
case 5: // sure to heat
nozzleTempStatus[0] = 1;
setTargetTemp_celsius((PREHEAT_1_TEMP_HOTEND + 10), getActiveTool());
IconTemp = getActualTemp_celsius(getActiveTool()) * 100 / getTargetTemp_celsius(getActiveTool());
NOMORE(IconTemp, 100U);
sendData(IconTemp, HeatPercentIcon);
sendData(getActualTemp_celsius(H0), NozzleTemp);
sendData(getTargetTemp_celsius(H0), NozzlePreheat);
sendData(TERN0(HAS_MULTI_HOTEND, getActualTemp_celsius(H1)), e2Temp);
sendData(TERN0(HAS_MULTI_HOTEND, getTargetTemp_celsius(H1)), e2Preheat);
delay_ms(5);
sendData(ExchangePageBase + 68, ExchangepageAddr);
break;
case 6: // cancel to heat
sendData(ExchangePageBase + 65, ExchangepageAddr);
break;
case 0xF1: // Sure to cancel heating
nozzleTempStatus[0] = 0;
delay_ms(1);
sendData(ExchangePageBase + 65, ExchangepageAddr);
break;
case 0xF0: // not to cancel heating
break;
}
sendData(10 * changeMaterialBuf[0], FilamentUnit1); // It's changeMaterialBuf for show, instead of current_position.e in them.
sendData(10 * changeMaterialBuf[1], FilamentUnit2);
}
else if (recdat.addr == FilamentUnit1) {
changeMaterialBuf[0] = float(recdat.data[0]) / 10;
}
else if (recdat.addr == FilamentUnit2) {
changeMaterialBuf[1] = float(recdat.data[0]) / 10;
}
} break;
case LanguageChoice: {
//if (recdat.data[0] == 1) settings.save(); else injectCommands(F("M300"));
// may at some point use language change screens to save eeprom explicitly
switch (recdat.data[0]) {
case 0:
injectCommands(F("M500"));
break;
case 1:
sendData(ExchangePageBase + 94, ExchangepageAddr);
break;
#if ENABLED(PIDTEMP)
case 2:
onStatusChanged(F("Hotend PID Started"));
startPIDTune(static_cast<celsius_t>(pid_hotendAutoTemp), getActiveTool());
break;
#endif
case 3:
injectCommands(F("M502\nM500"));
break;
case 4:
injectCommands(F("M999\nM280P0S160"));
break;
#if ENABLED(PIDTEMPBED)
case 5:
onStatusChanged(F("Bed PID Started"));
startBedPIDTune(static_cast<celsius_t>(pid_bedAutoTemp));
break;
#endif
case 6:
injectCommands(F("M500"));
break;
default: break;
}
} break;
case No_Filament: {
if (recdat.data[0] == 1) { // Filament is out, resume / resume selected on screen
if (ExtUI::pauseModeStatus != PAUSE_MESSAGE_PURGE && ExtUI::pauseModeStatus != PAUSE_MESSAGE_OPTION) {
// setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
setUserConfirmed();
// printerStatusKey[1] = 3;
// pause_resume_selected = true;
}
else {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
bool runouton = false;
if (getFilamentRunoutState()) {
#if NUM_RUNOUT_SENSORS > 1
if ((runouton = getFilamentRunoutEnabled(getActiveTool())))
ExtUI::setFilamentRunoutEnabled(false, getActiveTool());
#else
if ((runouton = getFilamentRunoutEnabled()))
ExtUI::setFilamentRunoutEnabled(false);
#endif
}
#else
constexpr bool runouton = false;
#endif
if (!runouton) {
setPauseMenuResponse(PAUSE_RESPONSE_RESUME_PRINT);
setUserConfirmed();
printerStatusKey[1] = 3;
pause_resume_selected = true;
}
}
}
else if (recdat.data[0] == 0) { // Filamet is out, Cancel Selected
if (ExtUI::pauseModeStatus == PAUSE_MESSAGE_PURGE || ExtUI::pauseModeStatus == PAUSE_MESSAGE_OPTION) {
setPauseMenuResponse(PAUSE_RESPONSE_EXTRUDE_MORE);
setUserConfirmed();
}
}
} break;
#if ENABLED(POWER_LOSS_RECOVERY)
case PwrOffNoF:
if (recdat.data[0] == 1) // Yes: continue to print the 3Dmode during power-off.
injectCommands(F("M1000"));
else if (recdat.data[0] == 2) // No
injectCommands(F("M1000C"));
break;
#endif
case Volume: {
dwin_settings.display_volume = constrain(recdat.data[0], 0, 255);
if (dwin_settings.display_volume == 0) {
sendData(0, VolumeIcon);
sendData(9, SoundIcon);
}
else {
sendData((dwin_settings.display_volume + 1) / 32 - 1, VolumeIcon);
sendData(8, SoundIcon);
}
sendData(dwin_settings.display_volume << 8, SoundAddr + 1);
} break;
case Filename: {
if (isMediaInserted() && recdat.addr == FilenameChs) {
recordcount = recdat.data[0] - 1;
if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) {
filenavigator.upDIR();
filenavigator.getFiles(0);
fileIndex = 0;
return;
}
if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0)
recordcount = recordcount - 1; // account for return dir link in file index
for (int16_t j = 1; j <= 4; j++) { // Clear filename BG Color and Frame
sendData(0xFFFFUL, FilenameNature + j * 16); // white
sendData(10, FilenameIcon1 + j); // clean
}
for (int16_t j = 0; j < 10; j++) // clear current filename
sendData(0, Choosefilename + j);
if (filenavigator.getIndexisDir(fileIndex + recordcount)) {
filenavigator.changeDIR((char *)filenavigator.getIndexName(fileIndex + recordcount));
filenavigator.getFiles(0);
fileIndex = 0;
return;
}
else {
sendData(filenavigator.getIndexName(fileIndex + recordcount), Choosefilename);
sendData(0x87F0UL, FilenameNature + recdat.data[0] * 16); // Change BG of selected line to Light Green
sendData(6, FilenameIcon1 + recdat.data[0]); // show frame
}
}
else if (recdat.addr == FilenamePlay) {
if (recdat.data[0] == 1 && isMediaInserted()) { // for sure
printFile(filenavigator.getIndexName(fileIndex + recordcount));
for (int16_t j = 0; j < 10; j++) // clean screen.
sendData(0, Printfilename + j);
sendData(filenavigator.getIndexName(fileIndex + recordcount), Printfilename);
delay_ms(4);
sendData(ExchangePageBase + 53, ExchangepageAddr);
tpShowStatus = show_status = true;
printerStatusKey[0] = 1;
printerStatusKey[1] = 3;
fileIndex = 0;
recordcount = 0;
}
else if (recdat.data[0] == 2) { // Page Down
if ((fileIndex + DISPLAY_FILES) < (filenavigator.maxFiles() + (filenavigator.folderdepth != 0))) {
fileIndex = fileIndex + DISPLAY_FILES;
// if (filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page
// filenavigator.getFiles(fileIndex-1);
// else
filenavigator.getFiles(fileIndex);
// filenavigator.getFiles(filenavigator.currentindex+1);
}
}
else if (recdat.data[0] == 3) { // Page Up
if (fileIndex >= DISPLAY_FILES) {
fileIndex = fileIndex - DISPLAY_FILES;
// if (filenavigator.folderdepth!=0 && fileIndex!=0) //Shift to acknowledge Return DIR button on first page
// filenavigator.getFiles(filenavigator.currentindex-DISPLAY_FILES);
// else
filenavigator.getFiles(fileIndex);
}
}
else if (recdat.data[0] == 4) { // Page Up
injectCommands(F("M22\nM21"));
}
else if (recdat.data[0] == 0) { // return to main page
show_status = true;
tpShowStatus = false;
}
}
} break;
case VolumeDisplay: {
if (recdat.data[0] == 0) {
dwin_settings.display_volume = 0;
dwin_settings.display_sound = false;
}
else if (recdat.data[0] > 100) {
dwin_settings.display_volume = 255;
dwin_settings.display_sound = true;
}
else {
dwin_settings.display_volume = (uint8_t)map(constrain(recdat.data[0], 0, 100), 0, 100, 0, 255);
dwin_settings.display_sound = true;
}
setTouchScreenConfiguration();
} break;
case DisplayBrightness: {
if (recdat.data[0] < 10)
dwin_settings.screen_brightness = 10;
else if (recdat.data[0] > 100)
dwin_settings.screen_brightness = 100;
else
dwin_settings.screen_brightness = (uint8_t)recdat.data[0];
setTouchScreenConfiguration();
} break;
case DisplayStandbyBrightness: {
if (recdat.data[0] < 10)
dwin_settings.standby_brightness = 10;
else if (recdat.data[0] > 100)
dwin_settings.standby_brightness = 100;
else
dwin_settings.standby_brightness = (uint8_t)recdat.data[0];
setTouchScreenConfiguration();
} break;
case DisplayStandbySeconds: {
if (recdat.data[0] < 5)
dwin_settings.standby_time_seconds = 5;
else if (recdat.data[0] > 100)
dwin_settings.standby_time_seconds = 100;
else
dwin_settings.standby_time_seconds = (uint8_t)recdat.data[0];
setTouchScreenConfiguration();
} break;
case AutolevelVal: {
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2,
yPnt = meshPoint / (GRID_MAX_POINTS_X),
xPnt = meshPoint - yPnt * (GRID_MAX_POINTS_X);
if (yPnt % 2 != 0) xPnt = (GRID_MAX_POINTS_X) - 1 - xPnt; // zag row
float meshVal = float(recdat.data[0] - (recdat.data[0] >= 32768 ? 65536 : 0)) / 1000;
LIMIT(meshVal, Z_PROBE_LOW_POINT, Z_CLEARANCE_BETWEEN_PROBES);
xy_uint8_t point = { xPnt, yPnt };
setMeshPoint(point, meshVal);
sendData(meshVal * 1000, recdat.addr);
} break;
default: break;
}
memset(&recdat, 0, sizeof(recdat));
recdat.head[0] = FHONE;
recdat.head[1] = FHTWO;
}
void RTS::writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr/*=false*/, const char fillChar/*=' '*/) {
const char* myvalues = static_cast<const char*>(values);
bool strend = !myvalues;
DWIN_SERIAL.write(FHONE);
DWIN_SERIAL.write(FHTWO);
DWIN_SERIAL.write(valueslen + 3);
DWIN_SERIAL.write(0x82);
DWIN_SERIAL.write(adr >> 8);
DWIN_SERIAL.write(adr & 0xFF);
while (valueslen--) {
char x;
if (!strend) x = *myvalues++;
if ((isstr && !x) || strend) {
strend = true;
x = fillChar;
}
DWIN_SERIAL.write(x);
}
}
void RTS::setTouchScreenConfiguration() {
// Main configuration (System_Config)
LIMIT(dwin_settings.screen_brightness, 10, 100); // Prevent a possible all-dark screen
LIMIT(dwin_settings.standby_time_seconds, 10, 655); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation
uint8_t cfg_bits = (0x0
| _BV(7) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7))
| _BV(5) // 5: load 22 touch file
| _BV(4) // 4: auto-upload should always be enabled
| (dwin_settings.display_sound ? _BV(3) : 0) // 3: audio
| (dwin_settings.display_standby ? _BV(2) : 0) // 2: backlight on standby
| (dwin_settings.screen_rotation == 10 ? _BV(1) : 0) // 1 & 0: Inversion
#if LCD_SCREEN_ROTATE == 90
| _BV(0) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display
#elif LCD_SCREEN_ROTATE
#error "Only 90° rotation is supported for the selected LCD."
#endif
);
const uint8_t config_set[] = { 0x5A, 0x00, TERN(DWINOS_4, 0x00, 0xFF), cfg_bits };
writeVariable(0x80 /*System_Config*/, config_set, sizeof(config_set));
// Standby brightness (LED_Config)
uint16_t dwinStandbyTimeSeconds = 100 * dwin_settings.standby_time_seconds; /* milliseconds, but divided by 10 (not 5 like the docs say) */
const uint8_t brightness_set[] = {
dwin_settings.screen_brightness /*% active*/,
dwin_settings.standby_brightness /*% standby*/,
static_cast<uint8_t>(dwinStandbyTimeSeconds >> 8),
static_cast<uint8_t>(dwinStandbyTimeSeconds)
};
writeVariable(0x82 /*LED_Config*/, brightness_set, sizeof(brightness_set));
if (!dwin_settings.display_sound) {
sendData(0, VolumeIcon);
sendData(9, SoundIcon);
}
else {
sendData((dwin_settings.display_volume + 1) / 32 - 1, VolumeIcon);
sendData(8, SoundIcon);
}
sendData(dwin_settings.display_volume, VolumeIcon - 2);
sendData(dwin_settings.display_volume << 8, SoundAddr + 1);
sendData(map(constrain(dwin_settings.display_volume, 0, 255), 0, 255, 0, 100), VolumeDisplay);
sendData(dwin_settings.screen_brightness, DisplayBrightness);
sendData(dwin_settings.standby_brightness, DisplayStandbyBrightness);
sendData(dwin_settings.standby_time_seconds, DisplayStandbySeconds);
sendData(dwin_settings.display_standby ? 3 : 2, DisplayStandbyEnableIndicator);
}
#endif // DGUS_LCD_UI_IA_CREALITY
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
|
C++
|
agpl-3.0
| 60,414
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2022 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
/* ****************************************
* lcd/extui/ia_creality/ia_creality_rts.h
* ****************************************
* Extensible_UI implementation for Creality DWIN
* 10SPro, Max, CRX, and others
* Based original Creality release
* Written by Insanity Automation, sponsored by Tiny Machines 3D
*
* ***************************************/
#include "../../../inc/MarlinConfig.h"
#include <WString.h>
/*********************************/
#define FHONE (0x5A)
#define FHTWO (0xA5)
#define FHLENG (0x06)
#define TEXTBYTELEN 18
#define MaxFileNumber 20 // 16
#define CEIconGrap 12
#define FileNum MaxFileNumber
#define FileNameLen TEXTBYTELEN
#define DATA_BUF_SIZE 46
//#define FONT_EEPROM 90
//#define AutoLeve_EEPROM 100
//#define FanOn 255
#define FanOff 0
#define ExchangePageBase 0x5A010000UL // the first page ID. other page = first page ID + relevant num;
#define StartSoundSet 0x060480A0UL // 06,start-music; 04, 4 musics; 80, the volume value; 04, return value about music number.
// Register addresses
#define RegAddr_W 0x80
#define RegAddr_R 0x81
#define VarAddr_W 0x82
#define VarAddr_R 0x83
// Variable addresses
#define ExchangepageAddr 0x0084
#define SoundAddr 0x00A0
#define StartIcon 0x1000
#define FeedrateDisplay 0x1006 // Speed
#define Stopprint 0x1008
#define Pauseprint 0x100A
#define Resumeprint 0x100C
#define PrintscheduleIcon 0x100E
#define Timehour 0x1010
#define Timemin 0x1012
#define IconPrintstatus 0x1014
#define Percentage 0x1016
#define FanKeyIcon 0x101E
#define Flowrate 0x1300
#define RunoutToggle 0x1018
#define PowerLossToggle 0x101A
#define LedToggle 0x101C
#define StepMM_X 0x1242
#define StepMM_Y 0x1246
#define StepMM_Z 0x124A
#define StepMM_E 0x124E
#define ProbeOffset_X 0x1236
#define ProbeOffset_Y 0x123A
#define ProbeOffset_Z 0x1026
#define T2Offset_X 0x1090
#define T2Offset_Y 0x1092
#define T2Offset_Z 0x1094
#define T2StepMM_E 0x1096
#define ActiveToolVP 0x1014
#define HotendPID_AutoTmp 0x1252
#define BedPID_AutoTmp 0x1254
#define HotendPID_P 0x1256
#define HotendPID_I 0x125A
#define HotendPID_D 0x125E
#define BedPID_P 0x1262
#define BedPID_I 0x1266
#define BedPID_D 0x126A
#define Jerk_X 0x1270
#define Jerk_Y 0x1272
#define Jerk_Z 0x1274
#define Jerk_E 0x1276
#define Feed_X 0x1278
#define Feed_Y 0x127A
#define Feed_Z 0x127C
#define Feed_E 0x127E
#define Accel_X 0x1280
#define Accel_Y 0x1282
#define Accel_Z 0x1284
#define Accel_E 0x1286
#define HeatPercentIcon 0x1024
#define NzBdSet 0x1032 // cooldown Hotend and Bed
#define NozzlePreheat 0x1034 // setpoint
#define NozzleTemp 0x1036 // Actual
#define BedPreheat 0x103A // Setpoint
#define Bedtemp 0x103C // Actual
#define e2Temp 0x1050
#define e2Preheat 0x104E
#define AutoZeroIcon 0x1042
#define AutoLevelIcon 0x1045
#define AutoZero 0x1046
#define DisplayXaxis 0x1048
#define DisplayYaxis 0x104A
#define DisplayZaxis 0x104C
#define FilamentUnit1 0x1054
#define Exchfilament 0x1056
#define FilamentUnit2 0x1058
#define MacVersion 0x1060
#define SoftVersion 0x106A
#define PrinterSize 0x1074
#define CorpWebsite 0x107E
#define VolumeIcon 0x108A
#define SoundIcon 0x108C
#define AutolevelIcon 0x108D
#define ExchFlmntIcon 0x108E
#define AutolevelVal 0x1100
#define FilenameIcon 0x1200
#define FilenameIcon1 0x1220
#define Printfilename 0x2000
#define FilesCurentPage 0x1310
#define FilesMaxPage 0x1312
#define SDFILE_ADDR 0x200A
#define FilenamePlay 0x20D2
#define FilenameChs 0x20D3
#define Choosefilename 0x20D4
#define FilenameCount 0x20DE
#define FilenameNature 0x6003
#define VolumeDisplay 0x1140
#define DisplayBrightness 0x1142
#define DisplayStandbyBrightness 0x1144
#define DisplayStandbyEnableIndicator 0x1146
#define DisplayStandbySeconds 0x1148
#define StatusMessageString 0x2064
// TODO: Use LCD_SERIAL 1 or 3 (?) by configuration, not overriding here
#ifdef TARGET_STM32F4
#define DWIN_SERIAL Serial1
#else
#define DWIN_SERIAL LCD_SERIAL
#endif
/************struct**************/
typedef enum : uint8_t {
DGUS_IDLE, //< waiting for DGUS_HEADER1.
DGUS_HEADER1_SEEN, //< DGUS_HEADER1 received
DGUS_HEADER2_SEEN, //< DGUS_HEADER2 received
DGUS_WAIT_TELEGRAM, //< LEN received, Waiting for to receive all bytes.
} rx_datagram_state_t;
typedef struct DataBuf {
uint8_t len;
uint8_t head[2];
uint8_t command;
uint32_t addr;
uint32_t bytelen;
uint16_t data[32];
uint8_t reserv[4];
} DB;
struct creality_dwin_settings_t {
size_t settings_size;
uint8_t settings_version;
bool display_standby;
bool display_sound;
int8_t screen_rotation;
int16_t display_volume;
uint8_t standby_brightness;
uint8_t screen_brightness;
int16_t standby_time_seconds;
};
class RTS {
public:
RTS();
static void onStartup();
static void onIdle();
static int16_t receiveData();
static void sendData();
static void sendData(const String&, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(const char[], const uint32_t, const uint8_t=VarAddr_W);
static void sendData(char, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(int, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(unsigned long, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(const_float_t, const uint32_t, const uint8_t=VarAddr_W);
static void sendData(uint8_t * const str, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((char *)str, addr, cmd); }
static void sendData(const unsigned int n, uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData(int(n), addr, cmd); }
static void sendData(const long n, const uint32_t addr, const uint8_t cmd=VarAddr_W) { sendData((unsigned long)n, addr, cmd); }
static void handleData();
static void writeVariable(const uint16_t adr, const void * const values, uint8_t valueslen, const bool isstr=false, const char fillChar=' ');
static void setTouchScreenConfiguration();
static DB recdat, snddat;
static uint8_t databuf[DATA_BUF_SIZE];
static rx_datagram_state_t rx_datagram_state;
static uint8_t rx_datagram_len;
};
extern RTS rts;
#define Addvalue 3
#define PrintChoice_Value (0 + Addvalue)
#define Zoffset_Value (3 + Addvalue)
#define Setting_Value (8 + Addvalue)
#define XYZEaxis_Value (12 + Addvalue)
#define Filament_Value (15 + Addvalue)
#define Language_Value (18 + Addvalue)
#define Filename_Value (22 + Addvalue)
enum PROC_COM {
Printfile = 0,
Adjust,
Feedrate,
PrintChoice = PrintChoice_Value,
Zoffset = Zoffset_Value,
TempControl,
ManualSetTemp,
Setting = Setting_Value,
ReturnBack,
Bedlevel,
Autohome,
XYZEaxis = XYZEaxis_Value,
Filament = Filament_Value,
LanguageChoice = Language_Value,
No_Filament,
PwrOffNoF,
Volume,
Filename = Filename_Value
};
const uint16_t Addrbuf[] = {
0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A,
0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058,
0x105C, 0x105E, 0x105F, 0x1088, 0
};
void RTS_Update();
#ifndef MAIN_MENU_ITEM_1_GCODE
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29\nM400\nM104S215\nG28\nM109S215\nM420S1\nG1X100Y100F5000\nG1Z0\nM500\nM117 Set Z Offset"
#elif ENABLED(AUTO_BED_LEVELING_UBL)
#define MEASURING_GCODE "M190S55\nG28O\nG34\nG29P1\nG29P3\nG29S1\nG29S0\nG29F0.0\nG29A\nM104S215\nG28\nM109S215\nG1X150Y150F5000\nG1Z0\nM500\nM400\nM117 Set Z Offset"
#else
#define MEASURING_GCODE "G28"
#endif
#else
#define MEASURING_GCODE MAIN_MENU_ITEM_1_GCODE
#endif
// Data shared by RTS and ExtUI
extern uint16_t fileIndex;
extern uint8_t recordcount;
extern uint8_t startprogress;
extern char waitway;
extern char printerStatusKey[2]; // [0] = 0:ready [1] = 0:keep temperature, 1:heating, 2:cooling, 3:printing
extern bool show_status;
extern bool tpShowStatus; // true: opening time/percentage, false: closing time/percentage
extern uint8_t lastPauseMsgState;
extern creality_dwin_settings_t dwin_settings;
extern bool no_reentry;
#if HAS_PID_HEATING
extern uint16_t pid_hotendAutoTemp;
extern uint16_t pid_bedAutoTemp;
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h
|
C++
|
agpl-3.0
| 9,899
|
/**
* 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/malyan/malyan.cpp
*
* LCD implementation for Malyan's LCD, a separate ESP8266 MCU running
* on Serial1 for the M200 board. This module outputs a pseudo-G-code
* wrapped in curly braces which the LCD implementation translates into
* actual G-code commands.
*
* Added to Marlin for Mini/Malyan M200
* Unknown commands as of Jan 2018: {H:}
* Not currently implemented:
* {E:} when sent by LCD. Meaning unknown.
*
* Notes for connecting to boards that are not Malyan:
* The LCD is 3.3v, so if powering from a RAMPS 1.4 board or
* other 5v/12v board, use a buck converter to power the LCD and
* the 3.3v side of a logic level shifter. Aux1 on the RAMPS board
* has Serial1 and 12v, making it perfect for this.
* Copyright (c) 2017 Jason Nelson (xC0000005)
*/
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(MALYAN_LCD)
//#define DEBUG_MALYAN_LCD
#include "malyan.h"
#include "../ui_api.h"
#include "../../marlinui.h"
#include "../../../sd/cardreader.h"
#include "../../../module/temperature.h"
#include "../../../module/stepper.h"
#include "../../../module/motion.h"
#include "../../../libs/duration_t.h"
#include "../../../module/printcounter.h"
#include "../../../gcode/queue.h"
#define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
#include "../../../core/debug_out.h"
// This is based on longest sys command + a filename, plus some buffer
// in case we encounter some data we don't recognize
// There is no evidence a line will ever be this long, but better safe than sorry
#define MAX_CURLY_COMMAND (32 + LONG_FILENAME_LENGTH) * 2
// Track incoming command bytes from the LCD
uint16_t inbound_count;
// For sending print completion messages
bool last_printing_status = false;
// Everything written needs the high bit set.
void write_to_lcd(FSTR_P const fmsg) {
PGM_P pmsg = FTOP(fmsg);
char encoded_message[MAX_CURLY_COMMAND];
uint8_t message_length = _MIN(strlen_P(pmsg), sizeof(encoded_message));
for (uint8_t i = 0; i < message_length; ++i)
encoded_message[i] = pgm_read_byte(&pmsg[i]) | 0x80;
LCD_SERIAL.Print::write(encoded_message, message_length);
}
void write_to_lcd(const char * const cmsg) {
char encoded_message[MAX_CURLY_COMMAND];
const uint8_t message_length = _MIN(strlen(cmsg), sizeof(encoded_message));
for (uint8_t i = 0; i < message_length; ++i)
encoded_message[i] = cmsg[i] | 0x80;
LCD_SERIAL.Print::write(encoded_message, message_length);
}
// {E:<msg>} is for error states.
void set_lcd_error(FSTR_P const error, FSTR_P const component/*=nullptr*/) {
write_to_lcd(F("{E:"));
write_to_lcd(error);
if (component) {
write_to_lcd(F(" "));
write_to_lcd(component);
}
write_to_lcd(F("}"));
}
/**
* Process an LCD 'C' command.
* These are currently all temperature commands
* {C:T0190}
* Set temp for hotend to 190
* {C:P050}
* Set temp for bed to 50
*
* {C:S09} set feedrate to 90 %.
* {C:S12} set feedrate to 120 %.
*
* the command portion begins after the :
*/
void process_lcd_c_command(const char *command) {
const int target_val = command[1] ? atoi(command + 1) : -1;
if (target_val < 0) {
DEBUG_ECHOLNPGM("UNKNOWN C COMMAND ", command);
return;
}
switch (command[0]) {
case 'C': // Cope with both V1 early rev and later LCDs.
case 'S':
feedrate_percentage = target_val * 10;
LIMIT(feedrate_percentage, SPEED_EDIT_MIN, SPEED_EDIT_MAX);
break;
case 'T':
// Sometimes the LCD will send commands to turn off both extruder and bed, though
// this should not happen since the printing screen is up. Better safe than sorry.
if (!print_job_timer.isRunning() || target_val > 0)
ExtUI::setTargetTemp_celsius(target_val, ExtUI::extruder_t::E0);
break;
#if HAS_HEATED_BED
case 'P': ExtUI::setTargetTemp_celsius(target_val, ExtUI::heater_t::BED); break;
#endif
default: DEBUG_ECHOLNPGM("UNKNOWN C COMMAND ", command);
}
}
/**
* Process an LCD 'B' command.
* {B:0} results in: {T0:008/195}{T1:000/000}{TP:000/000}{TQ:000C}{TT:000000}
* T0/T1 are hot end temperatures, TP is bed, TQ is percent, and TT is probably
* time remaining (HH:MM:SS). The UI can't handle displaying a second hotend,
* but the stock firmware always sends it, and it's always zero.
*/
void process_lcd_eb_command(const char *command) {
char elapsed_buffer[10];
static uint8_t iteration = 0;
duration_t elapsed;
switch (command[0]) {
case '0': {
elapsed = print_job_timer.duration();
sprintf_P(elapsed_buffer, PSTR("%02u%02u%02u"), uint16_t(elapsed.hour()), uint16_t(elapsed.minute()) % 60, uint16_t(elapsed.second()) % 60);
char message_buffer[MAX_CURLY_COMMAND];
uint8_t done_pct = print_job_timer.isRunning() ? (iteration * 10) : 100;
iteration = (iteration + 1) % 10; // Provide progress animation
#if HAS_MEDIA
if (ExtUI::isPrintingFromMedia() || ExtUI::isPrintingFromMediaPaused())
done_pct = card.percentDone();
#endif
sprintf_P(message_buffer,
PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}{TQ:%03i}{TT:%s}"),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_HEATED_BED
thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
#else
0, 0,
#endif
TERN(HAS_MEDIA, done_pct, 0),
elapsed_buffer
);
write_to_lcd(message_buffer);
} break;
default: DEBUG_ECHOLNPGM("UNKNOWN E/B COMMAND ", command);
}
}
/**
* Process an LCD 'J' command.
* These are currently all movement commands.
* The command portion begins after the :
* Move X Axis
*
* {J:E}{J:X-200}{J:E}
* {J:E}{J:X+200}{J:E}
* X, Y, Z, A (extruder)
*/
template<typename T>
void j_move_axis(const char *command, const T axis) {
const float dist = atof(command + 1) / 10.0;
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(axis) + dist, axis);
};
void process_lcd_j_command(const char *command) {
switch (command[0]) {
case 'E': break;
case 'A': j_move_axis<ExtUI::extruder_t>(command, ExtUI::extruder_t::E0); break;
case 'Y': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Y); break;
case 'Z': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::Z); break;
case 'X': j_move_axis<ExtUI::axis_t>(command, ExtUI::axis_t::X); break;
default: DEBUG_ECHOLNPGM("UNKNOWN J COMMAND ", command);
}
}
/**
* Process an LCD 'P' command, related to homing and printing.
* Cancel:
* {P:X}
*
* Home all axes:
* {P:H}
*
* Print a file:
* {P:000}
* The File number is specified as a three digit value.
* Printer responds with:
* {PRINTFILE:Mini_SNES_Bottom.gcode}
* {SYS:BUILD}echo:Now fresh file: Mini_SNES_Bottom.gcode
* File opened: Mini_SNES_Bottom.gcode Size: 5805813
* File selected
* {SYS:BUILD}
* T:-2526.8 E:0
* T:-2533.0 E:0
* T:-2537.4 E:0
* Note only the curly brace stuff matters.
*/
void process_lcd_p_command(const char *command) {
switch (command[0]) {
case 'P':
ExtUI::pausePrint();
write_to_lcd(F("{SYS:PAUSED}"));
break;
case 'R':
ExtUI::resumePrint();
write_to_lcd(F("{SYS:RESUMED}"));
break;
case 'X':
write_to_lcd(F("{SYS:CANCELING}"));
ExtUI::stopPrint();
write_to_lcd(F("{SYS:STARTED}"));
break;
case 'H': queue.enqueue_now_P(G28_STR); break; // Home all axes
default: {
#if HAS_MEDIA
// Print file 000 - a three digit number indicating which
// file to print in the SD card. If it's a directory,
// then switch to the directory.
// Find the name of the file to print.
// It's needed to echo the PRINTFILE option.
// The {S:L} command should've ensured the SD card was mounted.
card.selectFileByIndex(atoi(command));
// There may be a difference in how V1 and V2 LCDs handle subdirectory
// prints. Investigate more. This matches the V1 motion controller actions
// but the V2 LCD switches to "print" mode on {SYS:DIR} response.
if (card.flag.filenameIsDir) {
card.cd(card.filename);
write_to_lcd(F("{SYS:DIR}"));
}
else {
char message_buffer[MAX_CURLY_COMMAND];
sprintf_P(message_buffer, PSTR("{PRINTFILE:%s}"), card.longest_filename());
write_to_lcd(message_buffer);
write_to_lcd(F("{SYS:BUILD}"));
card.openAndPrintFile(card.filename);
}
#endif
} break; // default
} // switch
}
/**
* Handle an lcd 'S' command
* {S:I} - Temperature request
* {T0:999/000}{T1:000/000}{TP:004/000}
*
* {S:L} - File Listing request
* Printer Response:
* {FILE:buttons.gcode}
* {FILE:update.bin}
* {FILE:nupdate.bin}
* {FILE:fcupdate.flg}
* {SYS:OK}
*/
void process_lcd_s_command(const char *command) {
switch (command[0]) {
case 'I': {
// temperature information
char message_buffer[MAX_CURLY_COMMAND];
sprintf_P(message_buffer, PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}"),
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
#if HAS_HEATED_BED
thermalManager.wholeDegBed(), thermalManager.degTargetBed()
#else
0, 0
#endif
);
write_to_lcd(message_buffer);
} break;
case 'L': {
#if HAS_MEDIA
if (!card.isMounted()) card.mount();
// A more efficient way to do this would be to
// implement a callback in the ls_SerialPrint code, but
// that requires changes to the core cardreader class that
// would not benefit the majority of users. Since one can't
// select a file for printing during a print, there's
// little reason not to do it this way.
char message_buffer[MAX_CURLY_COMMAND];
int16_t file_count = card.get_num_items();
for (int16_t i = 0; i < file_count; i++) {
card.selectFileByIndex(i);
sprintf_P(message_buffer, card.flag.filenameIsDir ? PSTR("{DIR:%s}") : PSTR("{FILE:%s}"), card.longest_filename());
write_to_lcd(message_buffer);
}
write_to_lcd(F("{SYS:OK}"));
#endif
} break;
default: DEBUG_ECHOLNPGM("UNKNOWN S COMMAND ", command);
}
}
/**
* Receive a curly brace command and translate to G-code.
* Currently {E:0} is not handled. Its function is unknown,
* but it occurs during the temp window after a sys build.
*/
void process_lcd_command(const char *command) {
const char *current = command;
byte command_code = *current++;
if (*current == ':') {
current++; // skip the :
switch (command_code) {
case 'S': process_lcd_s_command(current); break;
case 'J': process_lcd_j_command(current); break;
case 'P': process_lcd_p_command(current); break;
case 'C': process_lcd_c_command(current); break;
case 'B':
case 'E': process_lcd_eb_command(current); break;
default: DEBUG_ECHOLNPGM("UNKNOWN COMMAND ", command);
}
}
else
DEBUG_ECHOLNPGM("UNKNOWN COMMAND FORMAT ", command);
}
//
// Parse LCD commands mixed with G-Code
//
void parse_lcd_byte(const byte b) {
static char inbound_buffer[MAX_CURLY_COMMAND];
static uint8_t parsing = 0; // Parsing state
static bool prevcr = false; // Was the last c a CR?
const char c = b & 0x7F;
if (parsing) {
const bool is_lcd = parsing == 1; // 1 for LCD
if ( ( is_lcd && c == '}') // Closing brace on LCD command
|| (!is_lcd && c == '\n') // LF on a G-code command
) {
inbound_buffer[inbound_count] = '\0'; // Reset before processing
inbound_count = 0; // Reset buffer index
if (parsing == 1)
process_lcd_command(inbound_buffer); // Handle the LCD command
else
queue.enqueue_one_now(inbound_buffer); // Handle the G-code command
parsing = 0; // Unflag and...
}
else if (inbound_count < MAX_CURLY_COMMAND - 2)
inbound_buffer[inbound_count++] = is_lcd ? c : b; // Buffer while space remains
}
else {
if (c == '{') parsing = 1; // Brace opens an LCD command
else if (prevcr && c == '\n') parsing = 2; // CRLF indicates G-code
prevcr = (c == '\r'); // Remember if it was a CR
}
}
/**
* UC means connected.
* UD means disconnected
* The stock firmware considers USB initialized as "connected."
*/
void update_usb_status(const bool forceUpdate) {
static bool last_usb_connected_status = false;
// This is mildly different than stock, which
// appears to use the usb discovery status.
// This is more logical.
if (last_usb_connected_status != MYSERIAL1.connected() || forceUpdate) {
last_usb_connected_status = MYSERIAL1.connected();
write_to_lcd(last_usb_connected_status ? F("{R:UC}\r\n") : F("{R:UD}\r\n"));
}
}
#endif // MALYAN_LCD
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/malyan/malyan.cpp
|
C++
|
agpl-3.0
| 13,840
|
/**
* 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/>.
*
*/
#pragma once
/**
* lcd/extui/malyan/malyan.h
*/
#include "../../../HAL/shared/Marduino.h"
// Track incoming command bytes from the LCD
extern uint16_t inbound_count;
// For sending print completion messages
extern bool last_printing_status;
void write_to_lcd(FSTR_P const fmsg);
void write_to_lcd(const char * const cmsg);
void set_lcd_error(FSTR_P const error, FSTR_P const component=nullptr);
void process_lcd_c_command(const char *command);
void process_lcd_eb_command(const char *command);
template<typename T>
void j_move_axis(const char *command, const T axis);
void process_lcd_j_command(const char *command);
void process_lcd_p_command(const char *command);
void process_lcd_s_command(const char *command);
void process_lcd_command(const char *command);
void parse_lcd_byte(const byte b);
void update_usb_status(const bool forceUpdate);
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/malyan/malyan.h
|
C++
|
agpl-3.0
| 1,719
|
/**
* 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/malyan/malyan_extui.cpp
*/
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(MALYAN_LCD)
#include "../ui_api.h"
#include "malyan.h"
//#include "../../marlinui.h"
//#include "../../../sd/cardreader.h"
//#include "../../../module/temperature.h"
//#include "../../../module/stepper.h"
//#include "../../../module/motion.h"
//#include "../../../libs/duration_t.h"
//#include "../../../module/printcounter.h"
//#include "../../../gcode/queue.h"
namespace ExtUI {
void onStartup() {
/**
* The Malyan LCD actually runs as a separate MCU on Serial 1.
* This code's job is to siphon the weird curly-brace commands from
* it and translate into ExtUI operations where possible.
*/
inbound_count = 0;
#ifndef LCD_BAUDRATE
#define LCD_BAUDRATE 500000
#endif
LCD_SERIAL.begin(LCD_BAUDRATE);
// Signal init
write_to_lcd(F("{SYS:STARTED}\r\n"));
// send a version that says "unsupported"
write_to_lcd(F("{VER:99}\r\n"));
// No idea why it does this twice.
write_to_lcd(F("{SYS:STARTED}\r\n"));
update_usb_status(true);
}
void onIdle() {
/**
* - from printer on startup:
* {SYS:STARTED}{VER:29}{SYS:STARTED}{R:UD}
*/
// First report USB status.
update_usb_status(false);
// now drain commands...
while (LCD_SERIAL.available())
parse_lcd_byte((byte)LCD_SERIAL.read());
#if HAS_MEDIA
// The way last printing status works is simple:
// The UI needs to see at least one TQ which is not 100%
// and then when the print is complete, one which is.
static uint8_t last_percent_done = 100;
// If there was a print in progress, we need to emit the final
// print status as {TQ:100}. Reset last percent done so a new print will
// issue a percent of 0.
const uint8_t percent_done = (ExtUI::isPrinting() || ExtUI::isPrintingFromMediaPaused()) ? ExtUI::getProgress_percent() : last_printing_status ? 100 : 0;
if (percent_done != last_percent_done) {
char message_buffer[16];
sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done);
write_to_lcd(message_buffer);
last_percent_done = percent_done;
last_printing_status = ExtUI::isPrinting();
}
#endif
}
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
set_lcd_error(error, component);
}
#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:
set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE));
break;
case PID_BAD_HEATER_ID:
set_lcd_error(GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
break;
case PID_TEMP_TOO_HIGH:
set_lcd_error(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH));
break;
case PID_TUNING_TIMEOUT:
set_lcd_error(GET_TEXT_F(MSG_PID_TIMEOUT));
break;
case PID_DONE:
set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE));
break;
}
}
void onStartM303(const int count, const heater_id_t hid, const celsius_t temp) {
// Called by M303 to update the UI
}
#endif
void onPrintTimerStarted() { write_to_lcd(F("{SYS:BUILD}")); }
void onPrintTimerPaused() {}
void onPrintTimerStopped() { write_to_lcd(F("{TQ:100}")); }
// Not needed for Malyan LCD
void onStatusChanged(const char * const) {}
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, const uint16_t/*=0*/) {}
void onFilamentRunout(const extruder_t extruder) {}
void onUserConfirmRequired(const char * const) {}
// 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*/
) {}
#endif
void onHomingStart() {}
void onHomingDone() {}
void onPrintDone() {}
void onFactoryReset() {}
void onStoreSettings(char*) {}
void onLoadSettings(const char*) {}
void onPostprocessSettings() {}
void onSettingsStored(const bool) {}
void onSettingsLoaded(const bool) {}
#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, const int8_t, const_float_t) {}
void onMeshUpdate(const int8_t, const int8_t, const ExtUI::probe_state_t) {}
#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 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 // MALYAN_LCD
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/malyan/malyan_extui.cpp
|
C++
|
agpl-3.0
| 6,764
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "../../../inc/MarlinConfig.h"
#include "SPIFlashStorage.h"
#if DISABLED(SPI_FLASH)
#error "SPI_FLASH is required with TFT_LVGL_UI."
#endif
extern W25QXXFlash W25QXX;
uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize];
uint32_t SPIFlashStorage::m_currentPage;
uint16_t SPIFlashStorage::m_pageDataUsed;
uint32_t SPIFlashStorage::m_startAddress;
#if HAS_SPI_FLASH_COMPRESSION
uint8_t SPIFlashStorage::m_compressedData[SPI_FLASH_PageSize];
uint16_t SPIFlashStorage::m_compressedDataUsed;
template <typename T>
static uint32_t rle_compress(T *output, uint32_t outputLength, T *input, uint32_t inputLength, uint32_t& inputProcessed) {
uint32_t count = 0, out = 0, index, i;
T pixel;
// 32767 for uint16_t
// 127 for uint16_t
// calculated at compile time
constexpr T max = (0xFFFFFFFF >> (8 * (4 - sizeof(T)))) / 2;
inputProcessed = 0;
while (count < inputLength && out < outputLength) {
index = count;
pixel = input[index++];
while (index < inputLength && index - count < max && input[index] == pixel)
index++;
if (index - count == 1) {
/**
* Failed to "replicate" the current pixel. See how many to copy.
* Avoid a replicate run of only 2-pixels after a literal run. There
* is no gain in this, and there is a risK of loss if the run after
* the two identical pixels is another literal run. So search for
* 3 identical pixels.
*/
while (index < inputLength && index - count < max && (input[index] != input[index - 1] || (index > 1 && input[index] != input[index - 2])))
index++;
/**
* Check why this run stopped. If it found two identical pixels, reset
* the index so we can add a run. Do this twice: the previous run
* tried to detect a replicate run of at least 3 pixels. So we may be
* able to back up two pixels if such a replicate run was found.
*/
while (index < inputLength && input[index] == input[index - 1])
index--;
// If the output buffer could overflow, stop at the remaining bytes
NOMORE(index, count + outputLength - out - 1);
output[out++] = (uint16_t)(count - index);
for (i = count; i < index; i++)
output[out++] = input[i];
}
else {
// Need at least more 2 spaces
if (out > outputLength - 2) break;
output[out++] = (uint16_t)(index - count);
output[out++] = pixel;
}
count = index;
}
inputProcessed = count;
// Padding
if (out == outputLength - 1) output[out++] = 0;
return out;
}
template <typename UT, typename T>
static uint32_t rle_uncompress(UT *output, uint32_t outputLength, UT *input, uint32_t inputLength, uint32_t &outputFilled) {
T count;
UT i;
uint32_t processedBytes = 0;
outputFilled = 0;
while (outputLength > 0 && inputLength > 0) {
processedBytes++;
count = static_cast<T>(*input++);
inputLength--;
if (count > 0) { // Replicate run
for (i = 0; i < count && outputLength > i; i++)
output[i] = *input;
outputFilled += i;
// If copy incomplete, change the input buffer to start with remaining data in the next call
if (i < count) {
// Change to process the difference in the next call
*(input - 1) = static_cast<UT>(count - i);
return processedBytes - 1;
}
input++;
inputLength--;
processedBytes++;
}
else if (count < 0) { // literal run
count = static_cast<T>(-count);
// Copy, validating if the output have enough space
for (i = 0; i < count && outputLength > i; i++)
output[i] = input[i];
outputFilled += i;
// If copy incomplete, change the input buffer to start with remaining data in the next call
if (i < count) {
input[i - 1] = static_cast<UT>((count - i) * -1);
// Back one
return processedBytes + i - 1;
}
input += count;
inputLength -= count;
processedBytes += count;
}
output += count;
outputLength -= count;
}
return processedBytes;
}
#endif // HAS_SPI_FLASH_COMPRESSION
void SPIFlashStorage::beginWrite(const uint32_t startAddress) {
m_pageDataUsed = 0;
m_currentPage = 0;
m_startAddress = startAddress;
#if HAS_SPI_FLASH_COMPRESSION
// Restart the compressed buffer, keep the pointers of the uncompressed buffer
m_compressedDataUsed = 0;
#endif
}
void SPIFlashStorage::endWrite() {
// Flush remaining data
#if HAS_SPI_FLASH_COMPRESSION
if (m_compressedDataUsed > 0) {
flushPage();
savePage(m_compressedData);
}
#else
if (m_pageDataUsed > 0) flushPage();
#endif
}
void SPIFlashStorage::savePage(uint8_t * const buffer) {
W25QXX.SPI_FLASH_BufferWrite(buffer, m_startAddress + (SPI_FLASH_PageSize * m_currentPage), SPI_FLASH_PageSize);
// Test env
// char fname[256];
// snprintf(fname, sizeof(fname), "./pages/page-%03d.data", m_currentPage);
// FILE *fp = fopen(fname, "wb");
// fwrite(buffer, 1, m_compressedDataUsed, fp);
// fclose(fp);
}
void SPIFlashStorage::loadPage(uint8_t * const buffer) {
W25QXX.SPI_FLASH_BufferRead(buffer, m_startAddress + (SPI_FLASH_PageSize * m_currentPage), SPI_FLASH_PageSize);
// Test env
// char fname[256];
// snprintf(fname, sizeof(fname), "./pages/page-%03d.data", m_currentPage);
// FILE *fp = fopen(fname, "rb");
// if (fp) {
// fread(buffer, 1, SPI_FLASH_PageSize, fp);
// fclose(fp);
// }
}
void SPIFlashStorage::flushPage() {
#if HAS_SPI_FLASH_COMPRESSION
// Work com with compressed in memory
uint32_t inputProcessed;
uint32_t compressedSize = rle_compress<uint16_t>((uint16_t *)(m_compressedData + m_compressedDataUsed), compressedDataFree() / 2, (uint16_t *)m_pageData, m_pageDataUsed / 2, inputProcessed) * 2;
inputProcessed *= 2;
m_compressedDataUsed += compressedSize;
// Space remaining in the compressed buffer?
if (compressedDataFree() > 0) {
// Free the uncompressed buffer
m_pageDataUsed = 0;
return;
}
// Part of the m_pageData was compressed, so adjust the pointers, freeing what was processed, shift the buffer
// TODO: To avoid this copy, use a circular buffer
memmove(m_pageData, m_pageData + inputProcessed, m_pageDataUsed - inputProcessed);
m_pageDataUsed -= inputProcessed;
// No? So flush page with compressed data!!
uint8_t *buffer = m_compressedData;
#else
uint8_t *buffer = m_pageData;
#endif
savePage(buffer);
#if HAS_SPI_FLASH_COMPRESSION
// Restart the compressed buffer, keep the pointers of the uncompressed buffer
m_compressedDataUsed = 0;
#else
m_pageDataUsed = 0;
#endif
m_currentPage++;
}
void SPIFlashStorage::readPage() {
#if HAS_SPI_FLASH_COMPRESSION
if (compressedDataFree() == 0) {
loadPage(m_compressedData);
m_currentPage++;
m_compressedDataUsed = 0;
}
// Need to uncompress data
if (pageDataFree() == 0) {
m_pageDataUsed = 0;
uint32_t outpuProcessed = 0;
uint32_t inputProcessed = rle_uncompress<uint16_t, int16_t>((uint16_t *)(m_pageData + m_pageDataUsed), pageDataFree() / 2, (uint16_t *)(m_compressedData + m_compressedDataUsed), compressedDataFree() / 2, outpuProcessed);
inputProcessed *= 2;
outpuProcessed *= 2;
if (outpuProcessed < pageDataFree()) {
m_pageDataUsed = SPI_FLASH_PageSize - outpuProcessed;
// TODO: To avoid this copy, use a circular buffer
memmove(m_pageData + m_pageDataUsed, m_pageData, outpuProcessed);
}
m_compressedDataUsed += inputProcessed;
}
#else
loadPage(m_pageData);
m_pageDataUsed = 0;
m_currentPage++;
#endif
}
uint16_t SPIFlashStorage::inData(const uint8_t * const data, uint16_t size) {
// Don't write more than we can
NOMORE(size, pageDataFree());
memcpy(m_pageData + m_pageDataUsed, data, size);
m_pageDataUsed += size;
return size;
}
void SPIFlashStorage::writeData(const uint8_t *data, uint16_t size) {
// Flush a page if needed
if (pageDataFree() == 0) flushPage();
while (size > 0) {
const uint16_t written = inData(data, size);
size -= written;
// Need to write more? Flush page and continue!
if (size > 0) {
flushPage();
data += written;
}
}
}
void SPIFlashStorage::beginRead(const uint32_t startAddress) {
m_startAddress = startAddress;
m_currentPage = 0;
// Nothing in memory now
m_pageDataUsed = SPI_FLASH_PageSize;
#if HAS_SPI_FLASH_COMPRESSION
m_compressedDataUsed = sizeof(m_compressedData);
#endif
}
uint16_t SPIFlashStorage::outData(uint8_t * const data, uint16_t size) {
// Don't read more than we have
NOMORE(size, pageDataFree());
memcpy(data, m_pageData + m_pageDataUsed, size);
m_pageDataUsed += size;
return size;
}
void SPIFlashStorage::readData(uint8_t *data, uint16_t size) {
// Read a page if needed
if (pageDataFree() == 0) readPage();
while (size > 0) {
const uint16_t read = outData(data, size);
size -= read;
// Need to write more? Flush page and continue!
if (size > 0) {
readPage();
data += read;
}
}
}
SPIFlashStorage SPIFlash;
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp
|
C++
|
agpl-3.0
| 10,323
|
/**
* 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/>.
*
*/
#pragma once
#include "../../../libs/W25Qxx.h"
#define HAS_SPI_FLASH_COMPRESSION 1
/**
* This class manages and optimizes SPI Flash data storage,
* keeping an internal buffer to write and save full SPI flash
* pages as needed.
*
* Since the data is always in the buffer, the class is also
* able to support fast on-the-fly RLE compression/decompression.
*
* In testing with the current LVGL_UI it compacts 2.9MB of icons
* (which have lots of runs) down to 370kB!!! As a result the UI
* refresh rate becomes faster and now all LVGL UI can fit into a
* tiny 2MB SPI Flash, such as the Chitu Board.
*
* == Usage ==
*
* Writing:
*
* The class keeps an internal buffer that caches data until it
* fits into a full SPI Flash page. Each time the buffer fills up
* the page is saved to SPI Flash. Sequential writes are optimal.
*
* SPIFlashStorage.beginWrite(myStartAddress);
* while (there is data to write)
* SPIFlashStorage.addData(myBuffer, bufferSize);
* SPIFlashStorage.endWrite(); // Flush remaining buffer data
*
* Reading:
*
* When reading, it loads a full page from SPI Flash at once and
* keeps it in a private SRAM buffer. Data is loaded as needed to
* fulfill requests. Sequential reads are optimal.
*
* SPIFlashStorage.beginRead(myStartAddress);
* while (there is data to read)
* SPIFlashStorage.readData(myBuffer, bufferSize);
*
* Compression:
*
* The biggest advantage of this class is the RLE compression.
* With compression activated a second buffer holds the compressed
* data, so when writing data, as this buffer becomes full it is
* flushed to SPI Flash.
*
* The same goes for reading: A compressed page is read from SPI
* flash, and the data is uncompressed as needed to provide the
* requested amount of data.
*/
class SPIFlashStorage {
public:
// Write operation
static void beginWrite(const uint32_t startAddress);
static void endWrite();
static void writeData(const uint8_t *data, uint16_t size);
// Read operation
static void beginRead(const uint32_t startAddress);
static void readData(uint8_t *data, uint16_t size);
static uint32_t getCurrentPage() { return m_currentPage; }
private:
static void flushPage();
static void savePage(uint8_t * const buffer);
static void loadPage(uint8_t * const buffer);
static void readPage();
static uint16_t inData(const uint8_t * const data, uint16_t size);
static uint16_t outData(uint8_t * const data, uint16_t size);
static uint8_t m_pageData[SPI_FLASH_PageSize];
static uint32_t m_currentPage;
static uint16_t m_pageDataUsed;
static uint16_t pageDataFree() { return SPI_FLASH_PageSize - m_pageDataUsed; }
static uint32_t m_startAddress;
#if HAS_SPI_FLASH_COMPRESSION
static uint8_t m_compressedData[SPI_FLASH_PageSize];
static uint16_t m_compressedDataUsed;
static uint16_t compressedDataFree() { return SPI_FLASH_PageSize - m_compressedDataUsed; }
#endif
};
extern SPIFlashStorage SPIFlash;
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.h
|
C++
|
agpl-3.0
| 3,848
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "SPI_TFT.h"
#include "pic_manager.h"
#include "tft_lvgl_configuration.h"
#include "../../../inc/MarlinConfig.h"
#include <SPI.h>
#include "draw_ui.h"
TFT SPI_TFT;
// use SPI1 for the spi tft.
void TFT::spiInit(uint8_t spiRate) {
tftio.init();
}
void TFT::setPoint(uint16_t x, uint16_t y, uint16_t point) {
if ((x > 480) || (y > 320)) return;
setWindow(x, y, 1, 1);
tftio.writeMultiple(point, (uint16_t)1);
}
void TFT::setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
tftio.set_window(x, y, (x + with - 1), (y + height - 1));
}
void TFT::lcdInit() {
tftio.initTFT();
#if PIN_EXISTS(TFT_BACKLIGHT)
OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
#endif
delay(100);
lcdClear(0x0000);
lcdDrawLogo();
#if PIN_EXISTS(TFT_BACKLIGHT)
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif
TERN_(HAS_LOGO_IN_FLASH, delay(2000));
}
void TFT::lcdClear(uint16_t color) {
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
tftio.writeMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT));
}
void TFT::lcdDrawLogo() {
#if HAS_LOGO_IN_FLASH
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
for (uint16_t i = 0; i < (TFT_HEIGHT); i++) {
picLogoRead((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
tftio.writeSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
}
#endif
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp
|
C++
|
agpl-3.0
| 2,286
|
/**
* 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/>.
*
*/
#pragma once
#include "../../tft_io/tft_io.h"
#include <stdint.h>
class TFT {
public:
TFT_IO tftio;
void spiInit(uint8_t spiRate);
void setPoint(uint16_t x, uint16_t y, uint16_t point);
void setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
void lcdInit();
void lcdClear(uint16_t color);
void lcdDrawLogo();
};
extern TFT SPI_TFT;
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/SPI_TFT.h
|
C++
|
agpl-3.0
| 1,227
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *fw_type, *board, *website, *uuid, *protocol;
enum { ID_A_RETURN = 1 };
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_A_RETURN:
goto_previous_ui();
break;
}
}
void lv_draw_about() {
scr = lv_screen_create(ABOUT_UI);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);
board = lv_label_create(scr, BOARD_INFO_NAME);
lv_obj_align(board, nullptr, LV_ALIGN_CENTER, 0, -80);
fw_type = lv_label_create(scr, "Marlin " SHORT_BUILD_VERSION " (" STRING_DISTRIBUTION_DATE ")");
lv_obj_align(fw_type, nullptr, LV_ALIGN_CENTER, 0, -50);
website = lv_label_create(scr, WEBSITE_URL);
lv_obj_align(website, nullptr, LV_ALIGN_CENTER, 0, -20);
uuid = lv_label_create(scr, "UUID: " DEFAULT_MACHINE_UUID);
lv_obj_align(uuid, nullptr, LV_ALIGN_CENTER, 0, 10);
protocol = lv_label_create(scr, "Protocol: " PROTOCOL_VERSION);
lv_obj_align(protocol, nullptr, LV_ALIGN_CENTER, 0, 40);
}
void lv_clear_about() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_about.cpp
|
C++
|
agpl-3.0
| 2,367
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_about();
void lv_clear_about();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_about.h
|
C
|
agpl-3.0
| 1,023
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/planner.h"
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
enum {
ID_ACCE_RETURN = 1,
ID_ACCE_PRINT,
ID_ACCE_RETRA,
ID_ACCE_TRAVEL,
ID_ACCE_X,
ID_ACCE_Y,
ID_ACCE_Z,
ID_ACCE_E0,
ID_ACCE_E1,
ID_ACCE_UP,
ID_ACCE_DOWN
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_ACCE_RETURN:
uiCfg.para_ui_page = false;
lv_clear_acceleration_settings();
draw_return_ui();
break;
case ID_ACCE_PRINT:
value = PrintAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_RETRA:
value = RetractAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_TRAVEL:
value = TravelAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_X:
value = XAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_Y:
value = YAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_Z:
value = ZAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_E0:
value = E0Acceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_E1:
value = E1Acceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
break;
case ID_ACCE_UP:
uiCfg.para_ui_page = false;
lv_clear_acceleration_settings();
lv_draw_acceleration_settings();
break;
case ID_ACCE_DOWN:
uiCfg.para_ui_page = true;
lv_clear_acceleration_settings();
lv_draw_acceleration_settings();
break;
}
}
void lv_draw_acceleration_settings() {
scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle);
lv_coord_t y = PARA_UI_POS_Y;
if (!uiCfg.para_ui_page) {
dtostrf(planner.settings.acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.PrintAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_PRINT, 0, public_buf_l);
y += PARA_UI_POS_Y;
dtostrf(planner.settings.retract_acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.RetractAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_RETRA, 1, public_buf_l);
y += PARA_UI_POS_Y;
dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l);
y += PARA_UI_POS_Y;
#if HAS_X_AXIS
itoa(planner.settings.max_acceleration_mm_per_s2[X_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_X, 3, public_buf_l);
#endif
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_DOWN, true);
}
else {
#if HAS_Y_AXIS
itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_Y, 0, public_buf_l);
#endif
#if HAS_Z_AXIS
y += PARA_UI_POS_Y;
itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_Z, 1, public_buf_l);
#endif
#if HAS_HOTEND
y += PARA_UI_POS_Y;
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.E0_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_E0, 2, public_buf_l);
#endif
#if ENABLED(DISTINCT_E_FACTORS)
y += PARA_UI_POS_Y;
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.E1_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_E1, 3, public_buf_l);
#endif
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_UP, true);
}
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_ACCE_RETURN, true);
}
void lv_clear_acceleration_settings() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.cpp
|
C++
|
agpl-3.0
| 5,780
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_acceleration_settings();
void lv_clear_acceleration_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.h
|
C
|
agpl-3.0
| 1,055
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
enum {
ID_ADVANCE_RETURN = 1,
ID_PAUSE_POS,
ID_WIFI_PARA,
ID_FILAMENT_SETTINGS,
ID_ENCODER_SETTINGS
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_ADVANCE_RETURN:
lv_clear_advance_settings();
draw_return_ui();
break;
case ID_PAUSE_POS:
lv_clear_advance_settings();
lv_draw_pause_position();
break;
case ID_FILAMENT_SETTINGS:
lv_clear_advance_settings();
lv_draw_filament_settings();
break;
#if ENABLED(MKS_WIFI_MODULE)
case ID_WIFI_PARA:
lv_clear_advance_settings();
lv_draw_wifi_settings();
break;
#endif
#if HAS_ROTARY_ENCODER
case ID_ENCODER_SETTINGS:
lv_clear_advance_settings();
lv_draw_encoder_settings();
break;
#endif
}
}
void lv_draw_advance_settings() {
scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle);
int index = 0;
lv_screen_menu_item(scr, machine_menu.PausePosition, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_POS, index++);
lv_screen_menu_item(scr, machine_menu.FilamentConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SETTINGS, index++);
#if ENABLED(MKS_WIFI_MODULE)
lv_screen_menu_item(scr, machine_menu.WifiSettings, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_WIFI_PARA, index++);
#endif
#if HAS_ROTARY_ENCODER
lv_screen_menu_item(scr, machine_menu.EncoderSettings, PARA_UI_POS_X, PARA_UI_POS_Y * (index + 1), event_handler, ID_ENCODER_SETTINGS, index);
index++;
#endif
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_ADVANCE_RETURN, true);
}
void lv_clear_advance_settings() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_advance_settings.cpp
|
C++
|
agpl-3.0
| 3,027
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_advance_settings();
void lv_clear_advance_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_advance_settings.h
|
C
|
agpl-3.0
| 1,045
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if ALL(HAS_TFT_LVGL_UI, HAS_BED_PROBE)
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/probe.h"
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
enum {
ID_OFFSET_RETURN = 1,
ID_OFFSET_X,
ID_OFFSET_Y,
ID_OFFSET_Z
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_OFFSET_RETURN:
lv_clear_auto_level_offset_settings();
draw_return_ui();
break;
case ID_OFFSET_X:
value = x_offset;
lv_clear_auto_level_offset_settings();
lv_draw_number_key();
break;
case ID_OFFSET_Y:
value = y_offset;
lv_clear_auto_level_offset_settings();
lv_draw_number_key();
break;
case ID_OFFSET_Z:
value = z_offset;
lv_clear_auto_level_offset_settings();
lv_draw_number_key();
break;
}
}
void lv_draw_auto_level_offset_settings() {
scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle);
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.x), 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Xoffset, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_OFFSET_X, 0, public_buf_l);
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.y), 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Yoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_OFFSET_Y, 1, public_buf_l);
dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.z), 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Zoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_OFFSET_Z, 2, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_OFFSET_RETURN, true);
}
void lv_clear_auto_level_offset_settings() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI && HAS_BED_PROBE
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp
|
C++
|
agpl-3.0
| 2,955
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_auto_level_offset_settings();
void lv_clear_auto_level_offset_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.h
|
C
|
agpl-3.0
| 1,065
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../gcode/queue.h"
#include "../../../gcode/gcode.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../../../module/settings.h"
#endif
#if HAS_BED_PROBE
#include "../../../module/probe.h"
#endif
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *labelV, *buttonV, *zOffsetText;
enum {
ID_BABYSTEP_X_P = 1,
ID_BABYSTEP_X_N,
ID_BABYSTEP_Y_P,
ID_BABYSTEP_Y_N,
ID_BABYSTEP_Z_P,
ID_BABYSTEP_Z_N,
ID_BABYSTEP_DIST,
ID_BABYSTEP_RETURN
};
static float babystep_dist = 0.01;
static uint8_t has_adjust_z = 0;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
char baby_buf[30] = { 0 };
char str_1[16];
switch (obj->mks_obj_id) {
case ID_BABYSTEP_X_P:
sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_X_N:
sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_Y_P:
sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_Y_N:
sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_Z_P:
sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_Z_N:
sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(-babystep_dist, 1, 3, str_1));
gcode.process_subcommands_now(F(baby_buf));
has_adjust_z = 1;
break;
case ID_BABYSTEP_DIST:
if (ABS((int)(100 * babystep_dist)) == 1)
babystep_dist = 0.05;
else if (ABS((int)(100 * babystep_dist)) == 5)
babystep_dist = 0.1;
else
babystep_dist = 0.01;
disp_baby_step_dist();
break;
case ID_BABYSTEP_RETURN:
if (has_adjust_z == 1) {
TERN_(EEPROM_SETTINGS, (void)settings.save());
has_adjust_z = 0;
}
goto_previous_ui();
break;
}
}
void lv_draw_baby_stepping() {
scr = lv_screen_create(BABYSTEP_UI);
lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABYSTEP_X_P);
lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_X_N);
lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABYSTEP_Y_P);
lv_big_button_create(scr, "F:/bmp_yDec.bin", move_menu.y_dec, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_Y_N);
lv_big_button_create(scr, "F:/bmp_zAdd.bin", move_menu.z_add, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_BABYSTEP_Z_P);
lv_big_button_create(scr, "F:/bmp_zDec.bin", move_menu.z_dec, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_Z_N);
buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_BABYSTEP_DIST);
labelV = lv_label_create_empty(buttonV);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable)
lv_group_add_obj(g, buttonV);
#endif
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_RETURN);
disp_baby_step_dist();
zOffsetText = lv_label_create(scr, 290, TITLE_YPOS, nullptr);
disp_z_offset_value();
}
void disp_baby_step_dist() {
if ((int)(100 * babystep_dist) == 1)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_01.bin");
else if ((int)(100 * babystep_dist) == 5)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_05.bin");
else if ((int)(100 * babystep_dist) == 10)
lv_imgbtn_set_src_both(buttonV, "F:/bmp_baby_move0_1.bin");
if (gCfgItems.multiple_language) {
if ((int)(100 * babystep_dist) == 1) {
lv_label_set_text(labelV, move_menu.step_001mm);
lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if ((int)(100 * babystep_dist) == 5) {
lv_label_set_text(labelV, move_menu.step_005mm);
lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if ((int)(100 * babystep_dist) == 10) {
lv_label_set_text(labelV, move_menu.step_01mm);
lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
}
void disp_z_offset_value() {
char buf[20];
#if HAS_BED_PROBE
char str_1[16];
sprintf_P(buf, PSTR("Offset Z: %s mm"), dtostrf(probe.offset.z, 1, 3, str_1));
#else
strcpy_P(buf, PSTR("Offset Z: 0 mm"));
#endif
lv_label_set_text(zOffsetText, buf);
}
void lv_clear_baby_stepping() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp
|
C++
|
agpl-3.0
| 6,329
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_baby_stepping();
void lv_clear_baby_stepping();
void disp_baby_step_dist();
void disp_z_offset_value();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.h
|
C
|
agpl-3.0
| 1,095
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/planner.h"
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *labelStep, *buttonStep, *buttonMov, *buttonExt;
static lv_obj_t *labelMov, *labelExt;
static lv_obj_t *printSpeedText;
enum {
ID_C_ADD = 1,
ID_C_DEC,
ID_C_MOVE,
ID_C_EXT,
ID_C_STEP,
ID_C_RETURN
};
static bool editingFlowrate;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_C_ADD:
if (!editingFlowrate) {
if (feedrate_percentage < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
feedrate_percentage += uiCfg.stepPrintSpeed;
else
feedrate_percentage = MAX_EXT_SPEED_PERCENT;
}
else {
if (planner.flow_percentage[0] < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
planner.flow_percentage[0] += uiCfg.stepPrintSpeed;
else
planner.flow_percentage[0] = MAX_EXT_SPEED_PERCENT;
planner.refresh_e_factor(0);
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = planner.flow_percentage[0];
planner.refresh_e_factor(1);
#endif
}
disp_print_speed();
break;
case ID_C_DEC:
if (!editingFlowrate) {
if (feedrate_percentage > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
feedrate_percentage -= uiCfg.stepPrintSpeed;
else
feedrate_percentage = MIN_EXT_SPEED_PERCENT;
}
else {
if (planner.flow_percentage[0] > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
planner.flow_percentage[0] -= uiCfg.stepPrintSpeed;
else
planner.flow_percentage[0] = MIN_EXT_SPEED_PERCENT;
planner.refresh_e_factor(0);
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = planner.flow_percentage[0];
planner.refresh_e_factor(1);
#endif
}
disp_print_speed();
break;
case ID_C_MOVE:
editingFlowrate = false;
disp_speed_type();
disp_print_speed();
break;
case ID_C_EXT:
editingFlowrate = true;
disp_speed_type();
disp_print_speed();
break;
case ID_C_STEP:
if (uiCfg.stepPrintSpeed == 1)
uiCfg.stepPrintSpeed = 5;
else if (uiCfg.stepPrintSpeed == 5)
uiCfg.stepPrintSpeed = 10;
else
uiCfg.stepPrintSpeed = 1;
disp_speed_step();
break;
case ID_C_RETURN:
goto_previous_ui();
break;
}
}
void lv_draw_change_speed() {
scr = lv_screen_create(CHANGE_SPEED_UI);
// Create an Image button
lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD);
lv_big_button_create(scr, "F:/bmp_Dec.bin", speed_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_C_DEC);
buttonMov = lv_imgbtn_create(scr, nullptr, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_MOVE);
buttonExt = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_EXT);
buttonStep = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_STEP);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonMov);
lv_group_add_obj(g, buttonExt);
lv_group_add_obj(g, buttonStep);
}
#endif
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_C_RETURN);
// Create labels on the image buttons
labelMov = lv_label_create_empty(buttonMov);
labelExt = lv_label_create_empty(buttonExt);
labelStep = lv_label_create_empty(buttonStep);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonMov);
lv_group_add_obj(g, buttonExt);
lv_group_add_obj(g, buttonStep);
}
#endif
disp_speed_type();
disp_speed_step();
printSpeedText = lv_label_create_empty(scr);
lv_obj_set_style(printSpeedText, &tft_style_label_rel);
disp_print_speed();
}
void disp_speed_step() {
if (uiCfg.stepPrintSpeed == 1)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_percent.bin");
else if (uiCfg.stepPrintSpeed == 5)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_percent.bin");
else if (uiCfg.stepPrintSpeed == 10)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_percent.bin");
if (gCfgItems.multiple_language) {
if (uiCfg.stepPrintSpeed == 1) {
lv_label_set_text(labelStep, speed_menu.step_1percent);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if (uiCfg.stepPrintSpeed == 5) {
lv_label_set_text(labelStep, speed_menu.step_5percent);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if (uiCfg.stepPrintSpeed == 10) {
lv_label_set_text(labelStep, speed_menu.step_10percent);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
}
void disp_print_speed() {
char buf[30] = { 0 };
public_buf_l[0] = '\0';
int16_t val;
const char *lbl;
if (editingFlowrate) {
lbl = speed_menu.extrude_speed;
val = planner.flow_percentage[0];
}
else {
lbl = speed_menu.move_speed;
val = feedrate_percentage;
}
strcpy(public_buf_l, lbl);
strcat_P(public_buf_l, PSTR(": "));
sprintf_P(buf, PSTR("%d%%"), val);
strcat(public_buf_l, buf);
lv_label_set_text(printSpeedText, public_buf_l);
lv_obj_align(printSpeedText, nullptr, LV_ALIGN_CENTER, 0, -65);
}
void disp_speed_type() {
lv_imgbtn_set_src_both(buttonMov, editingFlowrate ? "F:/bmp_mov_changeSpeed.bin" : "F:/bmp_mov_sel.bin");
lv_imgbtn_set_src_both(buttonExt, editingFlowrate ? "F:/bmp_extruct_sel.bin" : "F:/bmp_speed_extruct.bin");
lv_obj_refresh_ext_draw_pad(buttonExt);
lv_obj_refresh_ext_draw_pad(buttonMov);
if (gCfgItems.multiple_language) {
lv_label_set_text(labelMov, speed_menu.move);
lv_obj_align(labelMov, buttonMov, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(labelExt, speed_menu.extrude);
lv_obj_align(labelExt, buttonExt, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
void lv_clear_change_speed() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp
|
C++
|
agpl-3.0
| 7,536
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define MIN_EXT_SPEED_PERCENT 10
#define MAX_EXT_SPEED_PERCENT 999
void lv_draw_change_speed();
void lv_clear_change_speed();
void disp_speed_step();
void disp_print_speed();
void disp_speed_type();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_change_speed.h
|
C
|
agpl-3.0
| 1,183
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if ALL(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../MarlinCore.h"
#include "../../../module/temperature.h"
#include "QR_Encode.h"
extern lv_group_t * g;
static lv_obj_t * scr;
static lv_obj_t *button_bind_or_not = nullptr, *label_bind_or_not = nullptr;
static lv_obj_t *buttonReleaseBind = nullptr, *label_ReleaseBind = nullptr;
static lv_obj_t * text_id;
static uint8_t unbinding_flag = 0;
static uint8_t id_mark = 0;
#define ID_CLOUD_BIND_RETURN 1
#define ID_CLOUD_BIND_OR_NOT 2
#define ID_CLOUD_RELEASE_BIND 3
static void event_handler(lv_obj_t * obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_CLOUD_BIND_RETURN:
goto_previous_ui();
break;
case ID_CLOUD_RELEASE_BIND:
if (cloud_para.state == 0x12) {
clear_cur_ui();
lv_draw_dialog(DIALOG_TYPE_UNBIND);
}
break;
}
}
void lv_draw_cloud_bind() {
lv_obj_t *buttonBack = nullptr, *label_Back = nullptr;
scr = lv_screen_create(BIND_UI);
button_bind_or_not = lv_btn_create(scr, nullptr);
lv_obj_set_pos(button_bind_or_not, TFT_WIDTH - 130, TFT_HEIGHT - 80 * 3);
lv_obj_set_size(button_bind_or_not, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
lv_obj_set_event_cb_mks(button_bind_or_not, event_handler, ID_CLOUD_BIND_OR_NOT, nullptr, 0);
lv_btn_set_style(button_bind_or_not, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(button_bind_or_not, LV_BTN_STYLE_PR, &style_para_value);
label_bind_or_not = lv_label_create_empty(button_bind_or_not);
buttonReleaseBind = lv_btn_create(scr, nullptr);
lv_obj_set_pos(buttonReleaseBind, TFT_WIDTH - 130, TFT_HEIGHT - 80 * 2);
lv_obj_set_size(buttonReleaseBind, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
lv_obj_set_event_cb_mks(buttonReleaseBind, event_handler, ID_CLOUD_RELEASE_BIND, nullptr, 0);
label_ReleaseBind = lv_label_create_empty(buttonReleaseBind);
lv_label_set_text(label_ReleaseBind, cloud_menu.unbind);
lv_obj_align(label_ReleaseBind, buttonReleaseBind, LV_ALIGN_CENTER, 0, 0);
buttonBack = lv_btn_create(scr, nullptr);
lv_obj_set_pos(buttonBack, TFT_WIDTH - 130, TFT_HEIGHT - 80);
lv_obj_set_size(buttonBack, PARA_UI_VALUE_BTN_X_SIZE + 15, PARA_UI_VALUE_BTN_Y_SIZE + 15);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_CLOUD_BIND_RETURN, nullptr, 0);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonBack, LV_BTN_STYLE_PR, &style_para_back);
label_Back = lv_label_create_empty(buttonBack);
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
#if BUTTONS_EXIST(EN1, EN2, ENC)
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonReleaseBind);
lv_group_add_obj(g, buttonBack);
}
#endif
text_id = lv_label_create_empty(scr);
lv_obj_set_pos(text_id, 50, 60 + 200 + 20);
lv_obj_set_style(text_id, &tft_style_label_rel);
lv_label_set_text(text_id, (char *)cloud_para.id);
id_mark = 0;
disp_bind_state();
}
void disp_bind_state() {
if (cloud_para.state != 0x12)
unbinding_flag = 0;
if (unbinding_flag) {
lv_label_set_text(label_bind_or_not, cloud_menu.unbinding);
lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_value);
}
else {
if (cloud_para.state == 0x10) {
lv_label_set_text(label_bind_or_not, cloud_menu.disconnected);
lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
}
else if (cloud_para.state == 0x11) {
lv_label_set_text(label_bind_or_not, cloud_menu.unbinded);
lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
}
else if (cloud_para.state == 0x12) {
lv_label_set_text(label_bind_or_not, cloud_menu.binded);
lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
}
else {
lv_label_set_text(label_bind_or_not, cloud_menu.disable);
lv_obj_align(label_bind_or_not, button_bind_or_not, LV_ALIGN_CENTER, 0, 0);
}
}
if (cloud_para.state == 0x12 && !unbinding_flag) {
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_back);
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_back);
}
else {
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_REL, &style_para_value);
lv_btn_set_style(buttonReleaseBind, LV_BTN_STYLE_PR, &style_para_value);
}
}
static char last_cloud_state = 0;
void refresh_bind_ui() {
if ((last_cloud_state != cloud_para.state) || unbinding_flag) {
disp_bind_state();
last_cloud_state = cloud_para.state;
}
if (cloud_para.id[0]) {
if (!id_mark) {
display_qrcode((uint8_t *)cloud_para.id);
lv_label_set_text(text_id, (char *)cloud_para.id);
}
}
else
id_mark = 0;
}
void display_qrcode(uint8_t *qrcode_data) {
uint8_t i, j;
uint16_t x, y, p;
if (!id_mark) {
EncodeData((char *)qrcode_data);
id_mark = 1;
}
lv_fill_rect(10, QRCODE_Y, 300, QRCODE_Y + 300, LV_COLOR_WHITE);
if (m_nSymbleSize * 2 > QRCODE_WIDTH) return;
for (i = 0; i < 40; i++)
if ((m_nSymbleSize * i * 2) > QRCODE_WIDTH) break;
p = (i - 1) * 2;
x = QRCODE_X + 70;
y = QRCODE_Y + 70;
for (i = 0; i < m_nSymbleSize; i++)
for (j = 0; j < m_nSymbleSize; j++)
if (m_byModuleData[i][j] == 1)
lv_fill_rect(x + p * i, y + p * j, x + p * (i + 1) - 1, y + p * (j + 1) - 1, LV_COLOR_BACKGROUND);
}
void cloud_unbind() {
package_to_wifi(WIFI_CLOUD_UNBIND, nullptr, 0);
unbinding_flag = 1;
}
void lv_clear_cloud_bind() {
#if BUTTONS_EXIST(EN1, EN2, ENC)
if (gCfgItems.encoder_enable)
lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp
|
C++
|
agpl-3.0
| 6,900
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_cloud_bind();
void lv_clear_cloud_bind();
void disp_bind_state();
void refresh_bind_ui();
void display_qrcode(uint8_t *qrcode_data);
void cloud_unbind();
#ifdef __cplusplus
}
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.h
|
C
|
agpl-3.0
| 1,116
|
/**
* 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/>.
*
*/
/**
* draw_dialog.cpp
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../sd/cardreader.h"
#include "../../../gcode/queue.h"
#include "../../../module/temperature.h"
#include "../../../module/planner.h"
#include "../../../gcode/gcode.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS)
#include "../../../module/settings.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../feature/powerloss.h"
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../../feature/pause.h"
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../../tft_io/touch_calibration.h"
#include "draw_touch_calibration.h"
#endif
extern lv_group_t *g;
static lv_obj_t *scr, *tempText1, *filament_bar;
extern uint8_t sel_id;
extern bool once_flag, gcode_preview_over;
extern int upload_result;
extern uint32_t upload_time_sec;
extern uint32_t upload_size;
extern bool temps_update_flag;
//#define CANCEL_ON_RIGHT // Put 'Cancel' on the right (as it was before)
#define BTN_OK_X TERN(CANCEL_ON_RIGHT, 100, 280)
#define BTN_CANCEL_X TERN(CANCEL_ON_RIGHT, 280, 100)
#define BTN_OK_Y 180
#define BTN_CANCEL_Y 180
static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
if (DIALOG_IS(TYPE_PRINT_FILE)) {
#if HAS_GCODE_PREVIEW
preview_gcode_prehandle(list_file.file_name[sel_id]);
#endif
reset_print_time();
start_print_time();
uiCfg.print_state = WORKING;
lv_clear_dialog();
lv_draw_printing();
#if HAS_MEDIA
if (!gcode_preview_over) {
char *cur_name;
cur_name = strrchr(list_file.file_name[sel_id], '/');
MediaFile file, *curDir;
card.abortFilePrintNow();
const char * const fname = card.diveToFile(false, curDir, cur_name);
if (!fname) return;
if (file.open(curDir, fname, O_READ)) {
gCfgItems.curFilesize = file.fileSize();
file.close();
update_spi_flash();
}
card.openFileRead(cur_name);
if (card.isFileOpen()) {
feedrate_percentage = 100;
planner.flow_percentage[0] = 100;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = 100;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
#endif
card.startOrResumeFilePrinting();
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
once_flag = false;
}
}
#endif
}
else if (DIALOG_IS(TYPE_STOP)) {
wait_for_heatup = false;
stop_print_time();
lv_clear_dialog();
lv_draw_ready_print();
#if HAS_MEDIA
uiCfg.print_state = IDLE;
card.abortFilePrintSoon();
#endif
}
else if (DIALOG_IS(TYPE_FINISH_PRINT)) {
clear_cur_ui();
lv_draw_ready_print();
}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_HEAT))
wait_for_user = false;
else if (DIALOG_IS(PAUSE_MESSAGE_OPTION))
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) {
goto_previous_ui();
}
#endif
else if (DIALOG_IS(STORE_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.save());
goto_previous_ui();
}
else if (DIALOG_IS(READ_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.load());
goto_previous_ui();
}
else if (DIALOG_IS(REVERT_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.reset());
clear_cur_ui();
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
const bool do_draw_cal = touch_calibration.need_calibration();
if (do_draw_cal) {
disp_state_stack._disp_index--; // We are asynchronous from the dialog, so let's remove the dialog from the stack
lv_draw_touch_calibration_screen();
}
#else
constexpr bool do_draw_cal = false;
#endif
if (!do_draw_cal) draw_return_ui();
}
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
uiCfg.configWifi = true;
goto_previous_ui();
}
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED))
uiCfg.filament_heat_completed_load = true;
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED))
uiCfg.filament_heat_completed_unload = true;
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
goto_previous_ui();
}
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UNBIND)) {
cloud_unbind();
goto_previous_ui();
}
#endif
else {
goto_previous_ui();
}
}
static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
}
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
goto_previous_ui();
}
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
queue.enqueue_one(F("M410"));
uiCfg.filament_rate = 0;
uiCfg.filament_loading_completed = false;
uiCfg.filament_unloading_completed = false;
uiCfg.filament_loading_time_flg = false;
uiCfg.filament_loading_time_cnt = 0;
uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_time_cnt = 0;
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
goto_previous_ui();
}
else {
goto_previous_ui();
}
}
void lv_draw_dialog(uint8_t type) {
lv_obj_t *btnOk = nullptr, *btnCancel = nullptr;
uiCfg.dialogType = type;
scr = lv_screen_create(DIALOG_UI);
lv_obj_t *labelDialog = lv_label_create(scr, "");
if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_HEAT)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DIALOG_IS(PAUSE_MESSAGE_PARKING, PAUSE_MESSAGE_CHANGING, PAUSE_MESSAGE_UNLOAD, PAUSE_MESSAGE_LOAD, PAUSE_MESSAGE_PURGE, PAUSE_MESSAGE_RESUME, PAUSE_MESSAGE_HEATING)) {
// nothing to do
}
else if (DIALOG_IS(WIFI_ENABLE_TIPS)) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
}
else if (DIALOG_IS(TRANSFER_NO_DEVICE)) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
}
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
if (upload_result == 2) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
}
else if (upload_result == 3) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk);
lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
}
}
else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMWARE)) {
// nothing to do
}
#endif
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT)) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
tempText1 = lv_label_create_empty(scr);
filament_sprayer_temp();
}
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk);
lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
}
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
filament_bar = lv_bar_create(scr, nullptr);
lv_obj_set_pos(filament_bar, (TFT_WIDTH - 400) / 2, ((TFT_HEIGHT - titleHeight) - 40) / 2);
lv_obj_set_size(filament_bar, 400, 25);
lv_bar_set_style(filament_bar, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
lv_bar_set_anim_time(filament_bar, 1000);
lv_bar_set_value(filament_bar, 0, LV_ANIM_ON);
}
else {
btnOk = lv_button_btn_create(scr, BTN_OK_X, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
btnCancel = lv_button_btn_create(scr, BTN_CANCEL_X, BTN_CANCEL_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel); // Add a label to the button
if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
}
else {
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
}
}
if (DIALOG_IS(TYPE_PRINT_FILE)) {
lv_label_set_text(labelDialog, print_file_dialog_menu.print_file);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
lv_obj_t *labelFile = lv_label_create(scr, list_file.long_name[sel_id]);
lv_obj_align(labelFile, nullptr, LV_ALIGN_CENTER, 0, -60);
}
else if (DIALOG_IS(TYPE_STOP)) {
lv_label_set_text(labelDialog, print_file_dialog_menu.cancel_print);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FINISH_PRINT)) {
lv_label_set_text(labelDialog, print_file_dialog_menu.print_finish);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_PARKING)) {
lv_label_set_text(labelDialog, pause_msg_menu.pausing);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_CHANGING)) {
lv_label_set_text(labelDialog, pause_msg_menu.changing);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_UNLOAD)) {
lv_label_set_text(labelDialog, pause_msg_menu.unload);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING)) {
lv_label_set_text(labelDialog, pause_msg_menu.waiting);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_INSERT)) {
lv_label_set_text(labelDialog, pause_msg_menu.insert);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_LOAD)) {
lv_label_set_text(labelDialog, pause_msg_menu.load);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_PURGE)) {
lv_label_set_text(labelDialog, pause_msg_menu.purge);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) {
lv_label_set_text(labelDialog, pause_msg_menu.resume);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_HEAT)) {
lv_label_set_text(labelDialog, pause_msg_menu.heat);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_HEATING)) {
lv_label_set_text(labelDialog, pause_msg_menu.heating);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
lv_label_set_text(labelDialog, pause_msg_menu.option);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(STORE_EEPROM_TIPS)) {
lv_label_set_text(labelDialog, eeprom_menu.storeTips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(READ_EEPROM_TIPS)) {
lv_label_set_text(labelDialog, eeprom_menu.readTips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(REVERT_EEPROM_TIPS)) {
lv_label_set_text(labelDialog, eeprom_menu.revertTips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
lv_label_set_text(labelDialog, machine_menu.wifiConfigTips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(WIFI_ENABLE_TIPS)) {
lv_label_set_text(labelDialog, print_file_dialog_menu.wifi_enable_tips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TRANSFER_NO_DEVICE)) {
lv_label_set_text(labelDialog, DIALOG_UPDATE_NO_DEVICE_EN);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
if (upload_result == 1) {
lv_label_set_text(labelDialog, DIALOG_UPLOAD_ING_EN);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (upload_result == 2) {
lv_label_set_text(labelDialog, DIALOG_UPLOAD_ERROR_EN);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (upload_result == 3) {
MString<200> buf(
F(DIALOG_UPLOAD_FINISH_EN), '\n',
F(DIALOG_UPLOAD_SIZE_EN), F(": "), int(upload_size / 1024), F(" KBytes\n"),
F(DIALOG_UPLOAD_TIME_EN), F(": "), int(upload_time_sec), F(" s\n"),
F(DIALOG_UPLOAD_SPEED_EN), F(": "), int(upload_size / upload_time_sec / 1024), F(" KBytes/s\n")
);
lv_label_set_text(labelDialog, buf);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
}
else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMWARE)) {
lv_label_set_text(labelDialog, DIALOG_UPDATE_WIFI_FIRMWARE_EN);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
#endif // MKS_WIFI_MODULE
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat_confirm);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_UNLOAD_HEAT)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_heat);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_heat_confirm);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_completed);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_UNLOAD_COMPLETED)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_completed);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
else if (DIALOG_IS(TYPE_FILAMENT_LOADING)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_loading);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
}
else if (DIALOG_IS(TYPE_FILAMENT_UNLOADING)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unloading);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
}
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UNBIND)) {
lv_label_set_text(labelDialog, common_menu.unbind_printer_tips);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
}
#endif
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
if (btnOk) lv_group_add_obj(g, btnOk);
if (btnCancel) lv_group_add_obj(g, btnCancel);
}
#endif
}
void filament_sprayer_temp() {
char buf[20] = {0};
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf);
lv_label_set_text(tempText1, public_buf_l);
lv_obj_align(tempText1, nullptr, LV_ALIGN_CENTER, 0, -50);
}
void filament_dialog_handle() {
if (temps_update_flag && (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT))) {
filament_sprayer_temp();
temps_update_flag = false;
}
if (uiCfg.filament_heat_completed_load) {
uiCfg.filament_heat_completed_load = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOADING);
planner.synchronize();
uiCfg.filament_loading_time_flg = true;
uiCfg.filament_loading_time_cnt = 0;
#if HAS_TOOLCHANGE
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
#else
sprintf_P(public_buf_m, PSTR("G91\nG1 E%d F%d\nG90"), gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
#endif
queue.inject(public_buf_m);
}
if (uiCfg.filament_heat_completed_unload) {
uiCfg.filament_heat_completed_unload = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOADING);
planner.synchronize();
uiCfg.filament_unloading_time_flg = true;
uiCfg.filament_unloading_time_cnt = 0;
#if HAS_TOOLCHANGE
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
#else
sprintf_P(public_buf_m, PSTR("G91\nG1 E-%d F%d\nG90"), gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
#endif
queue.inject(public_buf_m);
}
if (uiCfg.filament_load_heat_flg) {
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
if (ABS(diff) < 2 || diff > 0) {
uiCfg.filament_load_heat_flg = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
}
}
if (uiCfg.filament_loading_completed) {
uiCfg.filament_rate = 0;
uiCfg.filament_loading_completed = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
}
if (uiCfg.filament_unload_heat_flg) {
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
if (ABS(diff) < 2 || diff > 0) {
uiCfg.filament_unload_heat_flg = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
}
}
if (uiCfg.filament_unloading_completed) {
uiCfg.filament_rate = 0;
uiCfg.filament_unloading_completed = false;
lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED);
}
if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING))
lv_filament_setbar();
}
void lv_filament_setbar() {
lv_bar_set_value(filament_bar, uiCfg.filament_rate, LV_ANIM_ON);
}
void lv_clear_dialog() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp
|
C++
|
agpl-3.0
| 21,356
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
enum {
DIALOG_TYPE_STOP = 0,
DIALOG_TYPE_PRINT_FILE,
DIALOG_TYPE_REPRINT_NO_FILE,
DIALOG_TYPE_M80_FAIL,
DIALOG_TYPE_MESSAGE_ERR1,
DIALOG_TYPE_UPDATE_ESP_FIRMWARE,
DIALOG_TYPE_UPDATE_ESP_DATA,
DIALOG_TYPE_UPLOAD_FILE,
DIALOG_TYPE_UNBIND,
DIALOG_TYPE_FILAMENT_LOAD_HEAT,
DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED,
DIALOG_TYPE_FILAMENT_LOADING,
DIALOG_TYPE_FILAMENT_LOAD_COMPLETED,
DIALOG_TYPE_FILAMENT_UNLOAD_HEAT,
DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED,
DIALOG_TYPE_FILAMENT_UNLOADING,
DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED,
DIALOG_TYPE_FILE_LOADING,
DIALOG_TYPE_FILAMENT_NO_PRESS,
DIALOG_TYPE_FINISH_PRINT,
DIALOG_WIFI_ENABLE_TIPS,
DIALOG_PAUSE_MESSAGE_PARKING,
DIALOG_PAUSE_MESSAGE_CHANGING,
DIALOG_PAUSE_MESSAGE_UNLOAD,
DIALOG_PAUSE_MESSAGE_WAITING,
DIALOG_PAUSE_MESSAGE_INSERT,
DIALOG_PAUSE_MESSAGE_LOAD,
DIALOG_PAUSE_MESSAGE_PURGE,
DIALOG_PAUSE_MESSAGE_RESUME,
DIALOG_PAUSE_MESSAGE_HEAT,
DIALOG_PAUSE_MESSAGE_HEATING,
DIALOG_PAUSE_MESSAGE_OPTION,
DIALOG_STORE_EEPROM_TIPS,
DIALOG_READ_EEPROM_TIPS,
DIALOG_REVERT_EEPROM_TIPS,
DIALOG_WIFI_CONFIG_TIPS,
DIALOG_TRANSFER_NO_DEVICE
};
void lv_draw_dialog(uint8_t type);
void lv_clear_dialog();
void filament_sprayer_temp();
void filament_dialog_handle();
void lv_filament_setbar();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_dialog.h
|
C
|
agpl-3.0
| 2,295
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
enum {
ID_EEPROM_RETURN = 1,
ID_EEPROM_STORE,
ID_EEPROM_STORE_ARROW,
ID_EEPROM_READ,
ID_EEPROM_READ_ARROW,
ID_EEPROM_REVERT,
ID_EEPROM_REVERT_ARROW
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_EEPROM_RETURN:
lv_clear_eeprom_settings();
draw_return_ui();
break;
case ID_EEPROM_STORE:
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
break;
#if 0
case ID_EEPROM_READ:
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
break;
#endif
case ID_EEPROM_REVERT:
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
break;
}
}
void lv_draw_eeprom_settings() {
scr = lv_screen_create(EEPROM_SETTINGS_UI);
lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0);
lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_EEPROM_RETURN, true);
}
void lv_clear_eeprom_settings() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.cpp
|
C++
|
agpl-3.0
| 2,496
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_eeprom_settings();
void lv_clear_eeprom_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.h
|
C
|
agpl-3.0
| 1,043
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../inc/MarlinConfig.h"
#if BUTTONS_EXIST(EN1, EN2)
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *buttonEncoderState = nullptr;
enum {
ID_ENCODER_RETURN = 1,
ID_ENCODER_STATE
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_ENCODER_RETURN:
lv_clear_encoder_settings();
draw_return_ui();
break;
case ID_ENCODER_STATE:
gCfgItems.encoder_enable ^= true;
lv_screen_menu_item_onoff_update(buttonEncoderState, gCfgItems.encoder_enable);
update_spi_flash();
break;
}
}
void lv_draw_encoder_settings() {
scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle);
buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_ENCODER_RETURN, true);
}
void lv_clear_encoder_settings() {
#if HAS_ROTARY_ENCODER
lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // BUTTONS_EXIST(EN1, EN2)
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp
|
C++
|
agpl-3.0
| 2,250
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_encoder_settings();
void lv_clear_encoder_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.h
|
C
|
agpl-3.0
| 1,045
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "tft_lvgl_configuration.h"
#include "SPI_TFT.h"
#include "../../../inc/MarlinConfig.h"
#include "mks_hardware.h"
static lv_obj_t *scr;
void lv_draw_error_message(FSTR_P const fmsg) {
FSTR_P fhalted = F("PRINTER HALTED"), fplease = F("Please Reset");
SPI_TFT.lcdClear(0x0000);
if (fmsg) disp_string((TFT_WIDTH - strlen_P(FTOP(fmsg)) * 16) / 2, 100, fmsg, 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen_P(FTOP(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen_P(FTOP(fplease)) * 16) / 2, 180, fplease, 0xFFFF, 0x0000);
}
void lv_clear_error_message() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp
|
C++
|
agpl-3.0
| 1,624
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#ifndef PGM_P
#define PGM_P const char *
#endif
void lv_draw_error_message(FSTR_P const fmsg);
void lv_clear_error_message();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_error_message.h
|
C
|
agpl-3.0
| 1,107
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/temperature.h"
#include "../../../gcode/queue.h"
#include "../../../inc/MarlinConfig.h"
static lv_obj_t *scr;
extern lv_group_t *g;
static lv_obj_t *buttonType, *buttonStep, *buttonSpeed;
static lv_obj_t *labelType;
static lv_obj_t *labelStep;
static lv_obj_t *labelSpeed;
static lv_obj_t *tempText;
static lv_obj_t *ExtruText;
enum {
ID_E_ADD = 1,
ID_E_DEC,
ID_E_TYPE,
ID_E_STEP,
ID_E_SPEED,
ID_E_RETURN
};
static int32_t extrudeAmount;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_E_ADD:
if (thermalManager.hotEnoughToExtrude(uiCfg.extruderIndex)) {
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.inject(public_buf_l);
extrudeAmount += uiCfg.extruStep;
disp_extru_amount();
}
break;
case ID_E_DEC:
if (thermalManager.hotEnoughToExtrude(uiCfg.extruderIndex)) {
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.inject(public_buf_l);
extrudeAmount -= uiCfg.extruStep;
disp_extru_amount();
}
break;
case ID_E_TYPE:
if (ENABLED(HAS_MULTI_EXTRUDER)) {
if (uiCfg.extruderIndex == 0) {
uiCfg.extruderIndex = 1;
queue.inject(F("T1"));
}
else {
uiCfg.extruderIndex = 0;
queue.inject(F("T0"));
}
}
else
uiCfg.extruderIndex = 0;
extrudeAmount = 0;
disp_hotend_temp();
disp_ext_type();
disp_extru_amount();
break;
case ID_E_STEP:
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: uiCfg.extruStep = uiCfg.eStepMed; break;
case uiCfg.eStepMed: uiCfg.extruStep = uiCfg.eStepMax; break;
case uiCfg.eStepMax: uiCfg.extruStep = uiCfg.eStepMin; break;
}
disp_ext_step();
break;
case ID_E_SPEED:
switch (uiCfg.extruSpeed) {
case uiCfg.eSpeedL: uiCfg.extruSpeed = uiCfg.eSpeedN; break;
case uiCfg.eSpeedN: uiCfg.extruSpeed = uiCfg.eSpeedH; break;
case uiCfg.eSpeedH: uiCfg.extruSpeed = uiCfg.eSpeedL; break;
}
disp_ext_speed();
break;
case ID_E_RETURN:
goto_previous_ui();
break;
}
}
void lv_draw_extrusion() {
scr = lv_screen_create(EXTRUSION_UI);
// Create image buttons
lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
lv_big_button_create(scr, "F:/bmp_out.bin", extrude_menu.out, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_E_DEC);
buttonType = lv_imgbtn_create(scr, nullptr, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_TYPE);
buttonStep = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_STEP);
buttonSpeed = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_SPEED);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonType);
lv_group_add_obj(g, buttonStep);
lv_group_add_obj(g, buttonSpeed);
}
#endif
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_E_RETURN);
// Create labels on the image buttons
labelType = lv_label_create_empty(buttonType);
labelStep = lv_label_create_empty(buttonStep);
labelSpeed = lv_label_create_empty(buttonSpeed);
disp_ext_type();
disp_ext_step();
disp_ext_speed();
tempText = lv_label_create_empty(scr);
lv_obj_set_style(tempText, &tft_style_label_rel);
disp_hotend_temp();
ExtruText = lv_label_create_empty(scr);
lv_obj_set_style(ExtruText, &tft_style_label_rel);
disp_extru_amount();
}
void disp_ext_type() {
if (uiCfg.extruderIndex == 1) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext2);
}
else {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext1);
}
if (gCfgItems.multiple_language)
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
void disp_ext_speed() {
switch (uiCfg.extruSpeed) {
case uiCfg.eSpeedH: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin"); break;
case uiCfg.eSpeedL: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin"); break;
case uiCfg.eSpeedN: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin"); break;
}
if (gCfgItems.multiple_language) {
switch (uiCfg.extruSpeed) {
case uiCfg.eSpeedH: lv_label_set_text(labelSpeed, extrude_menu.high); break;
case uiCfg.eSpeedL: lv_label_set_text(labelSpeed, extrude_menu.low); break;
case uiCfg.eSpeedN: lv_label_set_text(labelSpeed, extrude_menu.normal); break;
}
lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
void disp_hotend_temp() {
char buf[20] = {0};
sprintf(buf, extrude_menu.temp_value, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcpy(public_buf_l, extrude_menu.temper_text);
strcat(public_buf_l, buf);
lv_label_set_text(tempText, public_buf_l);
lv_obj_align(tempText, nullptr, LV_ALIGN_CENTER, 0, -50);
}
void disp_extru_amount() {
char buf1[10] = {0};
public_buf_l[0] = '\0';
if (extrudeAmount < 999 && extrudeAmount > -99)
sprintf(buf1, extrude_menu.count_value_mm, extrudeAmount);
else if (extrudeAmount < 9999 && extrudeAmount > -999)
sprintf(buf1, extrude_menu.count_value_cm, extrudeAmount / 10);
else
sprintf(buf1, extrude_menu.count_value_m, extrudeAmount / 1000);
strcat(public_buf_l, uiCfg.extruderIndex == 0 ? extrude_menu.ext1 : extrude_menu.ext2);
strcat(public_buf_l, buf1);
lv_label_set_text(ExtruText, public_buf_l);
lv_obj_align(ExtruText, nullptr, LV_ALIGN_CENTER, 0, -75);
}
void disp_ext_step() {
char buf3[12];
sprintf_P(buf3, PSTR("%dmm"), uiCfg.extruStep);
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin"); break;
case uiCfg.eStepMed: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin"); break;
case uiCfg.eStepMax: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin"); break;
}
if (gCfgItems.multiple_language) {
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: lv_label_set_text(labelStep, buf3); break;
case uiCfg.eStepMed: lv_label_set_text(labelStep, buf3); break;
case uiCfg.eStepMax: lv_label_set_text(labelStep, buf3); break;
}
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
void lv_clear_extrusion() {
if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable))
lv_group_remove_all_objs(g);
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp
|
C++
|
agpl-3.0
| 8,277
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_extrusion();
void lv_clear_extrusion();
void disp_ext_type();
void disp_ext_step();
void disp_ext_speed();
void disp_hotend_temp();
void disp_extru_amount();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_extrusion.h
|
C
|
agpl-3.0
| 1,149
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/temperature.h"
#include "../../../gcode/queue.h"
#include "../../../gcode/gcode.h"
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr, *fanText;
enum {
ID_F_ADD = 1,
ID_F_DEC,
ID_F_HIGH,
ID_F_MID,
ID_F_OFF,
ID_F_RETURN
};
uint8_t fanPercent = 0;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
const uint8_t temp = map(thermalManager.fan_speed[0], 0, 255, 0, 100);
if (abs(fanPercent - temp) > 2) fanPercent = temp;
switch (obj->mks_obj_id) {
case ID_F_ADD: if (fanPercent < 100) fanPercent++; break;
case ID_F_DEC: if (fanPercent != 0) fanPercent--; break;
case ID_F_HIGH: fanPercent = 100; break;
case ID_F_MID: fanPercent = 50; break;
case ID_F_OFF: fanPercent = 0; break;
case ID_F_RETURN: goto_previous_ui(); return;
}
thermalManager.set_fan_speed(0, map(fanPercent, 0, 100, 0, 255));
if (obj->mks_obj_id != ID_F_RETURN) disp_fan_value();
}
void lv_draw_fan() {
lv_obj_t *buttonAdd;
scr = lv_screen_create(FAN_UI);
// Create an Image button
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
lv_big_button_create(scr, "F:/bmp_Dec.bin", fan_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_F_DEC);
lv_big_button_create(scr, "F:/bmp_speed255.bin", fan_menu.full, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_HIGH);
lv_big_button_create(scr, "F:/bmp_speed127.bin", fan_menu.half, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_MID);
lv_big_button_create(scr, "F:/bmp_speed0.bin", fan_menu.off, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_OFF);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_RETURN);
fanText = lv_label_create_empty(scr);
lv_obj_set_style(fanText, &tft_style_label_rel);
disp_fan_value();
}
void disp_fan_value() {
#if HAS_FAN
sprintf_P(public_buf_l, PSTR("%s: %3d%%"), fan_menu.state, fanPercent);
#else
sprintf_P(public_buf_l, PSTR("%s: ---"), fan_menu.state);
#endif
lv_label_set_text(fanText, public_buf_l);
lv_obj_align(fanText, nullptr, LV_ALIGN_CENTER, 0, -65);
}
void lv_clear_fan() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_fan.cpp
|
C++
|
agpl-3.0
| 3,629
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_fan();
void lv_clear_fan();
void disp_fan_value();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_fan.h
|
C
|
agpl-3.0
| 1,042
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../module/temperature.h"
#include "../../../gcode/gcode.h"
#include "../../../module/motion.h"
#include "../../../module/planner.h"
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *buttonType;
static lv_obj_t *labelType;
static lv_obj_t *tempText1;
enum {
ID_FILAMNT_IN = 1,
ID_FILAMNT_OUT,
ID_FILAMNT_TYPE,
ID_FILAMNT_RETURN
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_FILAMNT_IN:
uiCfg.filament_load_heat_flg = true;
if (ABS(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)
) {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
}
else {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
}
}
break;
case ID_FILAMNT_OUT:
uiCfg.filament_unload_heat_flg = true;
if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
&& (ABS(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|| thermalManager.wholeDegHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
) {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
}
else {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
}
filament_sprayer_temp();
}
break;
case ID_FILAMNT_TYPE:
#if HAS_MULTI_EXTRUDER
uiCfg.extruderIndex = !uiCfg.extruderIndex;
#endif
disp_filament_type();
break;
case ID_FILAMNT_RETURN:
#if HAS_MULTI_EXTRUDER
if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED)
gcode.process_subcommands_now(uiCfg.extruderIndexBak == 1 ? F("T1") : F("T0"));
#endif
feedrate_mm_s = (float)uiCfg.moveSpeed_bak;
if (uiCfg.print_state == PAUSED)
planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
goto_previous_ui();
break;
}
}
void lv_draw_filament_change() {
scr = lv_screen_create(FILAMENTCHANGE_UI);
// Create an Image button
lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN);
lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW);
lv_big_button_create(scr, "F:/bmp_out.bin", filament_menu.out, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_FILAMNT_OUT);
buttonType = lv_imgbtn_create(scr, nullptr, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FILAMNT_TYPE);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable)
lv_group_add_obj(g, buttonType);
#endif
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FILAMNT_RETURN);
// Create labels on the image buttons
labelType = lv_label_create_empty(buttonType);
disp_filament_type();
tempText1 = lv_label_create_empty(scr);
lv_obj_set_style(tempText1, &tft_style_label_rel);
disp_filament_temp();
}
void disp_filament_type() {
if (uiCfg.extruderIndex == 1) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
else {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext1);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
}
void disp_filament_temp() {
char buf[20] = {0};
public_buf_l[0] = '\0';
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf);
lv_label_set_text(tempText1, public_buf_l);
lv_obj_align(tempText1, nullptr, LV_ALIGN_CENTER, 0, -50);
}
void lv_clear_filament_change() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp
|
C++
|
agpl-3.0
| 6,313
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_filament_change();
void lv_clear_filament_change();
void disp_filament_type();
void disp_filament_temp();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_filament_change.h
|
C
|
agpl-3.0
| 1,097
|
/**
* 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/>.
*
*/
#include "../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "draw_ui.h"
#include <lv_conf.h>
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr;
enum {
ID_FILAMENT_SET_RETURN = 1,
ID_FILAMENT_SET_IN_LENGTH,
ID_FILAMENT_SET_IN_SPEED,
ID_FILAMENT_SET_OUT_LENGTH,
ID_FILAMENT_SET_OUT_SPEED,
ID_FILAMENT_SET_TEMP,
ID_FILAMENT_SET_DOWN,
ID_FILAMENT_SET_UP
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_FILAMENT_SET_RETURN:
uiCfg.para_ui_page = false;
lv_clear_filament_settings();
draw_return_ui();
break;
case ID_FILAMENT_SET_IN_LENGTH:
value = load_length;
lv_clear_filament_settings();
lv_draw_number_key();
break;
case ID_FILAMENT_SET_IN_SPEED:
value = load_speed;
lv_clear_filament_settings();
lv_draw_number_key();
break;
case ID_FILAMENT_SET_OUT_LENGTH:
value = unload_length;
lv_clear_filament_settings();
lv_draw_number_key();
break;
case ID_FILAMENT_SET_OUT_SPEED:
value = unload_speed;
lv_clear_filament_settings();
lv_draw_number_key();
break;
case ID_FILAMENT_SET_TEMP:
value = filament_temp;
lv_clear_filament_settings();
lv_draw_number_key();
break;
case ID_FILAMENT_SET_UP:
uiCfg.para_ui_page = false;
lv_clear_filament_settings();
lv_draw_filament_settings();
break;
case ID_FILAMENT_SET_DOWN:
uiCfg.para_ui_page = true;
lv_clear_filament_settings();
lv_draw_filament_settings();
break;
}
}
void lv_draw_filament_settings() {
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
if (!uiCfg.para_ui_page) {
itoa(gCfgItems.filamentchange_load_length, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.InLength, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_IN_LENGTH, 0, public_buf_l);
itoa(gCfgItems.filamentchange_load_speed, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.InSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SET_IN_SPEED, 1, public_buf_l);
itoa(gCfgItems.filamentchange_unload_length, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.OutLength, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_FILAMENT_SET_OUT_LENGTH, 2, public_buf_l);
itoa(gCfgItems.filamentchange_unload_speed, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.OutSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_FILAMENT_SET_OUT_SPEED, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true);
}
else {
itoa(gCfgItems.filament_limit_temp, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true);
}
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_FILAMENT_SET_RETURN, true);
}
void lv_clear_filament_settings() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_filament_settings.cpp
|
C++
|
agpl-3.0
| 4,491
|
/**
* 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/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void lv_draw_filament_settings();
void lv_clear_filament_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
|
2301_81045437/Marlin
|
Marlin/src/lcd/extui/mks_ui/draw_filament_settings.h
|
C
|
agpl-3.0
| 1,047
|