-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement mesh editor to FTDI Eve Touch UI.
- Loading branch information
Showing
9 changed files
with
204 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/adjuster_widget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*********************** | ||
* adjuster_widget.cpp * | ||
***********************/ | ||
|
||
/**************************************************************************** | ||
* Written By Marcio Teixeira 2021 - Cocoa Press * | ||
* * | ||
* This program is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* To view a copy of the GNU General Public License, go to the following * | ||
* location: <https://www.gnu.org/licenses/>. * | ||
****************************************************************************/ | ||
|
||
#include "../ftdi_eve_lib.h" | ||
#include "../extended/grid_layout.h" | ||
|
||
#include "adjuster_widget.h" | ||
|
||
#define SUB_COLS 9 | ||
#define SUB_ROWS 1 | ||
#define VAL_POS SUB_POS(1,1), SUB_SIZE(5,1) | ||
#define INC_POS SUB_POS(6,1), SUB_SIZE(2,1) | ||
#define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1) | ||
|
||
void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, progmem_str units, int8_t width, uint8_t precision, draw_mode_t what) { | ||
if (what & BACKGROUND) | ||
cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT); | ||
|
||
if (what & FOREGROUND) { | ||
char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)]; | ||
if (isnan(value)) | ||
strcpy_P(str, PSTR("-")); | ||
else | ||
dtostrf(value, width, precision, str); | ||
|
||
if (units) { | ||
strcat_P(str, PSTR(" ")); | ||
strcat_P(str, (const char*) units); | ||
} | ||
|
||
cmd.tag(0) | ||
.text(VAL_POS, str) | ||
.tag(tag ).button(INC_POS, F("-")) | ||
.tag(tag+1).button(DEC_POS, F("+")); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/adjuster_widget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/********************* | ||
* adjuster_widget.h * | ||
*********************/ | ||
|
||
/**************************************************************************** | ||
* Written By Marcio Teixeira 2021 - Cocoa Press * | ||
* * | ||
* This program is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* To view a copy of the GNU General Public License, go to the following * | ||
* location: <https://www.gnu.org/licenses/>. * | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
#include "../extended/screen_types.h" | ||
|
||
void draw_adjuster( | ||
CommandProcessor& cmd, | ||
int16_t x, int16_t y, int16_t w, int16_t h, | ||
uint8_t tag, | ||
float value, progmem_str units = nullptr, | ||
int8_t width = 5, uint8_t precision = 1, | ||
draw_mode_t what = BOTH | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters