Bump to head

This commit is contained in:
InsanityAutomation
2019-08-25 18:47:00 -04:00
parent aeb3f75120
commit 18d1653ef6
734 changed files with 73734 additions and 6881 deletions
+4 -4
View File
@@ -242,12 +242,12 @@ jobs:
echo testing STM32F1 targets...
export TEST_PLATFORM="-e STM32F1"
restore_configs
echo use_example_configs STM32F10
use_example_configs STM32F10
echo use_example_configs STM32/STM32F10
use_example_configs STM32/STM32F10
build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs
echo use_example_configs stm32f103ret6
use_example_configs stm32f103ret6
echo use_example_configs STM32/stm32f103ret6
use_example_configs STM32/stm32f103ret6
build_marlin_pio ./ ${TEST_PLATFORM}
restore_configs
+1
View File
@@ -0,0 +1 @@
custom: http://www.thinkyhead.com/donate-to-marlin
+3
View File
@@ -114,9 +114,12 @@ void HAL_init(void);
inline void HAL_clear_reset_source(void) { MCUSR = 0; }
inline uint8_t HAL_get_reset_source(void) { return MCUSR; }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// timers
#define HAL_TIMER_RATE ((F_CPU) / 8) // i.e., 2MHz or 2.5MHz
+5 -1
View File
@@ -156,12 +156,16 @@ void HAL_init(void);
// Utility functions
//
void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
#ifdef __cplusplus
extern "C" {
#endif
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s);
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
#ifdef __cplusplus
}
#endif
@@ -23,6 +23,7 @@
#include "../../../inc/MarlinConfigPre.h"
#include "../../shared/Marduino.h"
#include <U8glib.h>
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index);
void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level);
+1 -1
View File
@@ -70,7 +70,7 @@
const uint32_t mask = MASK(DIO ## IO ## _PIN); \
if (V) port->PIO_SODR = mask; \
else port->PIO_CODR = mask; \
} while(0)
}while(0)
// Toggle a pin
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
+6 -6
View File
@@ -112,7 +112,7 @@
* \def unused
* \brief Marking \a v as a unused parameter or value.
*/
#define unused(v) do { (void)(v); } while(0)
#define unused(v) do { (void)(v); }while(0)
/**
* \def barrier
@@ -169,7 +169,7 @@
* heuristics and inline the function no matter how big it thinks it
* becomes.
*/
#if defined(__CC_ARM)
#ifdef __CC_ARM
# define __always_inline __forceinline
#elif (defined __GNUC__)
#ifdef __always_inline
@@ -187,7 +187,7 @@
* This annotation instructs the compiler to ignore its inlining
* heuristics and not inline the function.
*/
#if defined(__CC_ARM)
#ifdef __CC_ARM
# define __no_inline __attribute__((noinline))
#elif (defined __GNUC__)
# define __no_inline __attribute__((__noinline__))
@@ -204,7 +204,7 @@
*
* \param expr Expression to evaluate and supposed to be nonzero.
*/
#if defined(_ASSERT_ENABLE_)
#ifdef _ASSERT_ENABLE_
# if defined(TEST_SUITE_DEFINE_ASSERT_MACRO)
// Assert() is defined in unit_test/suite.h
# include "unit_test/suite.h"
@@ -998,14 +998,14 @@ typedef U8 Byte; //!< 8-bit unsigned integer.
#endif // #ifndef __ASSEMBLY__
#if defined(__ICCARM__)
#ifdef __ICCARM__
#define SHORTENUM __packed
#elif defined(__GNUC__)
#define SHORTENUM __attribute__((packed))
#endif
/* No operation */
#if defined(__ICCARM__)
#ifdef __ICCARM__
#define nop() __no_operation()
#elif defined(__GNUC__)
#define nop() (__NOP())
+3
View File
@@ -92,7 +92,10 @@ uint8_t HAL_get_reset_source(void);
void _delay_ms(int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
void analogWrite(pin_t pin, int value);
+3
View File
@@ -81,7 +81,10 @@ extern HalSerial usb_serial;
inline void HAL_init(void) { }
// Utility functions
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only)
/** Write single byte to specified SPI channel */
+4 -4
View File
@@ -142,10 +142,10 @@ public:
void print_bin(uint32_t value, uint8_t num_digits) {
uint32_t mask = 1 << (num_digits -1);
for (uint8_t i = 0; i < num_digits; i++) {
if (!(i % 4) && i) write(' ');
if (!(i % 16) && i) write(' ');
if (value & mask) write('1');
else write('0');
if (!(i % 4) && i) write(' ');
if (!(i % 16) && i) write(' ');
if (value & mask) write('1');
else write('0');
value <<= 1;
}
}
+3
View File
@@ -111,7 +111,10 @@ extern "C" volatile uint32_t _millis;
//
// Utility functions
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
//
// SPI: Extended functions taking a channel number (Hardware SPI only)
@@ -17,7 +17,7 @@ def print_error(e):
print('\nUnable to find destination disk (' + e + ')\n' \
'Please select it in platformio.ini using the upload_port keyword ' \
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
'or copy the firmware (.pio/build/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
try:
if current_OS == 'Windows':
+31 -7
View File
@@ -1,13 +1,37 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(EMERGENCY_PARSER)
#include "../../feature/emergency_parser.h"
EmergencyParser::State emergency_state;
bool CDC_RecvCallback(const char buffer) {
emergency_parser.update(emergency_state, buffer);
return true;
}
#endif // ENABLED(EMERGENCY_PARSER)
#include "../../feature/emergency_parser.h"
EmergencyParser::State emergency_state;
bool CDC_RecvCallback(const char buffer) {
emergency_parser.update(emergency_state, buffer);
return true;
}
#endif // EMERGENCY_PARSER
#endif // TARGET_LPC1768
+2 -2
View File
@@ -59,12 +59,12 @@
#else
#define GET_TEMP_5_ADC() -1
#endif
#if HAS_HEATED_BED
#if HAS_TEMP_ADC_BED
#define GET_BED_ADC() PIN_TO_ADC(TEMP_BED_PIN)
#else
#define GET_BED_ADC() -1
#endif
#if HAS_HEATED_CHAMBER
#if HAS_TEMP_ADC_CHAMBER
#define GET_CHAMBER_ADC() PIN_TO_ADC(TEMP_CHAMBER_PIN)
#else
#define GET_CHAMBER_ADC() -1
+8 -2
View File
@@ -132,11 +132,17 @@ void noTone(const pin_t _pin);
// Enable hooks into idle and setup for HAL
void HAL_init(void);
/*#define HAL_IDLETASK 1
void HAL_idletask(void);*/
/*
#define HAL_IDLETASK 1
void HAL_idletask(void);
*/
//
// Utility functions
//
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
+2 -2
View File
@@ -115,12 +115,12 @@ HAL_SERVO_TIMER_ISR() {
tc->COUNT16.CC[tcChannel].reg = (uint16_t)(tcCounterValue - 4UL); // at least REFRESH_INTERVAL has elapsed
}
if (tcChannel == 0) {
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
// Clear the interrupt
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0;
}
else {
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
// Clear the interrupt
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1;
}
@@ -243,6 +243,7 @@
#define DIO5_PIN PIN_PC21
#define DIO16_PIN PIN_PC22
#define DIO17_PIN PIN_PC23
#define DIO88_PIN PIN_PC24 // NEOPIXEL
// PORTD
#define DIO22_PIN PIN_PD12
#define DIO6_PIN PIN_PD20
+1 -1
View File
@@ -32,7 +32,7 @@
#endif
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue."
#error "EMERGENCY_PARSER is not yet implemented for SAMD51. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(SDIO_SUPPORT)
+13 -8
View File
@@ -136,7 +136,7 @@ typedef int16_t pin_t;
// Public Variables
// ------------------------
/** result of last ADC conversion */
// result of last ADC conversion
extern uint16_t HAL_adc_result;
// ------------------------
@@ -149,30 +149,35 @@ extern uint16_t HAL_adc_result;
// Enable hooks into setup for HAL
void HAL_init(void);
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source (void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
extern "C" char* _sbrk(int incr);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline int freeMemory() {
volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0));
}
#pragma GCC diagnostic pop
//
// SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */
// Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);
//
@@ -182,8 +187,8 @@ uint8_t spiRec(uint32_t chan);
// Wire library should work for i2c EEPROMs
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
//
// ADC
+14 -9
View File
@@ -22,7 +22,6 @@
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../inc/MarlinConfig.h"
#include <SPI.h>
@@ -73,16 +72,22 @@ void spiInit(uint8_t spiRate) {
// Use datarates Marlin uses
uint32_t clock;
switch (spiRate) {
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
case SPI_HALF_SPEED: clock = 5000000; break;
case SPI_QUARTER_SPEED: clock = 2500000; break;
case SPI_EIGHTH_SPEED: clock = 1250000; break;
case SPI_SPEED_5: clock = 625000; break;
case SPI_SPEED_6: clock = 300000; break;
default:
clock = 4000000; // Default from the SPI library
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
case SPI_HALF_SPEED: clock = 5000000; break;
case SPI_QUARTER_SPEED: clock = 2500000; break;
case SPI_EIGHTH_SPEED: clock = 1250000; break;
case SPI_SPEED_5: clock = 625000; break;
case SPI_SPEED_6: clock = 300000; break;
default:
clock = 4000000; // Default from the SPI library
}
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
#if defined(MISO_PIN) && defined(SDSS) && defined(MOSI_PIN) && defined(SCK_PIN)
SPI.setMISO(MISO_PIN);
SPI.setSSEL(SDSS);
SPI.setMOSI(MOSI_PIN);
SPI.setSCLK(SCK_PIN);
#endif
SPI.begin();
}
+1 -1
View File
@@ -53,7 +53,7 @@ void FastIO_init(); // Must be called before using fast io macros
#define _WRITE(IO, V) do { \
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
} while(0)
}while(0)
#else
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + (V ? 0 : 16)))
#endif
@@ -21,24 +21,23 @@
*/
/**
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
* Implementation of EEPROM settings in SD Card
*/
#ifdef TARGET_STM32F4
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
#include "../shared/persistent_store_api.h"
#ifndef E2END
#define E2END 0xFFF // 4KB
#endif
#define HAL_EEPROM_SIZE (E2END + 1) // 16KB
#define HAL_EEPROM_SIZE int(E2END + 1)
#define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat.
#define _ALIGN(x) __attribute__ ((aligned(x)))
static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
#if ENABLED(SDSUPPORT)
@@ -52,11 +51,11 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
SdFile file, root = card.getroot();
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
return false;
return true;
int16_t bytes_read = file.read(HAL_eeprom_data, HAL_STM32F4_EEPROM_SIZE);
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
if (bytes_read < 0) return false;
for (; bytes_read < HAL_STM32F4_EEPROM_SIZE; bytes_read++)
for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++)
HAL_eeprom_data[bytes_read] = 0xFF;
file.close();
return true;
@@ -66,17 +65,17 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
if (!card.isDetected()) return false;
SdFile file, root = card.getroot();
int16_t bytes_written = 0;
int bytes_written = 0;
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
bytes_written = file.write(HAL_eeprom_data, HAL_STM32F4_EEPROM_SIZE);
bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE);
file.close();
}
return (bytes_written == HAL_STM32F4_EEPROM_SIZE);
return (bytes_written == HAL_EEPROM_SIZE);
}
#else // !SDSUPPORT
#error "Please define SPI_EEPROM (in Configuration.h) or disable EEPROM_SETTINGS."
#error "Please define an EEPROM, a SDCARD or disable EEPROM_SETTINGS."
#endif // !SDSUPPORT
@@ -98,7 +97,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false;
}
size_t PersistentStore::capacity() { return HAL_STM32F4_EEPROM_SIZE; }
size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
#endif // EEPROM_SETTINGS
#endif // __STM32F4__
#endif // STM32
@@ -189,7 +189,7 @@ void port_print(const pin_t Ard_num) {
for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++)
if (Ard_num == GET_PIN_MAP_PIN_M43(Index)) break;
char * const ppa = pin_xref[Index].Port_pin_alpha;
const char * ppa = pin_xref[Index].Port_pin_alpha;
sprintf_P(buffer, PSTR("%s"), ppa);
SERIAL_ECHO(buffer);
if (ppa[3] == '\0') SERIAL_CHAR(' ');
+2 -2
View File
@@ -93,7 +93,7 @@ uint16_t HAL_adc_result;
// ------------------------
STM32ADC adc(ADC1);
uint8_t adc_pins[] = {
const uint8_t adc_pins[] = {
#if HAS_TEMP_ADC_0
TEMP_0_PIN,
#endif
@@ -270,7 +270,7 @@ void HAL_adc_init(void) {
#else
adc.setSampleRate(ADC_SMPR_41_5); // 41.5 ADC cycles
#endif
adc.setPins(adc_pins, ADC_PIN_COUNT);
adc.setPins((uint8_t *)adc_pins, ADC_PIN_COUNT);
adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), nullptr);
adc.setScanMode();
adc.setContinuous();
+10 -9
View File
@@ -158,7 +158,7 @@ typedef int8_t pin_t;
// Public Variables
// ------------------------
/** result of last ADC conversion */
// Result of last ADC conversion
extern uint16_t HAL_adc_result;
// ------------------------
@@ -174,14 +174,17 @@ extern uint16_t HAL_adc_result;
// Memory related
#define __bss_end __bss_end__
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source(void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/*
extern "C" {
int freeMemory(void);
@@ -189,6 +192,7 @@ extern "C" {
*/
extern "C" char* _sbrk(int incr);
/*
static int freeMemory() {
volatile int top;
@@ -197,9 +201,6 @@ static int freeMemory() {
}
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int freeMemory() {
volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0));
@@ -211,11 +212,11 @@ static int freeMemory() {
// SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */
// Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);
//
@@ -33,7 +33,7 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include <SPI.h>
#include "SPI.h"
// ------------------------
// Public functions
@@ -64,10 +64,9 @@
* @details Only configures SS pin since libmaple creates and initialize the SPI object
*/
void spiBegin() {
#if !PIN_EXISTS(SS)
#error "SS_PIN not defined!"
#if PIN_EXISTS(SS)
OUT_WRITE(SS_PIN, HIGH);
#endif
OUT_WRITE(SS_PIN, HIGH);
}
/**
+741
View File
@@ -0,0 +1,741 @@
/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*****************************************************************************/
/**
* @author Marti Bolivar <mbolivar@leaflabs.com>
* @brief Wirish SPI implementation.
*/
#ifdef __STM32F1__
#include "SPI.h"
#include <libmaple/timer.h>
#include <libmaple/util.h>
#include <libmaple/rcc.h>
#include <boards.h>
#include <wirish.h>
/** Time in ms for DMA receive timeout */
#define DMA_TIMEOUT 100
#if CYCLES_PER_MICROSECOND != 72
#warning "Unexpected clock speed; SPI frequency calculation will be incorrect"
#endif
struct spi_pins {
uint8_t nss;
uint8_t sck;
uint8_t miso;
uint8_t mosi;
};
static const spi_pins* dev_to_spi_pins(spi_dev *dev);
static void configure_gpios(spi_dev *dev, bool as_master);
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq);
#if (BOARD_NR_SPI >= 3) && !defined(STM32_HIGH_DENSITY)
#error "The SPI library is misconfigured: 3 SPI ports only available on high density STM32 devices"
#endif
static const spi_pins board_spi_pins[] __FLASH__ = {
#if BOARD_NR_SPI >= 1
{ BOARD_SPI1_NSS_PIN,
BOARD_SPI1_SCK_PIN,
BOARD_SPI1_MISO_PIN,
BOARD_SPI1_MOSI_PIN },
#endif
#if BOARD_NR_SPI >= 2
{ BOARD_SPI2_NSS_PIN,
BOARD_SPI2_SCK_PIN,
BOARD_SPI2_MISO_PIN,
BOARD_SPI2_MOSI_PIN },
#endif
#if BOARD_NR_SPI >= 3
{ BOARD_SPI3_NSS_PIN,
BOARD_SPI3_SCK_PIN,
BOARD_SPI3_MISO_PIN,
BOARD_SPI3_MOSI_PIN },
#endif
};
#if BOARD_NR_SPI >= 1
static void (*_spi1_this);
#endif
#if BOARD_NR_SPI >= 2
static void (*_spi2_this);
#endif
#if BOARD_NR_SPI >= 3
static void (*_spi3_this);
#endif
/**
* Constructor
*/
SPIClass::SPIClass(uint32_t spi_num) {
_currentSetting=&_settings[spi_num-1];// SPI channels are called 1 2 and 3 but the array is zero indexed
switch (spi_num) {
#if BOARD_NR_SPI >= 1
case 1:
_currentSetting->spi_d = SPI1;
_spi1_this = (void*)this;
break;
#endif
#if BOARD_NR_SPI >= 2
case 2:
_currentSetting->spi_d = SPI2;
_spi2_this = (void*)this;
break;
#endif
#if BOARD_NR_SPI >= 3
case 3:
_currentSetting->spi_d = SPI3;
_spi3_this = (void*)this;
break;
#endif
default: ASSERT(0);
}
// Init things specific to each SPI device
// clock divider setup is a bit of hack, and needs to be improved at a later date.
#if BOARD_NR_SPI >= 1
_settings[0].spi_d = SPI1;
_settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock);
_settings[0].spiDmaDev = DMA1;
_settings[0].spiTxDmaChannel = DMA_CH3;
_settings[0].spiRxDmaChannel = DMA_CH2;
#endif
#if BOARD_NR_SPI >= 2
_settings[1].spi_d = SPI2;
_settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock);
_settings[1].spiDmaDev = DMA1;
_settings[1].spiTxDmaChannel = DMA_CH5;
_settings[1].spiRxDmaChannel = DMA_CH4;
#endif
#if BOARD_NR_SPI >= 3
_settings[2].spi_d = SPI3;
_settings[2].clockDivider = determine_baud_rate(_settings[2].spi_d, _settings[2].clock);
_settings[2].spiDmaDev = DMA2;
_settings[2].spiTxDmaChannel = DMA_CH2;
_settings[2].spiRxDmaChannel = DMA_CH1;
#endif
// added for DMA callbacks.
_currentSetting->state = SPI_STATE_IDLE;
}
/*
* Set up/tear down
*/
void SPIClass::updateSettings() {
uint32_t flags = ((_currentSetting->bitOrder == MSBFIRST ? SPI_FRAME_MSB : SPI_FRAME_LSB) | _currentSetting->dataSize | SPI_SW_SLAVE | SPI_SOFT_SS);
spi_master_enable(_currentSetting->spi_d, (spi_baud_rate)_currentSetting->clockDivider, (spi_mode)_currentSetting->dataMode, flags);
}
void SPIClass::begin() {
spi_init(_currentSetting->spi_d);
configure_gpios(_currentSetting->spi_d, 1);
updateSettings();
// added for DMA callbacks.
_currentSetting->state = SPI_STATE_READY;
}
void SPIClass::beginSlave() {
spi_init(_currentSetting->spi_d);
configure_gpios(_currentSetting->spi_d, 0);
uint32_t flags = ((_currentSetting->bitOrder == MSBFIRST ? SPI_FRAME_MSB : SPI_FRAME_LSB) | _currentSetting->dataSize);
spi_slave_enable(_currentSetting->spi_d, (spi_mode)_currentSetting->dataMode, flags);
// added for DMA callbacks.
_currentSetting->state = SPI_STATE_READY;
}
void SPIClass::end() {
if (!spi_is_enabled(_currentSetting->spi_d))
return;
// Follows RM0008's sequence for disabling a SPI in master/slave
// full duplex mode.
while (spi_is_rx_nonempty(_currentSetting->spi_d)) {
// FIXME [0.1.0] remove this once you have an interrupt based driver
volatile uint16_t rx __attribute__((unused)) = spi_rx_reg(_currentSetting->spi_d);
}
while (!spi_is_tx_empty(_currentSetting->spi_d)) {};
while (spi_is_busy(_currentSetting->spi_d)) {};
spi_peripheral_disable(_currentSetting->spi_d);
// added for DMA callbacks.
// Need to add unsetting the callbacks for the DMA channels.
_currentSetting->state = SPI_STATE_IDLE;
}
/* Roger Clark added 3 functions */
void SPIClass::setClockDivider(uint32_t clockDivider) {
_currentSetting->clockDivider = clockDivider;
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_BR);
_currentSetting->spi_d->regs->CR1 = cr1 | (clockDivider & SPI_CR1_BR);
}
void SPIClass::setBitOrder(BitOrder bitOrder) {
_currentSetting->bitOrder = bitOrder;
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_LSBFIRST);
if (bitOrder == LSBFIRST) cr1 |= SPI_CR1_LSBFIRST;
_currentSetting->spi_d->regs->CR1 = cr1;
}
/* Victor Perez. Added to test changing datasize from 8 to 16 bit modes on the fly.
* Input parameter should be SPI_CR1_DFF set to 0 or 1 on a 32bit word.
*
*/
void SPIClass::setDataSize(uint32_t datasize) {
_currentSetting->dataSize = datasize;
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_DFF);
uint8_t en = spi_is_enabled(_currentSetting->spi_d);
spi_peripheral_disable(_currentSetting->spi_d);
_currentSetting->spi_d->regs->CR1 = cr1 | (datasize & SPI_CR1_DFF) | en;
}
void SPIClass::setDataMode(uint8_t dataMode) {
/* Notes:
As far as I can tell, the AVR numbers for dataMode appear to match the numbers required by the STM32
From the AVR doc http://www.atmel.com/images/doc2585.pdf section 2.4
SPI Mode CPOL CPHA Shift SCK-edge Capture SCK-edge
0 0 0 Falling Rising
1 0 1 Rising Falling
2 1 0 Rising Falling
3 1 1 Falling Rising
On the STM32 it appears to be
bit 1 - CPOL : Clock polarity
(This bit should not be changed when communication is ongoing)
0 : CLK to 0 when idle
1 : CLK to 1 when idle
bit 0 - CPHA : Clock phase
(This bit should not be changed when communication is ongoing)
0 : The first clock transition is the first data capture edge
1 : The second clock transition is the first data capture edge
If someone finds this is not the case or sees a logic error with this let me know ;-)
*/
_currentSetting->dataMode = dataMode;
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_CPOL|SPI_CR1_CPHA);
_currentSetting->spi_d->regs->CR1 = cr1 | (dataMode & (SPI_CR1_CPOL|SPI_CR1_CPHA));
}
void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) {
setBitOrder(settings.bitOrder);
setDataMode(settings.dataMode);
setDataSize(settings.dataSize);
setClockDivider(determine_baud_rate(_currentSetting->spi_d, settings.clock));
begin();
}
void SPIClass::beginTransactionSlave(SPISettings settings) {
setBitOrder(settings.bitOrder);
setDataMode(settings.dataMode);
setDataSize(settings.dataSize);
beginSlave();
}
void SPIClass::endTransaction() { }
/*
* I/O
*/
uint16_t SPIClass::read() {
while ( spi_is_rx_nonempty(_currentSetting->spi_d)==0 ) ;
return (uint16)spi_rx_reg(_currentSetting->spi_d);
}
void SPIClass::read(uint8_t *buf, uint32_t len) {
if (len == 0) return;
spi_rx_reg(_currentSetting->spi_d); // clear the RX buffer in case a byte is waiting on it.
spi_reg_map * regs = _currentSetting->spi_d->regs;
// start sequence: write byte 0
regs->DR = 0x00FF; // write the first byte
// main loop
while ( (--len) ) {
while( !(regs->SR & SPI_SR_TXE) ); // wait for TXE flag
noInterrupts(); // go atomic level - avoid interrupts to surely get the previously received data
regs->DR = 0x00FF; // write the next data item to be transmitted into the SPI_DR register. This clears the TXE flag.
while ( !(regs->SR & SPI_SR_RXNE) ); // wait till data is available in the DR register
*buf++ = (uint8)(regs->DR); // read and store the received byte. This clears the RXNE flag.
interrupts(); // let systick do its job
}
// read remaining last byte
while ( !(regs->SR & SPI_SR_RXNE) ) {} // wait till data is available in the Rx register
*buf++ = (uint8)(regs->DR); // read and store the received byte
}
void SPIClass::write(uint16_t data) {
/* Added for 16bit data Victor Perez. Roger Clark
* Improved speed by just directly writing the single byte to the SPI data reg and wait for completion,
* by taking the Tx code from transfer(byte)
* This almost doubles the speed of this function.
*/
spi_tx_reg(_currentSetting->spi_d, data); // write the data to be transmitted into the SPI_DR register (this clears the TXE flag)
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
}
void SPIClass::write16(uint16_t data) {
// Added by stevestrong: write two consecutive bytes in 8 bit mode (DFF=0)
spi_tx_reg(_currentSetting->spi_d, data>>8); // write high byte
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // Wait until TXE=1
spi_tx_reg(_currentSetting->spi_d, data); // write low byte
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // Wait until TXE=1
while (spi_is_busy(_currentSetting->spi_d) != 0); // wait until BSY=0
}
void SPIClass::write(uint16_t data, uint32_t n) {
// Added by stevstrong: Repeatedly send same data by the specified number of times
spi_reg_map * regs = _currentSetting->spi_d->regs;
while ( (n--)>0 ) {
regs->DR = data; // write the data to be transmitted into the SPI_DR register (this clears the TXE flag)
while ( (regs->SR & SPI_SR_TXE)==0 ) ; // wait till Tx empty
}
while ( (regs->SR & SPI_SR_BSY) != 0); // wait until BSY=0 before returning
}
void SPIClass::write(const void *data, uint32_t length) {
spi_dev * spi_d = _currentSetting->spi_d;
spi_tx(spi_d, data, length); // data can be array of bytes or words
while (spi_is_tx_empty(spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
}
uint8_t SPIClass::transfer(uint8_t byte) const {
spi_dev * spi_d = _currentSetting->spi_d;
spi_rx_reg(spi_d); // read any previous data
spi_tx_reg(spi_d, byte); // Write the data item to be transmitted into the SPI_DR register
while (spi_is_tx_empty(spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
return (uint8)spi_rx_reg(spi_d); // "... and read the last received data."
}
uint16_t SPIClass::transfer16(uint16_t data) const {
// Modified by stevestrong: write & read two consecutive bytes in 8 bit mode (DFF=0)
// This is more effective than two distinct byte transfers
spi_dev * spi_d = _currentSetting->spi_d;
spi_rx_reg(spi_d); // read any previous data
spi_tx_reg(spi_d, data>>8); // write high byte
while (spi_is_tx_empty(spi_d) == 0); // wait until TXE=1
while (spi_is_busy(spi_d) != 0); // wait until BSY=0
uint16_t ret = spi_rx_reg(spi_d)<<8; // read and shift high byte
spi_tx_reg(spi_d, data); // write low byte
while (spi_is_tx_empty(spi_d) == 0); // wait until TXE=1
while (spi_is_busy(spi_d) != 0); // wait until BSY=0
ret += spi_rx_reg(spi_d); // read low byte
return ret;
}
/* Roger Clark and Victor Perez, 2015
* Performs a DMA SPI transfer with at least a receive buffer.
* If a TX buffer is not provided, FF is sent over and over for the lenght of the transfer.
* On exit TX buffer is not modified, and RX buffer cotains the received data.
* Still in progress.
*/
void SPIClass::dmaTransferSet(const void *transmitBuf, void *receiveBuf) {
dma_init(_currentSetting->spiDmaDev);
//spi_rx_dma_enable(_currentSetting->spi_d);
//spi_tx_dma_enable(_currentSetting->spi_d);
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &_currentSetting->spi_d->regs->DR,
dma_bit_size, receiveBuf, dma_bit_size, (DMA_MINC_MODE | DMA_TRNS_CMPLT ));// receive buffer DMA
if (!transmitBuf) {
transmitBuf = &ff;
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, (DMA_FROM_MEM));// Transmit FF repeatedly
}
else {
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, (DMA_MINC_MODE | DMA_FROM_MEM ));// Transmit buffer DMA
}
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, DMA_PRIORITY_LOW);
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, DMA_PRIORITY_VERY_HIGH);
}
uint8_t SPIClass::dmaTransferRepeat(uint16_t length) {
if (length == 0) return 0;
if (spi_is_rx_nonempty(_currentSetting->spi_d) == 1) spi_rx_reg(_currentSetting->spi_d);
_currentSetting->state = SPI_STATE_TRANSFER;
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, length);
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);// enable receive
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
spi_rx_dma_enable(_currentSetting->spi_d);
spi_tx_dma_enable(_currentSetting->spi_d);
if (_currentSetting->receiveCallback)
return 0;
//uint32_t m = millis();
uint8_t b = 0;
uint32_t m = millis();
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1) == 0) {
//Avoid interrupts and just loop waiting for the flag to be set.
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
}
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
spi_tx_dma_disable(_currentSetting->spi_d);
spi_rx_dma_disable(_currentSetting->spi_d);
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
_currentSetting->state = SPI_STATE_READY;
return b;
}
/* Roger Clark and Victor Perez, 2015
* Performs a DMA SPI transfer with at least a receive buffer.
* If a TX buffer is not provided, FF is sent over and over for the length of the transfer.
* On exit TX buffer is not modified, and RX buffer contains the received data.
* Still in progress.
*/
uint8_t SPIClass::dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length) {
dmaTransferSet(transmitBuf, receiveBuf);
return dmaTransferRepeat(length);
}
/* Roger Clark and Victor Perez, 2015
* Performs a DMA SPI send using a TX buffer.
* On exit TX buffer is not modified.
* Still in progress.
* 2016 - stevstrong - reworked to automatically detect bit size from SPI setting
*/
void SPIClass::dmaSendSet(const void * transmitBuf, bool minc) {
uint32_t flags = ( (DMA_MINC_MODE*minc) | DMA_FROM_MEM | DMA_TRNS_CMPLT);
dma_init(_currentSetting->spiDmaDev);
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR, dma_bit_size,
(volatile void*)transmitBuf, dma_bit_size, flags);// Transmit buffer DMA
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, DMA_PRIORITY_LOW);
}
uint8_t SPIClass::dmaSendRepeat(uint16_t length) {
if (length == 0) return 0;
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
_currentSetting->state = SPI_STATE_TRANSMIT;
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
spi_tx_dma_enable(_currentSetting->spi_d);
if (_currentSetting->transmitCallback)
return 0;
uint32_t m = millis();
uint8_t b = 0;
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1)==0) {
//Avoid interrupts and just loop waiting for the flag to be set.
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
}
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
spi_tx_dma_disable(_currentSetting->spi_d);
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
_currentSetting->state = SPI_STATE_READY;
return b;
}
uint8_t SPIClass::dmaSend(const void * transmitBuf, uint16_t length, bool minc) {
dmaSendSet(transmitBuf, minc);
return dmaSendRepeat(length);
}
uint8_t SPIClass::dmaSendAsync(const void * transmitBuf, uint16_t length, bool minc) {
uint8_t b = 0;
if (_currentSetting->state != SPI_STATE_READY) {
uint32_t m = millis();
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1)==0) {
//Avoid interrupts and just loop waiting for the flag to be set.
//delayMicroseconds(10);
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
}
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
spi_tx_dma_disable(_currentSetting->spi_d);
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
_currentSetting->state = SPI_STATE_READY;
}
if (length == 0) return 0;
uint32_t flags = ( (DMA_MINC_MODE*minc) | DMA_FROM_MEM | DMA_TRNS_CMPLT);
dma_init(_currentSetting->spiDmaDev);
// TX
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, flags);// Transmit buffer DMA
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
spi_tx_dma_enable(_currentSetting->spi_d);
_currentSetting->state = SPI_STATE_TRANSMIT;
return b;
}
/**
* New functions added to manage callbacks.
* Victor Perez 2017
*/
void SPIClass::onReceive(void(*callback)(void)) {
_currentSetting->receiveCallback = callback;
if (callback) {
switch (_currentSetting->spi_d->clk_id) {
#if BOARD_NR_SPI >= 1
case RCC_SPI1:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi1EventCallback);
break;
#endif
#if BOARD_NR_SPI >= 2
case RCC_SPI2:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi2EventCallback);
break;
#endif
#if BOARD_NR_SPI >= 3
case RCC_SPI3:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi3EventCallback);
break;
#endif
default:
ASSERT(0);
}
}
else {
dma_detach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
}
}
void SPIClass::onTransmit(void(*callback)(void)) {
_currentSetting->transmitCallback = callback;
if (callback) {
switch (_currentSetting->spi_d->clk_id) {
#if BOARD_NR_SPI >= 1
case RCC_SPI1:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi1EventCallback);
break;
#endif
#if BOARD_NR_SPI >= 2
case RCC_SPI2:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi2EventCallback);
break;
#endif
#if BOARD_NR_SPI >= 3
case RCC_SPI3:
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi3EventCallback);
break;
#endif
default:
ASSERT(0);
}
}
else {
dma_detach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
}
}
/**
* TODO: check if better to first call the customer code, next disable the DMA requests.
* Also see if we need to check whether callbacks are set or not, may be better to be checked
* during the initial setup and only set the callback to EventCallback if they are set.
*/
void SPIClass::EventCallback() {
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0"
switch (_currentSetting->state) {
case SPI_STATE_TRANSFER:
while (spi_is_rx_nonempty(_currentSetting->spi_d));
_currentSetting->state = SPI_STATE_READY;
spi_tx_dma_disable(_currentSetting->spi_d);
spi_rx_dma_disable(_currentSetting->spi_d);
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
if (_currentSetting->receiveCallback)
_currentSetting->receiveCallback();
break;
case SPI_STATE_TRANSMIT:
_currentSetting->state = SPI_STATE_READY;
spi_tx_dma_disable(_currentSetting->spi_d);
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
if (_currentSetting->transmitCallback)
_currentSetting->transmitCallback();
break;
default:
break;
}
}
void SPIClass::attachInterrupt() {
// Should be enableInterrupt()
}
void SPIClass::detachInterrupt() {
// Should be disableInterrupt()
}
/*
* Pin accessors
*/
uint8_t SPIClass::misoPin() {
return dev_to_spi_pins(_currentSetting->spi_d)->miso;
}
uint8_t SPIClass::mosiPin() {
return dev_to_spi_pins(_currentSetting->spi_d)->mosi;
}
uint8_t SPIClass::sckPin() {
return dev_to_spi_pins(_currentSetting->spi_d)->sck;
}
uint8_t SPIClass::nssPin() {
return dev_to_spi_pins(_currentSetting->spi_d)->nss;
}
/*
* Deprecated functions
*/
uint8_t SPIClass::send(uint8_t data) {
this->write(data);
return 1;
}
uint8_t SPIClass::send(uint8_t *buf, uint32_t len) {
this->write(buf, len);
return len;
}
uint8_t SPIClass::recv() {
return this->read();
}
/*
* DMA call back functions, one per port.
*/
#if BOARD_NR_SPI >= 1
void SPIClass::_spi1EventCallback() {
reinterpret_cast<class SPIClass*>(_spi1_this)->EventCallback();
}
#endif
#if BOARD_NR_SPI >= 2
void SPIClass::_spi2EventCallback() {
reinterpret_cast<class SPIClass*>(_spi2_this)->EventCallback();
}
#endif
#if BOARD_NR_SPI >= 3
void SPIClass::_spi3EventCallback() {
reinterpret_cast<class SPIClass*>(_spi3_this)->EventCallback();
}
#endif
/*
* Auxiliary functions
*/
static const spi_pins* dev_to_spi_pins(spi_dev *dev) {
switch (dev->clk_id) {
#if BOARD_NR_SPI >= 1
case RCC_SPI1: return board_spi_pins;
#endif
#if BOARD_NR_SPI >= 2
case RCC_SPI2: return board_spi_pins + 1;
#endif
#if BOARD_NR_SPI >= 3
case RCC_SPI3: return board_spi_pins + 2;
#endif
default: return NULL;
}
}
static void disable_pwm(const stm32_pin_info *i) {
if (i->timer_device)
timer_set_mode(i->timer_device, i->timer_channel, TIMER_DISABLED);
}
static void configure_gpios(spi_dev *dev, bool as_master) {
const spi_pins *pins = dev_to_spi_pins(dev);
if (!pins) return;
const stm32_pin_info *nssi = &PIN_MAP[pins->nss],
*scki = &PIN_MAP[pins->sck],
*misoi = &PIN_MAP[pins->miso],
*mosii = &PIN_MAP[pins->mosi];
disable_pwm(nssi);
disable_pwm(scki);
disable_pwm(misoi);
disable_pwm(mosii);
spi_config_gpios(dev, as_master, nssi->gpio_device, nssi->gpio_bit,
scki->gpio_device, scki->gpio_bit, misoi->gpio_bit,
mosii->gpio_bit);
}
static const spi_baud_rate baud_rates[8] __FLASH__ = {
SPI_BAUD_PCLK_DIV_2,
SPI_BAUD_PCLK_DIV_4,
SPI_BAUD_PCLK_DIV_8,
SPI_BAUD_PCLK_DIV_16,
SPI_BAUD_PCLK_DIV_32,
SPI_BAUD_PCLK_DIV_64,
SPI_BAUD_PCLK_DIV_128,
SPI_BAUD_PCLK_DIV_256,
};
/*
* Note: This assumes you're on a LeafLabs-style board
* (CYCLES_PER_MICROSECOND == 72, APB2 at 72MHz, APB1 at 36MHz).
*/
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq) {
uint32_t clock = 0;
switch (rcc_dev_clk(dev->clk_id)) {
case RCC_AHB:
case RCC_APB2: clock = STM32_PCLK2; break; // 72 Mhz
case RCC_APB1: clock = STM32_PCLK1; break; // 36 Mhz
}
clock >>= 1;
uint8_t i = 0;
while (i < 7 && freq < clock) { clock >>= 1; i++; }
return baud_rates[i];
}
SPIClass SPI(1);
#endif // __STM32F1__
+409
View File
@@ -0,0 +1,409 @@
/******************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*****************************************************************************/
#pragma once
#include <libmaple/libmaple_types.h>
#include <libmaple/spi.h>
#include <libmaple/dma.h>
#include <boards.h>
#include <stdint.h>
#include <wirish.h>
// SPI_HAS_TRANSACTION means SPI has
// - beginTransaction()
// - endTransaction()
// - usingInterrupt()
// - SPISetting(clock, bitOrder, dataMode)
//#define SPI_HAS_TRANSACTION
#define SPI_CLOCK_DIV2 SPI_BAUD_PCLK_DIV_2
#define SPI_CLOCK_DIV4 SPI_BAUD_PCLK_DIV_4
#define SPI_CLOCK_DIV8 SPI_BAUD_PCLK_DIV_8
#define SPI_CLOCK_DIV16 SPI_BAUD_PCLK_DIV_16
#define SPI_CLOCK_DIV32 SPI_BAUD_PCLK_DIV_32
#define SPI_CLOCK_DIV64 SPI_BAUD_PCLK_DIV_64
#define SPI_CLOCK_DIV128 SPI_BAUD_PCLK_DIV_128
#define SPI_CLOCK_DIV256 SPI_BAUD_PCLK_DIV_256
/*
* Roger Clark. 20150106
* Commented out redundant AVR defined
*
#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
// define SPI_AVR_EIMSK for AVR boards with external interrupt pins
#if defined(EIMSK)
#define SPI_AVR_EIMSK EIMSK
#elif defined(GICR)
#define SPI_AVR_EIMSK GICR
#elif defined(GIMSK)
#define SPI_AVR_EIMSK GIMSK
#endif
*/
#ifndef STM32_LSBFIRST
#define STM32_LSBFIRST 0
#endif
#ifndef STM32_MSBFIRST
#define STM32_MSBFIRST 1
#endif
// PC13 or PA4
#define BOARD_SPI_DEFAULT_SS PA4
//#define BOARD_SPI_DEFAULT_SS PC13
#define SPI_MODE0 SPI_MODE_0
#define SPI_MODE1 SPI_MODE_1
#define SPI_MODE2 SPI_MODE_2
#define SPI_MODE3 SPI_MODE_3
#define DATA_SIZE_8BIT SPI_CR1_DFF_8_BIT
#define DATA_SIZE_16BIT SPI_CR1_DFF_16_BIT
typedef enum {
SPI_STATE_IDLE,
SPI_STATE_READY,
SPI_STATE_RECEIVE,
SPI_STATE_TRANSMIT,
SPI_STATE_TRANSFER
} spi_mode_t;
class SPISettings {
public:
SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) {
if (__builtin_constant_p(clock))
init_AlwaysInline(clock, bitOrder, dataMode, DATA_SIZE_8BIT);
else
init_MightInline(clock, bitOrder, dataMode, DATA_SIZE_8BIT);
}
SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) {
if (__builtin_constant_p(clock))
init_AlwaysInline(clock, bitOrder, dataMode, dataSize);
else
init_MightInline(clock, bitOrder, dataMode, dataSize);
}
SPISettings(uint32_t clock) {
if (__builtin_constant_p(clock))
init_AlwaysInline(clock, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
else
init_MightInline(clock, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
}
SPISettings() {
init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
}
private:
void init_MightInline(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) {
init_AlwaysInline(clock, bitOrder, dataMode, dataSize);
}
void init_AlwaysInline(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) __attribute__((__always_inline__)) {
this->clock = clock;
this->bitOrder = bitOrder;
this->dataMode = dataMode;
this->dataSize = dataSize;
}
uint32_t clock;
uint32_t dataSize;
uint32_t clockDivider;
BitOrder bitOrder;
uint8_t dataMode;
uint8_t _SSPin;
volatile spi_mode_t state;
spi_dev *spi_d;
dma_channel spiRxDmaChannel, spiTxDmaChannel;
dma_dev* spiDmaDev;
void (*receiveCallback)(void) = NULL;
void (*transmitCallback)(void) = NULL;
friend class SPIClass;
};
/*
* Kept for compat.
*/
static const uint8_t ff = 0xFF;
/**
* @brief Wirish SPI interface.
*
* This implementation uses software slave management, so the caller
* is responsible for controlling the slave select line.
*/
class SPIClass {
public:
/**
* @param spiPortNumber Number of the SPI port to manage.
*/
SPIClass(uint32_t spiPortNumber);
/**
* @brief Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
*/
void begin();
/**
* @brief Turn on a SPI port and set its GPIO pin modes for use as a slave.
*
* SPI port is enabled in full duplex mode, with software slave management.
*
* @param bitOrder Either LSBFIRST (little-endian) or MSBFIRST(big-endian)
* @param mode SPI mode to use
*/
void beginSlave(uint32_t bitOrder, uint32_t mode);
/**
* @brief Equivalent to beginSlave(MSBFIRST, 0).
*/
void beginSlave();
/**
* @brief Disables the SPI port, but leaves its GPIO pin modes unchanged.
*/
void end();
void beginTransaction(SPISettings settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); }
void beginTransaction(uint8_t pin, SPISettings settings);
void endTransaction();
void beginTransactionSlave(SPISettings settings);
void setClockDivider(uint32_t clockDivider);
void setBitOrder(BitOrder bitOrder);
void setDataMode(uint8_t dataMode);
// SPI Configuration methods
void attachInterrupt();
void detachInterrupt();
/* Victor Perez. Added to change datasize from 8 to 16 bit modes on the fly.
* Input parameter should be SPI_CR1_DFF set to 0 or 1 on a 32bit word.
* Requires an added function spi_data_size on STM32F1 / cores / maple / libmaple / spi.c
*/
void setDataSize(uint32_t ds);
/* Victor Perez 2017. Added to set and clear callback functions for callback
* on DMA transfer completion.
* onReceive used to set the callback in case of dmaTransfer (tx/rx), once rx is completed
* onTransmit used to set the callback in case of dmaSend (tx only). That function
* will NOT be called in case of TX/RX
*/
void onReceive(void(*)(void));
void onTransmit(void(*)(void));
/*
* I/O
*/
/**
* @brief Return the next unread byte/word.
*
* If there is no unread byte/word waiting, this function will block
* until one is received.
*/
uint16_t read();
/**
* @brief Read length bytes, storing them into buffer.
* @param buffer Buffer to store received bytes into.
* @param length Number of bytes to store in buffer. This
* function will block until the desired number of
* bytes have been read.
*/
void read(uint8_t *buffer, uint32_t length);
/**
* @brief Transmit one byte/word.
* @param data to transmit.
*/
void write(uint16_t data);
void write16(uint16_t data); // write 2 bytes in 8 bit mode (DFF=0)
/**
* @brief Transmit one byte/word a specified number of times.
* @param data to transmit.
*/
void write(uint16_t data, uint32_t n);
/**
* @brief Transmit multiple bytes/words.
* @param buffer Bytes/words to transmit.
* @param length Number of bytes/words in buffer to transmit.
*/
void write(const void * buffer, uint32_t length);
/**
* @brief Transmit a byte, then return the next unread byte.
*
* This function transmits before receiving.
*
* @param data Byte to transmit.
* @return Next unread byte.
*/
uint8_t transfer(uint8_t data) const;
uint16_t transfer16(uint16_t data) const;
/**
* @brief Sets up a DMA Transfer for "length" bytes.
* The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
*
* This function transmits and receives to buffers.
*
* @param transmitBuf buffer Bytes to transmit. If passed as 0, it sends FF repeatedly for "length" bytes
* @param receiveBuf buffer Bytes to save received data.
* @param length Number of bytes in buffer to transmit.
*/
uint8_t dmaTransfer(const void * transmitBuf, void * receiveBuf, uint16_t length);
void dmaTransferSet(const void *transmitBuf, void *receiveBuf);
uint8_t dmaTransferRepeat(uint16_t length);
/**
* @brief Sets up a DMA Transmit for SPI 8 or 16 bit transfer mode.
* The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
*
* This function only transmits and does not care about the RX fifo.
*
* @param data buffer half words to transmit,
* @param length Number of bytes in buffer to transmit.
* @param minc Set to use Memory Increment mode, clear to use Circular mode.
*/
uint8_t dmaSend(const void * transmitBuf, uint16_t length, bool minc = 1);
void dmaSendSet(const void * transmitBuf, bool minc);
uint8_t dmaSendRepeat(uint16_t length);
uint8_t dmaSendAsync(const void * transmitBuf, uint16_t length, bool minc = 1);
/*
* Pin accessors
*/
/**
* @brief Return the number of the MISO (master in, slave out) pin
*/
uint8_t misoPin();
/**
* @brief Return the number of the MOSI (master out, slave in) pin
*/
uint8_t mosiPin();
/**
* @brief Return the number of the SCK (serial clock) pin
*/
uint8_t sckPin();
/**
* @brief Return the number of the NSS (slave select) pin
*/
uint8_t nssPin();
/* Escape hatch */
/**
* @brief Get a pointer to the underlying libmaple spi_dev for
* this HardwareSPI instance.
*/
spi_dev* c_dev(void) { return _currentSetting->spi_d; }
spi_dev* dev() { return _currentSetting->spi_d; }
/**
* @brief Sets the number of the SPI peripheral to be used by
* this HardwareSPI instance.
*
* @param spi_num Number of the SPI port. 1-2 in low density devices
* or 1-3 in high density devices.
*/
void setModule(int spi_num) {
_currentSetting=&_settings[spi_num-1];// SPI channels are called 1 2 and 3 but the array is zero indexed
}
/* -- The following methods are deprecated --------------------------- */
/**
* @brief Deprecated.
*
* Use HardwareSPI::transfer() instead.
*
* @see HardwareSPI::transfer()
*/
uint8_t send(uint8_t data);
/**
* @brief Deprecated.
*
* Use HardwareSPI::write() in combination with
* HardwareSPI::read() (or HardwareSPI::transfer()) instead.
*
* @see HardwareSPI::write()
* @see HardwareSPI::read()
* @see HardwareSPI::transfer()
*/
uint8_t send(uint8_t *data, uint32_t length);
/**
* @brief Deprecated.
*
* Use HardwareSPI::read() instead.
*
* @see HardwareSPI::read()
*/
uint8_t recv();
private:
SPISettings _settings[BOARD_NR_SPI];
SPISettings *_currentSetting;
void updateSettings();
/*
* Functions added for DMA transfers with Callback.
* Experimental.
*/
void EventCallback();
#if BOARD_NR_SPI >= 1
static void _spi1EventCallback();
#endif
#if BOARD_NR_SPI >= 2
static void _spi2EventCallback();
#endif
#if BOARD_NR_SPI >= 3
static void _spi3EventCallback();
#endif
/*
spi_dev *spi_d;
uint8_t _SSPin;
uint32_t clockDivider;
uint8_t dataMode;
BitOrder bitOrder;
*/
};
extern SPIClass SPI;
@@ -0,0 +1,60 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)
/**
* Empty class for Software Serial implementation (Custom RX/TX pins)
*
* TODO: Optionally use https://github.com/FYSETC/SoftwareSerialM if TMC UART is wanted
*/
#include "SoftwareSerial.h"
// Constructor
SoftwareSerial::SoftwareSerial(int8_t RX_pin, int8_t TX_pin) {}
// Public
void SoftwareSerial::begin(const uint32_t baudrate) {
}
bool SoftwareSerial::available() {
return false;
}
uint8_t SoftwareSerial::read() {
return 0;
}
uint16_t SoftwareSerial::write(uint8_t byte) {
return 0;
}
void SoftwareSerial::flush() {}
void SoftwareSerial::listen() {
listening = true;
}
void SoftwareSerial::stopListening() {
listening = false;
}
#endif //__STM32F1__
@@ -0,0 +1,42 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <stdint.h>
#define SW_SERIAL_PLACEHOLDER 1
class SoftwareSerial {
public:
SoftwareSerial(int8_t RX_pin, int8_t TX_pin);
void begin(const uint32_t baudrate);
bool available();
uint8_t read();
uint16_t write(uint8_t byte);
void flush();
void listen();
void stopListening();
protected:
bool listening;
};
+2 -2
View File
@@ -38,8 +38,8 @@
#define _SET_OUTPUT(IO) _SET_MODE(IO, GPIO_OUTPUT_PP)
#define _SET_OUTPUT_OD(IO) _SET_MODE(IO, GPIO_OUTPUT_OD)
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); } while(0)
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); } while(0)
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
@@ -42,7 +42,6 @@
// Store settings in the last two pages
// Flash pages must be erased before writing, so keep track.
bool firstWrite = false;
uint32_t pageBase = EEPROM_START_ADDRESS;
bool PersistentStore::access_start() {
firstWrite = true;
@@ -67,42 +66,27 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
firstWrite = false;
}
// First write full words
int i = 0;
int wordsToWrite = size / sizeof(uint16_t);
uint16_t* wordBuffer = (uint16_t *)value;
while (wordsToWrite) {
status = FLASH_ProgramHalfWord(pageBase + pos + (i * 2), wordBuffer[i]);
if (status != FLASH_COMPLETE) return true;
wordsToWrite--;
i++;
}
// Now, write any remaining single byte
const uint16_t odd = size & 1;
if (odd) {
uint16_t temp = value[size - 1];
status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
if (status != FLASH_COMPLETE) return true;
for (size_t i = 0; i < size; i++) {
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + (pos + i) * 2, value[i]) != FLASH_COMPLETE)
return true;
}
crc16(crc, value, size);
pos += size + odd;
pos += size;
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
for (uint16_t i = 0; i < size; i++) {
byte* accessPoint = (byte*)(pageBase + pos + i);
uint8_t c = *accessPoint;
if (writing) value[i] = c;
crc16(crc, &c, 1);
for (size_t i = 0; i < size; i++) {
uint8_t v = *(uint16_t *)(EEPROM_PAGE0_BASE + (pos + i) * 2);
if (writing) value[i] = v;
crc16(crc, &v, 1);
}
pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values
pos += size;
return false;
}
size_t PersistentStore::capacity() { return E2END + 1; }
size_t PersistentStore::capacity() { return size_t(E2END + 1); }
#endif // EEPROM_SETTINGS && EEPROM FLASH
#endif // __STM32F1__
@@ -52,7 +52,7 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
SdFile file, root = card.getroot();
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
return false;
return true; // false aborts the save
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
if (bytes_read < 0) return false;
+12 -9
View File
@@ -37,7 +37,7 @@
#include <stdint.h>
#ifdef defined(STM32F4) && USBCON
#if defined(STM32F4) && USBCON
#include <USBSerial.h>
#endif
@@ -100,8 +100,6 @@
#define NUM_SERIAL 1
#endif
#define _BV(b) (1 << (b))
/**
* TODO: review this to return 1 for pins that are not analog input
*/
@@ -142,7 +140,7 @@ typedef int8_t pin_t;
// Public Variables
// ------------------------
/** result of last ADC conversion */
// Result of last ADC conversion
extern uint16_t HAL_adc_result;
// ------------------------
@@ -154,14 +152,17 @@ extern uint16_t HAL_adc_result;
inline void HAL_init(void) { }
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source (void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/*
extern "C" {
int freeMemory(void);
@@ -183,15 +184,17 @@ static int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0));
}
#pragma GCC diagnostic pop
//
// SPI: Extended functions which take a channel number (hardware SPI only)
//
/** Write single byte to specified SPI channel */
// Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);
//
@@ -53,56 +53,40 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
switch (timer_num) {
case STEP_TIMER_NUM:
// STEPPER TIMER TIM5 - use a 32bit timer
#ifdef STM32GENERIC
__HAL_RCC_TIM5_CLK_ENABLE();
TimerHandle[timer_num].handle.Instance = TIM5;
TimerHandle[timer_num].handle.Init.Prescaler = step_prescaler;
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TimerHandle[timer_num].callback = (uint32_t)TC5_Handler;
#else
TimerHandle[timer_num].timer = TIM5;
TimerHandle[timer_num].irqHandle = TC5_Handler;
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / step_prescaler) / frequency) - 1, step_prescaler);
#endif
__HAL_RCC_TIM5_CLK_ENABLE();
TimerHandle[timer_num].handle.Instance = TIM5;
TimerHandle[timer_num].handle.Init.Prescaler = step_prescaler;
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TimerHandle[timer_num].callback = (uint32_t)TC5_Handler;
HAL_NVIC_SetPriority(STEP_TIMER_IRQ_ID, 1, 0);
break;
case TEMP_TIMER_NUM:
// TEMP TIMER TIM7 - any available 16bit Timer (1 already used for PWM)
#ifdef STM32GENERIC
__HAL_RCC_TIM7_CLK_ENABLE();
TimerHandle[timer_num].handle.Instance = TIM7;
TimerHandle[timer_num].handle.Init.Prescaler = temp_prescaler;
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TimerHandle[timer_num].callback = (uint32_t)TC7_Handler;
#else
TimerHandle[timer_num].timer = TIM7;
TimerHandle[timer_num].irqHandle = TC7_Handler;
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / temp_prescaler) / frequency) - 1, temp_prescaler);
#endif
__HAL_RCC_TIM7_CLK_ENABLE();
TimerHandle[timer_num].handle.Instance = TIM7;
TimerHandle[timer_num].handle.Init.Prescaler = temp_prescaler;
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TimerHandle[timer_num].callback = (uint32_t)TC7_Handler;
HAL_NVIC_SetPriority(TEMP_TIMER_IRQ_ID, 2, 0);
break;
}
timers_initialized[timer_num] = true;
}
#ifdef STM32GENERIC
TimerHandle[timer_num].handle.Init.Period = (((HAL_TIMER_RATE) / TimerHandle[timer_num].handle.Init.Prescaler) / frequency) - 1;
if (HAL_TIM_Base_Init(&TimerHandle[timer_num].handle) == HAL_OK)
HAL_TIM_Base_Start_IT(&TimerHandle[timer_num].handle);
#endif
TimerHandle[timer_num].handle.Init.Period = (((HAL_TIMER_RATE) / TimerHandle[timer_num].handle.Init.Prescaler) / frequency) - 1;
if (HAL_TIM_Base_Init(&TimerHandle[timer_num].handle) == HAL_OK)
HAL_TIM_Base_Start_IT(&TimerHandle[timer_num].handle);
}
#ifdef STM32GENERIC
extern "C" void TIM5_IRQHandler() {
((void(*)(void))TimerHandle[0].callback)();
}
extern "C" void TIM7_IRQHandler() {
((void(*)(void))TimerHandle[1].callback)();
}
#endif
extern "C" void TIM5_IRQHandler() {
((void(*)(void))TimerHandle[0].callback)();
}
extern "C" void TIM7_IRQHandler() {
((void(*)(void))TimerHandle[1].callback)();
}
void HAL_timer_enable_interrupt(const uint8_t timer_num) {
switch (timer_num) {
@@ -59,8 +59,9 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
timerConfig[0].IRQ_Id = TIM5_IRQn;
timerConfig[0].callback = (uint32_t)TC5_Handler;
HAL_NVIC_SetPriority(timerConfig[0].IRQ_Id, 1, 0);
SET_OUTPUT(STEPPER_ENABLE_PIN);
WRITE(STEPPER_ENABLE_PIN);
#if PIN_EXISTS(STEPPER_ENABLE)
OUT_WRITE(STEPPER_ENABLE_PIN, HIGH);
#endif
break;
case TEMP_TIMER_NUM:
//TEMP TIMER TIM7 // any available 16bit Timer (1 already used for PWM)
@@ -189,7 +189,6 @@ void TMC26XStepper::start() {
pinMode(step_pin, OUTPUT);
pinMode(dir_pin, OUTPUT);
pinMode(cs_pin, OUTPUT);
//SET_OUTPUT(STEPPER_ENABLE_PIN);
extDigitalWrite(step_pin, LOW);
extDigitalWrite(dir_pin, LOW);
extDigitalWrite(cs_pin, HIGH);
@@ -86,6 +86,8 @@ uint16_t EE_Initialize(void) {
pEraseInit.NbSectors = 1;
pEraseInit.VoltageRange = VOLTAGE_RANGE;
HAL_StatusTypeDef FlashStatus; // = HAL_OK
/* Check for invalid header states and repair if necessary */
uint32_t SectorError;
switch (PageStatus0) {
@@ -135,7 +137,7 @@ uint16_t EE_Initialize(void) {
}
}
/* Mark Page0 as valid */
HAL_StatusTypeDef FlashStatus = HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, PAGE0_BASE_ADDRESS, VALID_PAGE);
FlashStatus = HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, PAGE0_BASE_ADDRESS, VALID_PAGE);
/* If program operation was failed, a Flash error code is returned */
if (FlashStatus != HAL_OK) return FlashStatus;
pEraseInit.Sector = PAGE1_ID;
@@ -27,8 +27,6 @@
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/
#define _BV(b) (1 << (b))
#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)
@@ -66,127 +64,141 @@
#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
#define PA0 _STM32_PIN(A, 0)
#define PA1 _STM32_PIN(A, 1)
#define PA2 _STM32_PIN(A, 2)
#define PA3 _STM32_PIN(A, 3)
#define PA4 _STM32_PIN(A, 4)
#define PA5 _STM32_PIN(A, 5)
#define PA6 _STM32_PIN(A, 6)
#define PA7 _STM32_PIN(A, 7)
#define PA8 _STM32_PIN(A, 8)
#define PA9 _STM32_PIN(A, 9)
#define PA10 _STM32_PIN(A, 10)
#define PA11 _STM32_PIN(A, 11)
#define PA12 _STM32_PIN(A, 12)
#define PA13 _STM32_PIN(A, 13)
#define PA14 _STM32_PIN(A, 14)
#define PA15 _STM32_PIN(A, 15)
#ifndef PA0
#define PA0 _STM32_PIN(A, 0)
#define PA1 _STM32_PIN(A, 1)
#define PA2 _STM32_PIN(A, 2)
#define PA3 _STM32_PIN(A, 3)
#define PA4 _STM32_PIN(A, 4)
#define PA5 _STM32_PIN(A, 5)
#define PA6 _STM32_PIN(A, 6)
#define PA7 _STM32_PIN(A, 7)
#define PA8 _STM32_PIN(A, 8)
#define PA9 _STM32_PIN(A, 9)
#define PA10 _STM32_PIN(A, 10)
#define PA11 _STM32_PIN(A, 11)
#define PA12 _STM32_PIN(A, 12)
#define PA13 _STM32_PIN(A, 13)
#define PA14 _STM32_PIN(A, 14)
#define PA15 _STM32_PIN(A, 15)
#endif
#define PB0 _STM32_PIN(B, 0)
#define PB1 _STM32_PIN(B, 1)
#define PB2 _STM32_PIN(B, 2)
#define PB3 _STM32_PIN(B, 3)
#define PB4 _STM32_PIN(B, 4)
#define PB5 _STM32_PIN(B, 5)
#define PB6 _STM32_PIN(B, 6)
#define PB7 _STM32_PIN(B, 7)
#define PB8 _STM32_PIN(B, 8)
#define PB9 _STM32_PIN(B, 9)
#define PB10 _STM32_PIN(B, 10)
#define PB11 _STM32_PIN(B, 11)
#define PB12 _STM32_PIN(B, 12)
#define PB13 _STM32_PIN(B, 13)
#define PB14 _STM32_PIN(B, 14)
#define PB15 _STM32_PIN(B, 15)
#ifndef PB0
#define PB0 _STM32_PIN(B, 0)
#define PB1 _STM32_PIN(B, 1)
#define PB2 _STM32_PIN(B, 2)
#define PB3 _STM32_PIN(B, 3)
#define PB4 _STM32_PIN(B, 4)
#define PB5 _STM32_PIN(B, 5)
#define PB6 _STM32_PIN(B, 6)
#define PB7 _STM32_PIN(B, 7)
#define PB8 _STM32_PIN(B, 8)
#define PB9 _STM32_PIN(B, 9)
#define PB10 _STM32_PIN(B, 10)
#define PB11 _STM32_PIN(B, 11)
#define PB12 _STM32_PIN(B, 12)
#define PB13 _STM32_PIN(B, 13)
#define PB14 _STM32_PIN(B, 14)
#define PB15 _STM32_PIN(B, 15)
#endif
#define PC0 _STM32_PIN(C, 0)
#define PC1 _STM32_PIN(C, 1)
#define PC2 _STM32_PIN(C, 2)
#define PC3 _STM32_PIN(C, 3)
#define PC4 _STM32_PIN(C, 4)
#define PC5 _STM32_PIN(C, 5)
#define PC6 _STM32_PIN(C, 6)
#define PC7 _STM32_PIN(C, 7)
#define PC8 _STM32_PIN(C, 8)
#define PC9 _STM32_PIN(C, 9)
#define PC10 _STM32_PIN(C, 10)
#define PC11 _STM32_PIN(C, 11)
#define PC12 _STM32_PIN(C, 12)
#define PC13 _STM32_PIN(C, 13)
#define PC14 _STM32_PIN(C, 14)
#define PC15 _STM32_PIN(C, 15)
#ifndef PC0
#define PC0 _STM32_PIN(C, 0)
#define PC1 _STM32_PIN(C, 1)
#define PC2 _STM32_PIN(C, 2)
#define PC3 _STM32_PIN(C, 3)
#define PC4 _STM32_PIN(C, 4)
#define PC5 _STM32_PIN(C, 5)
#define PC6 _STM32_PIN(C, 6)
#define PC7 _STM32_PIN(C, 7)
#define PC8 _STM32_PIN(C, 8)
#define PC9 _STM32_PIN(C, 9)
#define PC10 _STM32_PIN(C, 10)
#define PC11 _STM32_PIN(C, 11)
#define PC12 _STM32_PIN(C, 12)
#define PC13 _STM32_PIN(C, 13)
#define PC14 _STM32_PIN(C, 14)
#define PC15 _STM32_PIN(C, 15)
#endif
#define PD0 _STM32_PIN(D, 0)
#define PD1 _STM32_PIN(D, 1)
#define PD2 _STM32_PIN(D, 2)
#define PD3 _STM32_PIN(D, 3)
#define PD4 _STM32_PIN(D, 4)
#define PD5 _STM32_PIN(D, 5)
#define PD6 _STM32_PIN(D, 6)
#define PD7 _STM32_PIN(D, 7)
#define PD8 _STM32_PIN(D, 8)
#define PD9 _STM32_PIN(D, 9)
#define PD10 _STM32_PIN(D, 10)
#define PD11 _STM32_PIN(D, 11)
#define PD12 _STM32_PIN(D, 12)
#define PD13 _STM32_PIN(D, 13)
#define PD14 _STM32_PIN(D, 14)
#define PD15 _STM32_PIN(D, 15)
#ifndef PD0
#define PD0 _STM32_PIN(D, 0)
#define PD1 _STM32_PIN(D, 1)
#define PD2 _STM32_PIN(D, 2)
#define PD3 _STM32_PIN(D, 3)
#define PD4 _STM32_PIN(D, 4)
#define PD5 _STM32_PIN(D, 5)
#define PD6 _STM32_PIN(D, 6)
#define PD7 _STM32_PIN(D, 7)
#define PD8 _STM32_PIN(D, 8)
#define PD9 _STM32_PIN(D, 9)
#define PD10 _STM32_PIN(D, 10)
#define PD11 _STM32_PIN(D, 11)
#define PD12 _STM32_PIN(D, 12)
#define PD13 _STM32_PIN(D, 13)
#define PD14 _STM32_PIN(D, 14)
#define PD15 _STM32_PIN(D, 15)
#endif
#define PE0 _STM32_PIN(E, 0)
#define PE1 _STM32_PIN(E, 1)
#define PE2 _STM32_PIN(E, 2)
#define PE3 _STM32_PIN(E, 3)
#define PE4 _STM32_PIN(E, 4)
#define PE5 _STM32_PIN(E, 5)
#define PE6 _STM32_PIN(E, 6)
#define PE7 _STM32_PIN(E, 7)
#define PE8 _STM32_PIN(E, 8)
#define PE9 _STM32_PIN(E, 9)
#define PE10 _STM32_PIN(E, 10)
#define PE11 _STM32_PIN(E, 11)
#define PE12 _STM32_PIN(E, 12)
#define PE13 _STM32_PIN(E, 13)
#define PE14 _STM32_PIN(E, 14)
#define PE15 _STM32_PIN(E, 15)
#ifndef PE0
#define PE0 _STM32_PIN(E, 0)
#define PE1 _STM32_PIN(E, 1)
#define PE2 _STM32_PIN(E, 2)
#define PE3 _STM32_PIN(E, 3)
#define PE4 _STM32_PIN(E, 4)
#define PE5 _STM32_PIN(E, 5)
#define PE6 _STM32_PIN(E, 6)
#define PE7 _STM32_PIN(E, 7)
#define PE8 _STM32_PIN(E, 8)
#define PE9 _STM32_PIN(E, 9)
#define PE10 _STM32_PIN(E, 10)
#define PE11 _STM32_PIN(E, 11)
#define PE12 _STM32_PIN(E, 12)
#define PE13 _STM32_PIN(E, 13)
#define PE14 _STM32_PIN(E, 14)
#define PE15 _STM32_PIN(E, 15)
#endif
#ifdef STM32F7
#define PORTF 5
#define PORTG 6
#define PF0 _STM32_PIN(F, 0)
#define PF1 _STM32_PIN(F, 1)
#define PF2 _STM32_PIN(F, 2)
#define PF3 _STM32_PIN(F, 3)
#define PF4 _STM32_PIN(F, 4)
#define PF5 _STM32_PIN(F, 5)
#define PF6 _STM32_PIN(F, 6)
#define PF7 _STM32_PIN(F, 7)
#define PF8 _STM32_PIN(F, 8)
#define PF9 _STM32_PIN(F, 9)
#define PF10 _STM32_PIN(F, 10)
#define PF11 _STM32_PIN(F, 11)
#define PF12 _STM32_PIN(F, 12)
#define PF13 _STM32_PIN(F, 13)
#define PF14 _STM32_PIN(F, 14)
#define PF15 _STM32_PIN(F, 15)
#ifndef PF0
#define PORTF 5
#define PF0 _STM32_PIN(F, 0)
#define PF1 _STM32_PIN(F, 1)
#define PF2 _STM32_PIN(F, 2)
#define PF3 _STM32_PIN(F, 3)
#define PF4 _STM32_PIN(F, 4)
#define PF5 _STM32_PIN(F, 5)
#define PF6 _STM32_PIN(F, 6)
#define PF7 _STM32_PIN(F, 7)
#define PF8 _STM32_PIN(F, 8)
#define PF9 _STM32_PIN(F, 9)
#define PF10 _STM32_PIN(F, 10)
#define PF11 _STM32_PIN(F, 11)
#define PF12 _STM32_PIN(F, 12)
#define PF13 _STM32_PIN(F, 13)
#define PF14 _STM32_PIN(F, 14)
#define PF15 _STM32_PIN(F, 15)
#endif
#define PG0 _STM32_PIN(G, 0)
#define PG1 _STM32_PIN(G, 1)
#define PG2 _STM32_PIN(G, 2)
#define PG3 _STM32_PIN(G, 3)
#define PG4 _STM32_PIN(G, 4)
#define PG5 _STM32_PIN(G, 5)
#define PG6 _STM32_PIN(G, 6)
#define PG7 _STM32_PIN(G, 7)
#define PG8 _STM32_PIN(G, 8)
#define PG9 _STM32_PIN(G, 9)
#define PG10 _STM32_PIN(G, 10)
#define PG11 _STM32_PIN(G, 11)
#define PG12 _STM32_PIN(G, 12)
#define PG13 _STM32_PIN(G, 13)
#define PG14 _STM32_PIN(G, 14)
#define PG15 _STM32_PIN(G, 15)
#ifndef PG0
#define PORTG 6
#define PG0 _STM32_PIN(G, 0)
#define PG1 _STM32_PIN(G, 1)
#define PG2 _STM32_PIN(G, 2)
#define PG3 _STM32_PIN(G, 3)
#define PG4 _STM32_PIN(G, 4)
#define PG5 _STM32_PIN(G, 5)
#define PG6 _STM32_PIN(G, 6)
#define PG7 _STM32_PIN(G, 7)
#define PG8 _STM32_PIN(G, 8)
#define PG9 _STM32_PIN(G, 9)
#define PG10 _STM32_PIN(G, 10)
#define PG11 _STM32_PIN(G, 11)
#define PG12 _STM32_PIN(G, 12)
#define PG13 _STM32_PIN(G, 13)
#define PG14 _STM32_PIN(G, 14)
#define PG15 _STM32_PIN(G, 15)
#endif
#endif // STM32GENERIC && STM32F7
+3
View File
@@ -97,9 +97,12 @@ uint8_t HAL_get_reset_source(void);
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only)
+8 -5
View File
@@ -95,24 +95,27 @@ typedef int8_t pin_t;
inline void HAL_init(void) { }
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source(void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only)
/** Write single byte to specified SPI channel */
// Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);
// ADC
+34 -12
View File
@@ -65,7 +65,7 @@
#include "feature/host_actions.h"
#endif
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
#if USE_BEEPER
#include "libs/buzzer.h"
#endif
@@ -290,6 +290,15 @@ void enable_all_steppers() {
enable_E5();
}
void enable_e_steppers() {
enable_E0();
enable_E1();
enable_E2();
enable_E3();
enable_E4();
enable_E5();
}
void disable_e_steppers() {
disable_E0();
disable_E1();
@@ -539,28 +548,28 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
#if ENABLED(SWITCHING_EXTRUDER)
bool oldstatus;
switch (active_extruder) {
default: oldstatus = E0_ENABLE_READ; enable_E0(); break;
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
#if E_STEPPERS > 1
case 2: case 3: oldstatus = E1_ENABLE_READ; enable_E1(); break;
case 2: case 3: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
#if E_STEPPERS > 2
case 4: case 5: oldstatus = E2_ENABLE_READ; enable_E2(); break;
case 4: case 5: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
}
#else // !SWITCHING_EXTRUDER
bool oldstatus;
switch (active_extruder) {
default: oldstatus = E0_ENABLE_READ; enable_E0(); break;
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
#if E_STEPPERS > 1
case 1: oldstatus = E1_ENABLE_READ; enable_E1(); break;
case 1: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
#if E_STEPPERS > 2
case 2: oldstatus = E2_ENABLE_READ; enable_E2(); break;
case 2: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
#if E_STEPPERS > 3
case 3: oldstatus = E3_ENABLE_READ; enable_E3(); break;
case 3: oldstatus = E3_ENABLE_READ(); enable_E3(); break;
#if E_STEPPERS > 4
case 4: oldstatus = E4_ENABLE_READ; enable_E4(); break;
case 4: oldstatus = E4_ENABLE_READ(); enable_E4(); break;
#if E_STEPPERS > 5
case 5: oldstatus = E5_ENABLE_READ; enable_E5(); break;
case 5: oldstatus = E5_ENABLE_READ(); enable_E5(); break;
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
@@ -661,9 +670,14 @@ void idle(
) {
#if ENABLED(SPI_ENDSTOPS)
if (endstops.tmc_spi_homing.any && ELAPSED(millis(), sg_guard_period))
if (endstops.tmc_spi_homing.any
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
&& ELAPSED(millis(), sg_guard_period)
#endif
) {
for (uint8_t i = 4; i--;) // Read SGT 4 times per idle loop
if (endstops.tmc_spi_homing_check()) break;
}
#endif
#if ENABLED(MAX7219_DEBUG)
@@ -688,7 +702,7 @@ void idle(
print_job_timer.tick();
#endif
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
#if USE_BEEPER
buzzer.tick();
#endif
@@ -872,6 +886,10 @@ void setup() {
runout.setup();
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.setup();
#endif
setup_killpin();
#if HAS_TMC220x
@@ -1112,6 +1130,10 @@ void setup() {
init_closedloop();
#endif
#ifdef STARTUP_COMMANDS
queue.inject_P(PSTR(STARTUP_COMMANDS));
#endif
#if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
card.beginautostart();
#endif
+1
View File
@@ -316,6 +316,7 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
/**
* The axis order in all axis related arrays is X, Y, Z, E
*/
void enable_e_steppers();
void enable_all_steppers();
void disable_e_stepper(const uint8_t e);
void disable_e_steppers();
+22 -18
View File
@@ -95,6 +95,8 @@
#define BOARD_Z_BOLT_X_SERIES 1141 // Z-Bolt X Series
#define BOARD_TT_OSCAR 1142 // TT OSCAR
#define BOARD_OVERLORD 1143 // Overlord/Overlord Pro
#define BOARD_HJC2560C_REV1 1144 // ADIMLab Granty v1
#define BOARD_HJC2560C_REV2 1145 // ADIMLab Granty v2
//
// RAMBo and derivatives
@@ -113,24 +115,25 @@
#define BOARD_CNCONTROLS_11 1300 // Cartesio CN Controls V11
#define BOARD_CNCONTROLS_12 1301 // Cartesio CN Controls V12
#define BOARD_CHEAPTRONIC 1302 // Cheaptronic v1.0
#define BOARD_CHEAPTRONIC_V2 1303 // Cheaptronic v2.0
#define BOARD_MIGHTYBOARD_REVE 1304 // Makerbot Mightyboard Revision E
#define BOARD_MEGATRONICS 1305 // Megatronics
#define BOARD_MEGATRONICS_2 1306 // Megatronics v2.0
#define BOARD_MEGATRONICS_3 1307 // Megatronics v3.0
#define BOARD_MEGATRONICS_31 1308 // Megatronics v3.1
#define BOARD_MEGATRONICS_32 1309 // Megatronics v3.2
#define BOARD_ELEFU_3 1310 // Elefu Ra Board (v3)
#define BOARD_LEAPFROG 1311 // Leapfrog
#define BOARD_MEGACONTROLLER 1312 // Mega controller
#define BOARD_GT2560_REV_A 1313 // Geeetech GT2560 Rev. A
#define BOARD_GT2560_REV_A_PLUS 1314 // Geeetech GT2560 Rev. A+ (with auto level probe)
#define BOARD_GT2560_V3 1315 // Geeetech GT2560 Rev B for A10(M/D)
#define BOARD_GT2560_V3_MC2 1316 // Geeetech GT2560 Rev B for Mecreator2
#define BOARD_GT2560_V3_A20 1317 // Geeetech GT2560 Rev B for A20(M/D)
#define BOARD_EINSTART_S 1318 // Einstart retrofit
#define BOARD_WANHAO_ONEPLUS 1319 // Wanhao 0ne+ i3 Mini
#define BOARD_CNCONTROLS_15 1302 // Cartesio CN Controls V15
#define BOARD_CHEAPTRONIC 1303 // Cheaptronic v1.0
#define BOARD_CHEAPTRONIC_V2 1304 // Cheaptronic v2.0
#define BOARD_MIGHTYBOARD_REVE 1305 // Makerbot Mightyboard Revision E
#define BOARD_MEGATRONICS 1306 // Megatronics
#define BOARD_MEGATRONICS_2 1307 // Megatronics v2.0
#define BOARD_MEGATRONICS_3 1308 // Megatronics v3.0
#define BOARD_MEGATRONICS_31 1309 // Megatronics v3.1
#define BOARD_MEGATRONICS_32 1310 // Megatronics v3.2
#define BOARD_ELEFU_3 1311 // Elefu Ra Board (v3)
#define BOARD_LEAPFROG 1312 // Leapfrog
#define BOARD_MEGACONTROLLER 1313 // Mega controller
#define BOARD_GT2560_REV_A 1314 // Geeetech GT2560 Rev. A
#define BOARD_GT2560_REV_A_PLUS 1315 // Geeetech GT2560 Rev. A+ (with auto level probe)
#define BOARD_GT2560_V3 1316 // Geeetech GT2560 Rev B for A10(M/D)
#define BOARD_GT2560_V3_MC2 1317 // Geeetech GT2560 Rev B for Mecreator2
#define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D)
#define BOARD_EINSTART_S 1319 // Einstart retrofit
#define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini
//
// ATmega1281, ATmega2561
@@ -290,6 +293,7 @@
#define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE
#define BOARD_STEVAL 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
#define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
#define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE)
//
// ARM Cortex M7
+5 -3
View File
@@ -67,12 +67,14 @@
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
#define HAS_E_DRIVER(T) ( AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
|| HAS_E_DRIVER(T) )
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
+1
View File
@@ -67,6 +67,7 @@
// sk Slovak
// tr Turkish
// uk Ukrainian
// vi Vietnamese
// zh_CN Chinese (Simplified)
// zh_TW Chinese (Traditional)
+6 -6
View File
@@ -118,24 +118,24 @@
// Using GCC extensions, but Travis GCC version does not like it and gives
// "error: statement-expressions are not allowed outside functions nor in template-argument lists"
#define NOLESS(v, n) \
do { \
do{ \
__typeof__(n) _n = (n); \
if (v < _n) v = _n; \
} while(0)
}while(0)
#define NOMORE(v, n) \
do { \
do{ \
__typeof__(n) _n = (n); \
if (v > _n) v = _n; \
} while(0)
}while(0)
#define LIMIT(v, n1, n2) \
do { \
do{ \
__typeof__(n1) _n1 = (n1); \
__typeof__(n2) _n2 = (n2); \
if (v < _n1) v = _n1; \
else if (v > _n2) v = _n2; \
} while(0)
}while(0)
#endif
+2 -2
View File
@@ -184,5 +184,5 @@ void print_bin(const uint16_t val);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(PSTR(PREFIX), nullptr, V); } while(0)
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(PSTR(PREFIX), nullptr, V); }while(0)
+2 -2
View File
@@ -37,7 +37,7 @@ Babystep babystep;
volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];
#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
int16_t Babystep::accum;
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
@@ -75,7 +75,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
if (!CAN_BABYSTEP(axis)) return;
#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
axis_total[BS_TOTAL_AXIS(axis)] += distance;
+2 -2
View File
@@ -30,7 +30,7 @@
#define BS_TODO_AXIS(A) 0
#endif
#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(BABYSTEP_DISPLAY_TOTAL)
#if ENABLED(BABYSTEP_XY)
#define BS_TOTAL_AXIS(A) A
#else
@@ -41,7 +41,7 @@
class Babystep {
public:
static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1];
#if HAS_LCD_MENU
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
static int16_t accum; // Total babysteps in current edit
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
+5 -7
View File
@@ -752,16 +752,15 @@
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
DEPLOY_PROBE();
uint8_t count = GRID_MAX_POINTS, current = 1;
uint8_t count = GRID_MAX_POINTS;
do {
current = (GRID_MAX_POINTS) - count + 1;
if (do_ubl_mesh_map) display_map(g29_map_type);
SERIAL_ECHOLNPAIR("\nProbing mesh point ", int(current), "/", int(GRID_MAX_POINTS), ".\n");
const int current = (GRID_MAX_POINTS) - count + 1;
SERIAL_ECHOLNPAIR("\nProbing mesh point ", current, "/", int(GRID_MAX_POINTS), ".\n");
#if HAS_DISPLAY
ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), int(current), int(GRID_MAX_POINTS));
ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), current, int(GRID_MAX_POINTS));
#endif
#if HAS_LCD_MENU
@@ -1500,8 +1499,7 @@
DEBUG_ECHO_F(rx, 7);
DEBUG_CHAR(',');
DEBUG_ECHO_F(ry, 7);
DEBUG_ECHOPGM(") logical: ");
DEBUG_CHAR('(');
DEBUG_ECHOPGM(") logical: (");
DEBUG_ECHO_F(LOGICAL_X_POSITION(rx), 7);
DEBUG_CHAR(',');
DEBUG_ECHO_F(LOGICAL_Y_POSITION(ry), 7);
+23 -16
View File
@@ -36,35 +36,37 @@ void controllerfan_update() {
if (ELAPSED(ms, nextMotorCheck)) {
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
const bool xory = X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON;
// If any of the drivers or the bed are enabled...
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON
if (xory || Z_ENABLE_READ() == Z_ENABLE_ON
#if HAS_HEATED_BED
|| thermalManager.temp_bed.soft_pwm_amount > 0
#endif
#if HAS_X2_ENABLE
|| X2_ENABLE_READ == X_ENABLE_ON
|| X2_ENABLE_READ() == X_ENABLE_ON
#endif
#if HAS_Y2_ENABLE
|| Y2_ENABLE_READ == Y_ENABLE_ON
|| Y2_ENABLE_READ() == Y_ENABLE_ON
#endif
#if HAS_Z2_ENABLE
|| Z2_ENABLE_READ == Z_ENABLE_ON
|| Z2_ENABLE_READ() == Z_ENABLE_ON
#endif
#if HAS_Z3_ENABLE
|| Z3_ENABLE_READ == Z_ENABLE_ON
|| Z3_ENABLE_READ() == Z_ENABLE_ON
#endif
#if E_STEPPERS
|| E0_ENABLE_READ == E_ENABLE_ON
|| E0_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON
|| E1_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 2
|| E2_ENABLE_READ == E_ENABLE_ON
|| E2_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 3
|| E3_ENABLE_READ == E_ENABLE_ON
|| E3_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 4
|| E4_ENABLE_READ == E_ENABLE_ON
|| E4_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 5
|| E5_ENABLE_READ == E_ENABLE_ON
|| E5_ENABLE_READ() == E_ENABLE_ON
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
@@ -76,12 +78,17 @@ void controllerfan_update() {
}
// Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
controllerfan_speed = speed;
controllerfan_speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : (
#ifdef CONTROLLERFAN_SPEED_Z_ONLY
xory ? CONTROLLERFAN_SPEED : CONTROLLERFAN_SPEED_Z_ONLY
#else
CONTROLLERFAN_SPEED
#endif
);
// allows digital or PWM fan output to be used (see M42 handling)
WRITE(CONTROLLER_FAN_PIN, speed);
analogWrite(pin_t(CONTROLLER_FAN_PIN), speed);
// Allow digital or PWM fan output (see M42 handling)
WRITE(CONTROLLER_FAN_PIN, controllerfan_speed);
analogWrite(pin_t(CONTROLLER_FAN_PIN), controllerfan_speed);
}
}
+1 -1
View File
@@ -125,7 +125,7 @@ void LEDLights::set_color(const LEDColor &incol
// If the pins can do PWM then their intensity will be set.
#define UPDATE_RGBW(C,c) do { if (PWM_PIN(RGB_LED_##C##_PIN)) \
analogWrite(pin_t(RGB_LED_##C##_PIN), incol.c); \
else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); } while(0)
else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0)
UPDATE_RGBW(R,r);
UPDATE_RGBW(G,g);
UPDATE_RGBW(B,b);
+5 -3
View File
@@ -137,13 +137,15 @@ void pca9632_set_led_color(const LEDColor &color) {
}
#if ENABLED(PCA9632_BUZZER)
void pca9632_buzz(uint16_t const f, uint16_t d) {
UNUSED(f); UNUSED(d);
void pca9632_buzz(const long duration, const uint16_t freq) {
UNUSED(duration); UNUSED(freq);
uint8_t data[] = PCA9632_BUZZER_DATA;
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
Wire.write(data, sizeof(data));
Wire.endTransmission();
}
#endif
#endif // PCA9632_BUZZER
#endif // PCA9632
+2 -1
View File
@@ -32,5 +32,6 @@ typedef LEDColor LEDColor;
void pca9632_set_led_color(const LEDColor &color);
#if ENABLED(PCA9632_BUZZER)
void pca9632_buzz(uint16_t const, uint16_t);
#include <stdint.h>
void pca9632_buzz(const long, const uint16_t);
#endif
+15 -2
View File
@@ -187,6 +187,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
host_action_prompt_button(PSTR("Continue"));
host_action_prompt_show();
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("Load Filament"));
#endif
while (wait_for_user) {
#if HAS_BUZZER
filament_change_beep(max_beep_count);
@@ -239,6 +242,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Continuous Purge Running..."), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("Continuous Purge Running..."));
#endif
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
wait_for_user = false;
@@ -353,8 +359,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
planner.settings.retract_acceleration = saved_acceleration;
#endif
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
// Disable E steppers for manual change
#if HAS_E_STEPPER_ENABLE
disable_e_stepper(active_extruder);
safe_delay(100);
#endif
@@ -517,6 +523,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("Nozzle Parked"));
#endif
while (wait_for_user) {
#if HAS_BUZZER
filament_change_beep(max_beep_count);
@@ -538,6 +547,10 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("HeaterTimeout"), PSTR("Reheat"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("HeaterTimeout"));
#endif
// Wait for LCD click or M108
while (wait_for_user) idle(true);
+10 -10
View File
@@ -55,31 +55,31 @@ bool Power::is_power_needed() {
#endif
// If any of the drivers or the bed are enabled...
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
#if HAS_HEATED_BED
|| thermalManager.temp_bed.soft_pwm_amount > 0
#endif
#if HAS_X2_ENABLE
|| X2_ENABLE_READ == X_ENABLE_ON
|| X2_ENABLE_READ() == X_ENABLE_ON
#endif
#if HAS_Y2_ENABLE
|| Y2_ENABLE_READ == Y_ENABLE_ON
|| Y2_ENABLE_READ() == Y_ENABLE_ON
#endif
#if HAS_Z2_ENABLE
|| Z2_ENABLE_READ == Z_ENABLE_ON
|| Z2_ENABLE_READ() == Z_ENABLE_ON
#endif
#if E_STEPPERS
|| E0_ENABLE_READ == E_ENABLE_ON
|| E0_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON
|| E1_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 2
|| E2_ENABLE_READ == E_ENABLE_ON
|| E2_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 3
|| E3_ENABLE_READ == E_ENABLE_ON
|| E3_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 4
|| E4_ENABLE_READ == E_ENABLE_ON
|| E4_ENABLE_READ() == E_ENABLE_ON
#if E_STEPPERS > 5
|| E5_ENABLE_READ == E_ENABLE_ON
|| E5_ENABLE_READ() == E_ENABLE_ON
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
+6 -7
View File
@@ -332,8 +332,7 @@ void PrintJobRecovery::resume() {
// Restore leveling state before 'G92 Z' to ensure
// the Z stepper count corresponds to the native Z.
if (info.fade || info.leveling) {
dtostrf(info.fade, 1, 1, str_1);
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), str_1);
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), dtostrf(info.fade, 1, 1, str_1));
gcode.process_subcommands_now(cmd);
}
#endif
@@ -355,9 +354,10 @@ void PrintJobRecovery::resume() {
#endif
// Move back to the saved XY
dtostrf(info.current_position[X_AXIS], 1, 3, str_1);
dtostrf(info.current_position[Y_AXIS], 1, 3, str_2);
sprintf_P(cmd, PSTR("G1 X%s Y%s F3000"), str_1, str_2);
sprintf_P(cmd, PSTR("G1 X%s Y%s F3000"),
dtostrf(info.current_position[X_AXIS], 1, 3, str_1),
dtostrf(info.current_position[Y_AXIS], 1, 3, str_2)
);
gcode.process_subcommands_now(cmd);
// Move back to the saved Z
@@ -382,8 +382,7 @@ void PrintJobRecovery::resume() {
gcode.process_subcommands_now(cmd);
// Restore E position with G92.9
dtostrf(info.current_position[E_AXIS], 1, 3, str_1);
sprintf_P(cmd, PSTR("G92.9 E%s"), str_1);
sprintf_P(cmd, PSTR("G92.9 E%s"), dtostrf(info.current_position[E_AXIS], 1, 3, str_1));
gcode.process_subcommands_now(cmd);
// Relative mode
+19 -1
View File
@@ -26,12 +26,16 @@
*/
#include "../sd/cardreader.h"
#include "../inc/MarlinConfigPre.h"
#include "../inc/MarlinConfig.h"
#if ENABLED(MIXING_EXTRUDER)
#include "../feature/mixing.h"
#endif
#if !defined(POWER_LOSS_STATE) && PIN_EXISTS(POWER_LOSS)
#define POWER_LOSS_STATE HIGH
#endif
//#define DEBUG_POWER_LOSS_RECOVERY
//#define SAVE_EACH_CMD_MODE
//#define SAVE_INFO_INTERVAL_MS 0
@@ -110,6 +114,20 @@ class PrintJobRecovery {
static void init();
static inline void setup() {
#if PIN_EXISTS(POWER_LOSS)
#if ENABLED(POWER_LOSS_PULL)
#if POWER_LOSS_STATE == LOW
SET_INPUT_PULLUP(POWER_LOSS_PIN);
#else
SET_INPUT_PULLDOWN(POWER_LOSS_PIN);
#endif
#else
SET_INPUT(POWER_LOSS_PIN);
#endif
#endif
}
static bool enabled;
static void enable(const bool onoff);
static void changed();
+7
View File
@@ -42,6 +42,10 @@ MMU2 mmu2;
#include "../../feature/host_actions.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extensible_ui/ui_api.h"
#endif
#define DEBUG_OUT ENABLED(MMU2_DEBUG)
#include "../../core/debug_out.h"
@@ -711,6 +715,9 @@ void MMU2::filament_runout() {
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("MMU2 Eject Recover"));
#endif
while (wait_for_user) idle();
BUZZ(200, 404);
BUZZ(200, 404);
+2
View File
@@ -249,6 +249,8 @@ class FilamentSensorBase {
&& (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_MIRRORED_MODE)
#elif ENABLED(MULTI_NOZZLE_DUPLICATION)
&& extruder_duplication_enabled
#else
&& false
#endif
#endif
) return runout_states; // Any extruder
+4 -8
View File
@@ -63,10 +63,6 @@ void XPT2046::init(void) {
uint8_t XPT2046::read_buttons() {
int16_t tsoffsets[4] = { 0 };
static uint32_t touchtimeout = 0;
if (PENDING(millis(), touchtimeout)) return 0;
touchtimeout = millis() + 80; // ideally want to set this lower for the games... 30 or 40.
if (tsoffsets[0] + tsoffsets[1] == 0) {
// Not yet set, so use defines as fallback...
tsoffsets[0] = XPT2046_X_CALIBRATION;
@@ -84,10 +80,10 @@ uint8_t XPT2046::read_buttons() {
if (y < 175 || y > 234) return 0;
if (WITHIN(x, 11, 109)) encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM) * ENCODER_PULSES_PER_STEP;
else if (WITHIN(x, 111, 209)) encoderDiff = ENCODER_STEPS_PER_MENU_ITEM * ENCODER_PULSES_PER_STEP;
else if (WITHIN(x, 211, 309)) return EN_C;
return 0;
return WITHIN(x, 11, 109) ? EN_A
: WITHIN(x, 111, 209) ? EN_B
: WITHIN(x, 211, 309) ? EN_C
: 0;
}
bool XPT2046::isTouched() {
+1 -1
View File
@@ -445,7 +445,7 @@ void GcodeSuite::G33() {
_tower_results = (_4p_calibration && towers_set) || probe_points >= 3,
_opposite_results = (_4p_calibration && !towers_set) || probe_points >= 3,
_endstop_results = probe_points != 1 && probe_points != -1 && probe_points != 0,
_angle_results = probe_points >= 3 && towers_set;
_angle_results = probe_points >= 3 && towers_set;
static const char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
int8_t iterations = 0;
float test_precision,
+1 -1
View File
@@ -284,7 +284,7 @@ void GcodeSuite::G34() {
// Home Z after the alignment procedure
process_subcommands_now_P(PSTR("G28 Z"));
} while(0);
}while(0);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G34");
}
+1 -2
View File
@@ -252,8 +252,7 @@ void GcodeSuite::M48() {
#if HAS_SPI_LCD
// Display M48 results in the status bar
char sigma_str[8];
dtostrf(sigma, 2, 6, sigma_str);
ui.status_printf_P(0, PSTR(MSG_M48_DEVIATION ": %s"), sigma_str);
ui.status_printf_P(0, PSTR(MSG_M48_DEVIATION ": %s"), dtostrf(sigma, 2, 6, sigma_str));
#endif
}
+7
View File
@@ -42,6 +42,10 @@
#include "../../feature/host_actions.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
#include "../../lcd/extensible_ui/ui_api.h"
#endif
#ifndef GET_PIN_MAP_PIN_M43
#define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q)
#endif
@@ -329,6 +333,9 @@ void GcodeSuite::M43() {
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("M43 Wait Called"));
#endif
#endif
for (;;) {
+17 -10
View File
@@ -30,11 +30,21 @@
#endif
/**
* M17: Enable power on all stepper motors
* M17: Enable stepper motors
*/
void GcodeSuite::M17() {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
if (parser.seen("XYZE")) {
if (parser.seen('X')) enable_X();
if (parser.seen('Y')) enable_Y();
if (parser.seen('Z')) enable_Z();
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) enable_e_steppers();
#endif
}
else {
LCD_MESSAGEPGM(MSG_NO_MOVE);
enable_all_steppers();
}
}
/**
@@ -45,20 +55,17 @@ void GcodeSuite::M18_M84() {
stepper_inactive_time = parser.value_millis_from_seconds();
}
else {
bool all_axis = !(parser.seen('X') || parser.seen('Y') || parser.seen('Z') || parser.seen('E'));
if (all_axis) {
planner.finish_and_disable();
}
else {
if (parser.seen("XYZE")) {
planner.synchronize();
if (parser.seen('X')) disable_X();
if (parser.seen('Y')) disable_Y();
if (parser.seen('Z')) disable_Z();
// Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
#if HAS_E_STEPPER_ENABLE
if (parser.seen('E')) disable_e_steppers();
#endif
}
else
planner.finish_and_disable();
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
+1 -1
View File
@@ -52,7 +52,7 @@ void GcodeSuite::M502() {
* M503: print settings currently in memory
*/
void GcodeSuite::M503() {
(void)settings.report(parser.boolval('S', true));
(void)settings.report(!parser.boolval('S', true));
}
#endif // !DISABLE_M503
+31 -9
View File
@@ -101,8 +101,12 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) {
#endif
sprintf_P(temp_buf, PSTR("\n...OverCurrent Threshold: %2d (%4d mA)"), overcurrent_threshold, (overcurrent_threshold + 1) * 375);
SERIAL_ECHO(temp_buf);
sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%7.2f mA)"), stall_threshold, (stall_threshold + 1) * 31.25);
char numstr[11];
dtostrf((stall_threshold + 1) * 31.25, 1, 2, numstr);
sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%s mA)"), stall_threshold, numstr);
SERIAL_ECHO(temp_buf);
SERIAL_ECHOPGM(" Motor Status: ");
const char * const stat_str;
switch (motor_status) {
@@ -114,24 +118,42 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) {
}
serialprintPGM(stat_str);
SERIAL_EOL();
SERIAL_ECHOPAIR("...microsteps: ", microsteps);
SERIAL_ECHOPAIR(" ADC_OUT: ", adc_out);
SERIAL_ECHOPGM(" Vs_compensation: ");
serialprintPGM((motor.GetParam(L6470_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
sprintf_P(temp_buf, PSTR(" Compensation coefficient: ~%4.2f\n"), comp_coef * 0.01f);
SERIAL_ECHO(temp_buf);
SERIAL_ECHOLNPGM(" Compensation coefficient: ", dtostrf(comp_coef * 0.01f, 7, 2, numstr));
SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD));
SERIAL_ECHOPAIR(" KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN));
SERIAL_ECHOPAIR(" KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC));
SERIAL_ECHOPAIR(" KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC));
SERIAL_ECHOPGM(" V motor max = ");
float val;
PGM_P suf;
switch (motor_status) {
case 0: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_HOLD)\n"), float(motor.GetParam(L6470_KVAL_HOLD)) * 100 / 256); break;
case 1: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_RUN) \n"), float(motor.GetParam(L6470_KVAL_RUN)) * 100 / 256); break;
case 2: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_ACC) \n"), float(motor.GetParam(L6470_KVAL_ACC)) * 100 / 256); break;
case 3: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_DEC) \n"), float(motor.GetParam(L6470_KVAL_DEC)) * 100 / 256); break;
case 0:
val = motor.GetParam(L6470_KVAL_HOLD);
suf = PSTR("(KVAL_HOLD)");
break;
case 1:
val = motor.GetParam(L6470_KVAL_RUN);
suf = PSTR("(KVAL_RUN)");
break;
case 2:
val = motor.GetParam(L6470_KVAL_ACC);
suf = PSTR("(KVAL_ACC)");
break;
case 3:
val = motor.GetParam(L6470_KVAL_DEC);
suf = PSTR("(KVAL_DEC)");
break;
}
SERIAL_ECHO(temp_buf);
SERIAL_ECHO(dtostrf(val * 100 / 256, 10, 2, numstr));
SERIAL_ECHO("%% ");
serialprintPGM(suf);
SERIAL_EOL();
}
void GcodeSuite::M906() {
@@ -150,7 +172,7 @@ void GcodeSuite::M906() {
report_current = false;
if (planner.has_blocks_queued() || planner.cleaning_buffer_counter) {
SERIAL_ECHOLNPGM("ERROR - can't set KVAL_HOLD while steppers are moving");
SERIAL_ECHOLNPGM("!Can't set KVAL_HOLD with steppers moving");
return;
}
+24 -41
View File
@@ -32,6 +32,19 @@
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
#include "../../../core/debug_out.h"
static void jiggle_axis(const char axis_char, const float &min, const float &max, const float &rate) {
char gcode_string[30], str1[11], str2[11];
// Turn the motor(s) both directions
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(min, 1, 3, str1), dtostrf(rate, 1, 3, str2));
process_subcommands_now(gcode_string);
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(max, 1, 3, str1), str2);
process_subcommands_now(gcode_string);
planner.synchronize();
}
/**
*
* M916: Increase KVAL_HOLD until thermal warning
@@ -85,14 +98,11 @@ void GcodeSuite::M916() {
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
planner.synchronize(); // wait for all current movement commands to complete
planner.synchronize(); // Wait for moves to finish
for (j = 0; j < driver_count; j++)
L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
L6470.get_status(axis_index[j]); // Clear out error flags
char temp_axis_string[] = " ";
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
char gcode_string[80];
uint16_t status_composite = 0;
DEBUG_ECHOLNPGM(".\n.");
@@ -104,15 +114,8 @@ void GcodeSuite::M916() {
for (j = 0; j < driver_count; j++)
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
// turn the motor(s) both directions
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
process_subcommands_now(gcode_string);
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
process_subcommands_now(gcode_string);
// get the status after the motors have stopped
planner.synchronize();
// Turn the motor(s) both directions
jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
status_composite = 0; // clear out the old bits
@@ -201,12 +204,9 @@ void GcodeSuite::M917() {
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
planner.synchronize(); // wait for all current movement commands to complete
planner.synchronize(); // Wait for moves to finish
for (j = 0; j < driver_count; j++)
L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
char temp_axis_string[] = " ";
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
char gcode_string[80];
L6470.get_status(axis_index[j]); // Clear out error flags
uint16_t status_composite = 0;
uint8_t test_phase = 0;
// 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
@@ -225,13 +225,7 @@ void GcodeSuite::M917() {
DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375);
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
process_subcommands_now(gcode_string);
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
process_subcommands_now(gcode_string);
planner.synchronize();
jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
status_composite = 0; // clear out the old bits
@@ -500,30 +494,19 @@ void GcodeSuite::M918() {
float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step)
current_feedrate = 0;
planner.synchronize(); // wait for all current movement commands to complete
planner.synchronize(); // Wait for moves to finish
for (j = 0; j < driver_count; j++)
L6470.get_status(axis_index[j]); // clear all error flags
L6470.get_status(axis_index[j]); // Clear all error flags
char temp_axis_string[2];
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
temp_axis_string[1] = '\n';
char gcode_string[80];
uint16_t status_composite = 0;
DEBUG_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see
DEBUG_ECHOLNPGM(".\n.\n."); // Make the feedrate prints easier to see
do {
current_feedrate += feedrate_inc;
DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate);
process_subcommands_now(gcode_string);
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate);
process_subcommands_now(gcode_string);
planner.synchronize();
jiggle_axis(axis_mon[0][0], position_min, position_max, current_feedrate);
for (j = 0; j < driver_count; j++) {
axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800; // bits of interest are all active low
+4
View File
@@ -342,6 +342,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 12: M12(); break; // M12: Synchronize and optionally force a CLC set
#endif
#if ENABLED(EXPECTED_PRINTER_CHECK)
case 16: M16(); break; // M16: Expected printer check
#endif
case 17: M17(); break; // M17: Enable all stepper motors
#if ENABLED(SDSUPPORT)
+5
View File
@@ -83,6 +83,7 @@
* M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
* M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
* M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
* M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK)
* M17 - Enable/Power all stepper motors
* M18 - Disable all stepper motors; same as M84
* M20 - List SD card. (Requires SDSUPPORT)
@@ -472,6 +473,10 @@ private:
static void M12();
#endif
#if ENABLED(EXPECTED_PRINTER_CHECK)
static void M16();
#endif
static void M17();
static void M18_M84();
+1 -1
View File
@@ -42,7 +42,7 @@
SERIAL_CHAR(' ');
SERIAL_CHAR(axis_codes[i]);
SERIAL_CHAR(':');
SERIAL_ECHO(dtostrf(pos[i], 8, precision, str));
SERIAL_ECHO(dtostrf(pos[i], 1, precision, str));
}
SERIAL_EOL();
}
+40
View File
@@ -0,0 +1,40 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(EXPECTED_PRINTER_CHECK)
#include "../gcode.h"
#include "../../Marlin.h"
/**
* M16: Expected Printer Check
*/
void GcodeSuite::M16() {
if (strcmp_P(parser.string_arg, PSTR(MACHINE_NAME)))
kill(PSTR(MSG_EXPECTED_PRINTER));
}
#endif
+3 -4
View File
@@ -97,6 +97,9 @@ void GcodeSuite::M0_M1() {
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("M0/1 Break Called"));
#endif
if (ms > 0) {
ms += millis(); // wait until this time for a click
@@ -105,10 +108,6 @@ void GcodeSuite::M0_M1() {
else
while (wait_for_user) idle();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(nullptr);
#endif
#if HAS_LEDS_OFF_FLAG
printerEventLEDs.onResumeAfterWait();
#endif
+3
View File
@@ -225,6 +225,9 @@ void GCodeParser::parse(char *p) {
case 810: case 811: case 812: case 813: case 814:
case 815: case 816: case 817: case 818: case 819:
#endif
#if ENABLED(EXPECTED_PRINTER_CHECK)
case 16:
#endif
case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return;
default: break;
}
-3
View File
@@ -33,9 +33,6 @@
*/
void GcodeSuite::M75() {
print_job_timer.start();
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onPrintTimerStarted();
#endif
}
/**
+2 -70
View File
@@ -30,9 +30,6 @@
#define DOGLCD
#define IS_ULTIPANEL
#define DEFAULT_LCD_CONTRAST 90
#define LCD_CONTRAST_MIN 60
#define LCD_CONTRAST_MAX 140
#elif ENABLED(ZONESTAR_LCD)
@@ -63,25 +60,13 @@
#define IS_ULTIPANEL
#if ENABLED(miniVIKI)
#define LCD_CONTRAST_MIN 75
#define LCD_CONTRAST_MAX 115
#define DEFAULT_LCD_CONTRAST 95
#define U8GLIB_ST7565_64128N
#elif ENABLED(VIKI2)
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 140
#define U8GLIB_ST7565_64128N
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define LCD_CONTRAST_MIN 90
#define LCD_CONTRAST_MAX 130
#define DEFAULT_LCD_CONTRAST 110
#define U8GLIB_LM6059_AF
#define SD_DETECT_INVERTED
#elif ENABLED(AZSMZ_12864)
#define LCD_CONTRAST_MIN 120
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 190
#define U8GLIB_ST7565_64128N
#endif
@@ -128,17 +113,12 @@
#elif ENABLED(MKS_MINI_12864)
#define MINIPANEL
#define DEFAULT_LCD_CONTRAST 150
#define LCD_CONTRAST_MAX 255
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define FYSETC_MINI_12864
#define DOGLCD
#define IS_ULTIPANEL
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 220
#define LED_COLORS_REDUCE_GREEN
#if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define LED_BACKLIGHT_TIMEOUT 10000
@@ -166,9 +146,6 @@
#define IS_ULTIPANEL
#define U8GLIB_SSD1309
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 254
#define DEFAULT_LCD_CONTRAST 127
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 2
@@ -190,9 +167,6 @@
#if ENABLED(MAKRPANEL)
#define U8GLIB_ST7565_64128N
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 17
#endif
#endif
#if ENABLED(IS_U8GLIB_SSD1306)
@@ -368,7 +342,7 @@
#endif
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
#if EITHER(MALYAN_LCD, DGUS_LCD)
#if ANY(MALYAN_LCD, DGUS_LCD, LULZBOT_TOUCH_UI)
#define IS_EXTUI
#define EXTENSIBLE_UI
#endif
@@ -381,22 +355,6 @@
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
/**
* Default LCD contrast for Graphical LCD displays
*/
#define HAS_LCD_CONTRAST (HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST))
#if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN 0
#endif
#ifndef LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX 63
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 32
#endif
#endif
/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:
@@ -567,7 +525,7 @@
#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE)
#define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#define HAS_SERVICE_INTERVALS (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
#define HAS_SERVICE_INTERVALS (ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0))
#define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR)
#define Z_MULTI_STEPPER_DRIVERS EITHER(Z_DUAL_STEPPER_DRIVERS, Z_TRIPLE_STEPPER_DRIVERS)
@@ -594,32 +552,6 @@
#define INVERT_E_DIR false
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#ifndef ACTION_ON_PAUSE
#define ACTION_ON_PAUSE "pause"
#endif
#ifndef ACTION_ON_RESUME
#define ACTION_ON_RESUME "resume"
#endif
#ifndef ACTION_ON_PAUSED
#define ACTION_ON_PAUSED "paused"
#endif
#ifndef ACTION_ON_RESUMED
#define ACTION_ON_RESUMED "resumed"
#endif
#ifndef ACTION_ON_CANCEL
#define ACTION_ON_CANCEL "cancel"
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifndef ACTION_ON_G29_RECOVER
#define ACTION_ON_G29_RECOVER "probe_rewipe"
#endif
#ifndef ACTION_ON_G29_FAILURE
#define ACTION_ON_G29_FAILURE "probe_failed"
#endif
#endif
#endif
#if ENABLED(SLIM_LCD_MENUS)
#define BOOT_MARLIN_LOGO_SMALL
#endif
+3
View File
@@ -99,3 +99,6 @@
#define LED_USER_PRESET_BRIGHTNESS 255
#endif
#endif
// Extensible UI pin mapping for RepRapDiscount
#define TOUCH_UI_ULTIPANEL ENABLED(LULZBOT_TOUCH_UI) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP)
+79 -2
View File
@@ -246,6 +246,63 @@
#define MAX_AUTORETRACT 99
#endif
/**
* LCD Contrast for Graphical Displays
*/
#if ENABLED(CARTESIO_UI)
#define _LCD_CONTRAST_MIN 60
#define _LCD_CONTRAST_INIT 90
#define _LCD_CONTRAST_MAX 140
#elif ENABLED(miniVIKI)
#define _LCD_CONTRAST_MIN 75
#define _LCD_CONTRAST_INIT 95
#define _LCD_CONTRAST_MAX 115
#elif ENABLED(VIKI2)
#define _LCD_CONTRAST_INIT 140
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define _LCD_CONTRAST_MIN 90
#define _LCD_CONTRAST_INIT 110
#define _LCD_CONTRAST_MAX 130
#elif ENABLED(AZSMZ_12864)
#define _LCD_CONTRAST_MIN 120
#define _LCD_CONTRAST_INIT 190
#elif ENABLED(MKS_MINI_12864)
#define _LCD_CONTRAST_INIT 150
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define _LCD_CONTRAST_INIT 220
#elif ENABLED(ULTI_CONTROLLER)
#define _LCD_CONTRAST_INIT 127
#define _LCD_CONTRAST_MAX 254
#elif EITHER(MAKRPANEL, MINIPANEL)
#define _LCD_CONTRAST_INIT 17
#endif
#define HAS_LCD_CONTRAST defined(_LCD_CONTRAST_INIT)
#if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN
#ifdef _LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
#else
#define LCD_CONTRAST_MIN 0
#endif
#endif
#ifndef LCD_CONTRAST_INIT
#define LCD_CONTRAST_INIT _LCD_CONTRAST_INIT
#endif
#ifndef LCD_CONTRAST_MAX
#ifdef _LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX _LCD_CONTRAST_MAX
#elif _LCD_CONTRAST_INIT > 63
#define LCD_CONTRAST_MAX 255
#else
#define LCD_CONTRAST_MAX 63 // ST7567 6-bits contrast
#endif
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
#endif
#endif
/**
* Override here because this is set in Configuration_adv.h
*/
@@ -927,6 +984,11 @@
#endif
#endif
#define HAS_E_STEPPER_ENABLE (HAS_E_DRIVER(TMC2660) \
|| ( E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != X_ENABLE_PIN \
&& E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) \
)
// Endstops and bed probe
#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_OR_PROBE(A,M))
#define HAS_X_MIN _HAS_STOP(X,MIN)
@@ -996,7 +1058,21 @@
#define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN))
#define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN))
#define HAS_AUTO_CHAMBER_FAN (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_CHAMBER_FAN)
#if HAS_AUTO_FAN
#define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_E (AUTO_CHAMBER_IS_0 || AUTO_CHAMBER_IS_1 || AUTO_CHAMBER_IS_2 || AUTO_CHAMBER_IS_3 || AUTO_CHAMBER_IS_4 || AUTO_CHAMBER_IS_5)
#endif
#if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E
#undef AUTO_POWER_CHAMBER_FAN
#endif
// Other fans
#define HAS_FAN0 (PIN_EXISTS(FAN))
@@ -1029,7 +1105,8 @@
#define HAS_KILL (PIN_EXISTS(KILL))
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER) || ENABLED(PCA9632_BUZZER))
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
#define USE_BEEPER (HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
// Digital control
@@ -1551,7 +1628,7 @@
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
#else
#elif HAS_BUZZER
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif
+8
View File
@@ -1009,6 +1009,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif
/**
* Junction deviation is not compatible with kinematic systems.
*/
#if ENABLED(JUNCTION_DEVIATION) && IS_KINEMATIC
#error "Junction deviation is only compatible with Cartesians."
#endif
/**
* Probes
*/
@@ -1892,6 +1899,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
+ ENABLED(OVERLORD_OLED) \
+ ENABLED(DGUS_LCD) \
+ ENABLED(MALYAN_LCD) \
+ ENABLED(LULZBOT_TOUCH_UI) \
+ ENABLED(FSMC_GRAPHICAL_TFT)
#error "Please select no more than one LCD controller option."
#endif
+1 -1
View File
@@ -877,7 +877,7 @@ static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data
return hd44780_charmap_compare(&localval, (hd44780_charmap_t *)data_pin);
}
void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); }
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { lcd.setCursor(col, row); }
void lcd_put_int(const int i) { lcd.print(i); }
+91 -91
View File
@@ -269,7 +269,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
#endif // LCD_PROGRESS_BAR
#if ENABLED(SDSUPPORT)
#if ENABLED(SDSUPPORT) && HAS_LCD_MENU
// CHARSET_MENU
const static PROGMEM byte refresh[8] = {
@@ -319,7 +319,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
#endif
{
createChar_P(LCD_STR_UPLEVEL[0], uplevel);
#if ENABLED(SDSUPPORT)
#if ENABLED(SDSUPPORT) && HAS_LCD_MENU
// SD Card sub-menu special characters
createChar_P(LCD_STR_REFRESH[0], refresh);
createChar_P(LCD_STR_FOLDER[0], folder);
@@ -360,23 +360,48 @@ void MarlinUI::init_lcd() {
lcd.clear();
}
bool MarlinUI::detected() {
return true
#if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE)
&& lcd.LcdDetected() == 1
#endif
;
}
#if HAS_SLOW_BUTTONS
uint8_t MarlinUI::read_slow_buttons() {
#if ENABLED(LCD_I2C_TYPE_MCP23017)
// Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update
uint8_t slow_bits = lcd.readButtons()
#if !BUTTON_EXISTS(ENC)
<< B_I2C_BTN_OFFSET
#endif
;
#if ENABLED(LCD_I2C_VIKI)
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
#endif // LCD_I2C_VIKI
return slow_bits;
#endif // LCD_I2C_TYPE_MCP23017
}
#endif
void MarlinUI::clear_lcd() { lcd.clear(); }
#if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(const int16_t line) {
void lcd_erase_line(const lcd_uint_t line) {
lcd_moveto(0, line);
for (uint8_t i = LCD_WIDTH + 1; --i;)
lcd_put_wchar(' ');
}
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
void lcd_scroll(const uint8_t col, const uint8_t line, PGM_P const text, const uint8_t len, const int16_t time) {
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
uint8_t slen = utf8_strlen_P(text);
if (slen < len) {
// Fits into,
lcd_moveto(col, line);
lcd_put_u8str_max_P(text, len);
lcd_put_u8str_max_P(col, line, text, len);
for (; slen < len; ++slen) lcd_put_wchar(' ');
safe_delay(time);
}
@@ -385,11 +410,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
int dly = time / _MAX(slen, 1);
for (uint8_t i = 0; i <= slen; i++) {
// Go to the correct place
lcd_moveto(col, line);
// Print the text
lcd_put_u8str_max_P(p, len);
// Print the text at the correct place
lcd_put_u8str_max_P(col, line, p, len);
// Fill with spaces
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
@@ -406,9 +428,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
static void logo_lines(PGM_P const extra) {
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra);
lcd_moveto(indent, 2); lcd_put_wchar('\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
}
void MarlinUI::show_bootscreen() {
@@ -420,8 +442,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
#define CENTER_OR_SCROLL(STRING,DELAY) \
lcd_erase_line(3); \
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
lcd_moveto((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3); \
lcd_put_u8str_P(PSTR(STRING)); \
lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
safe_delay(DELAY); \
} \
else { \
@@ -491,16 +512,12 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
#endif // SHOW_BOOTSCREEN
void MarlinUI::draw_kill_screen() {
lcd_moveto(0, 0);
lcd_put_u8str(status_message);
#if LCD_HEIGHT < 4
lcd_moveto(0, 2);
#else
lcd_moveto(0, 2);
lcd_put_u8str_P(PSTR(MSG_HALTED));
lcd_moveto(0, 3);
lcd_put_u8str(0, 0, status_message);
lcd_uint_t y = 2;
#if LCD_HEIGHT >= 4
lcd_put_u8str_P(0, y++, PSTR(MSG_HALTED));
#endif
lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
lcd_put_u8str_P(0, y, PSTR(MSG_PLEASE_RESET));
}
//
@@ -859,8 +876,7 @@ void MarlinUI::draw_status_screen() {
#if LCD_HEIGHT > 3
lcd_moveto(0, 2);
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
lcd_put_u8str(i16tostr3(feedrate_percentage));
lcd_put_wchar('%');
@@ -868,8 +884,7 @@ void MarlinUI::draw_status_screen() {
duration_t elapsed = print_job_timer.duration();
const uint8_t len = elapsed.toDigital(buffer),
timepos = LCD_WIDTH - len - 1;
lcd_moveto(timepos, 2);
lcd_put_wchar(LCD_STR_CLOCK[0]);
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
lcd_put_u8str(buffer);
#if LCD_WIDTH >= 20
@@ -918,8 +933,7 @@ void MarlinUI::draw_status_screen() {
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
#if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED)
lcd_moveto(LCD_WIDTH - 1, 0);
lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
#endif
// ========== Line 2 ==========
@@ -934,8 +948,7 @@ void MarlinUI::draw_status_screen() {
_draw_bed_status(blink);
#endif
lcd_moveto(LCD_WIDTH - 9, 1);
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
lcd_put_u8str(i16tostr3(feedrate_percentage));
lcd_put_wchar('%');
@@ -1006,8 +1019,7 @@ void MarlinUI::draw_status_screen() {
void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
uint8_t n = LCD_WIDTH - 2;
lcd_moveto(0, row);
lcd_put_wchar(sel ? pre_char : ' ');
lcd_put_wchar(0, row, sel ? pre_char : ' ');
n -= lcd_put_u8str_max_P(pstr, n);
for (; n; --n) lcd_put_wchar(' ');
lcd_put_wchar(post_char);
@@ -1015,8 +1027,7 @@ void MarlinUI::draw_status_screen() {
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data));
lcd_moveto(0, row);
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
n -= lcd_put_u8str_max_P(pstr, n);
lcd_put_wchar(':');
for (; n; --n) lcd_put_wchar(' ');
@@ -1026,14 +1037,12 @@ void MarlinUI::draw_status_screen() {
void draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
ui.encoder_direction_normal();
lcd_moveto(0, 1);
lcd_put_u8str_P(pstr);
lcd_put_u8str_P(0, 1, pstr);
if (value != nullptr) {
lcd_put_wchar(':');
int len = utf8_strlen(value);
const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
lcd_put_wchar(' '); // Overwrite char if value gets shorter
const lcd_uint_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
lcd_put_wchar((LCD_WIDTH - 1) - (len + 1), valrow, ' '); // Right-justified, padded, add a leading space
lcd_put_u8str(value);
}
}
@@ -1051,8 +1060,7 @@ void MarlinUI::draw_status_screen() {
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
UNUSED(pstr);
lcd_moveto(0, row);
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
constexpr uint8_t maxlen = LCD_WIDTH - 2;
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
for (; n; --n) lcd_put_wchar(' ');
@@ -1063,7 +1071,7 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void MarlinUI::update_indicators() {
void MarlinUI::update_indicators() {
// Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0;
uint8_t leds = 0;
@@ -1144,9 +1152,9 @@ void MarlinUI::draw_status_screen() {
} custom_char;
typedef struct {
uint8_t column, row,
x_pixel_offset, y_pixel_offset,
x_pixel_mask;
lcd_uint_t column, row,
x_pixel_offset, y_pixel_offset;
uint8_t x_pixel_mask;
} coordinate;
void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location);
@@ -1174,22 +1182,21 @@ void MarlinUI::draw_status_screen() {
return ret_val;
}
inline coordinate pixel_location(const uint8_t x, const uint8_t y) { return pixel_location((int16_t)x, (int16_t)y); }
inline coordinate pixel_location(const lcd_uint_t x, const lcd_uint_t y) { return pixel_location((int16_t)x, (int16_t)y); }
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const uint8_t x, const uint8_t y) {
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
lcd.createChar(c, (uint8_t*)&chrdata);
lcd_moveto(x, y);
lcd_put_wchar(c);
lcd_put_wchar(x, y, c);
}
void MarlinUI::ubl_plot(const uint8_t x, const uint8_t inverted_y) {
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
#if LCD_WIDTH >= 20
#define _LCD_W_POS 12
#define _PLOT_X 1
#define _MAP_X 3
#define _LABEL(C,X,Y) lcd_moveto(X, Y); lcd_put_u8str(C)
#define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
@@ -1197,7 +1204,7 @@ void MarlinUI::draw_status_screen() {
#define _LCD_W_POS 8
#define _PLOT_X 0
#define _MAP_X 1
#define _LABEL(X,Y,C) lcd_moveto(X, Y); lcd_put_wchar(C)
#define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
#define _XLABEL(X,Y) _LABEL('X',X,Y)
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
@@ -1209,10 +1216,10 @@ void MarlinUI::draw_status_screen() {
* Show X and Y positions
*/
_XLABEL(_PLOT_X, 0);
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x]))));
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
_YLABEL(_LCD_W_POS, 0);
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[inverted_y]))));
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
lcd_moveto(_PLOT_X, 0);
@@ -1220,13 +1227,13 @@ void MarlinUI::draw_status_screen() {
coordinate upper_left, lower_right, bottom_right_corner;
custom_char new_char;
uint8_t i, j, k, l, m, n, n_rows, n_cols, y,
bottom_line, right_edge,
x_map_pixels, y_map_pixels,
pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt,
suppress_x_offset = 0, suppress_y_offset = 0;
uint8_t i, n, n_rows, n_cols;
lcd_uint_t j, k, l, m, bottom_line, right_edge,
x_map_pixels, y_map_pixels,
pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt,
suppress_x_offset = 0, suppress_y_offset = 0;
y = GRID_MAX_POINTS_Y - inverted_y - 1;
const uint8_t y_plot_inv = (GRID_MAX_POINTS_Y - 1) - y_plot;
upper_left.column = 0;
upper_left.row = 0;
@@ -1261,17 +1268,13 @@ void MarlinUI::draw_status_screen() {
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
for (i = 0; i < n_cols; i++) {
lcd_moveto(i, 0);
lcd_put_wchar(CHAR_LINE_TOP); // Box Top line
lcd_moveto(i, n_rows - 1);
lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line
lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line
lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
}
for (j = 0; j < n_rows; j++) {
lcd_moveto(0, j);
lcd_put_wchar(CHAR_EDGE_L); // Box Left edge
lcd_moveto(n_cols - 1, j);
lcd_put_wchar(CHAR_EDGE_R); // Box Right edge
lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge
lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
}
/**
@@ -1281,10 +1284,8 @@ void MarlinUI::draw_status_screen() {
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
l = (HD44780_CHAR_HEIGHT) * n_rows;
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
lcd_moveto(0, n_rows - 1); // Box Left edge
lcd_put_wchar(' ');
lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge
lcd_put_wchar(' ');
lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge
lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
}
clear_custom_char(&new_char);
@@ -1310,12 +1311,12 @@ void MarlinUI::draw_status_screen() {
new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the box right edge
lcd.createChar(CHAR_EDGE_R, (uint8_t*)&new_char);
i = x * pixels_per_x_mesh_pnt - suppress_x_offset;
j = y * pixels_per_y_mesh_pnt - suppress_y_offset;
i = x_plot * pixels_per_x_mesh_pnt - suppress_x_offset;
j = y_plot_inv * pixels_per_y_mesh_pnt - suppress_y_offset;
upper_left = pixel_location(i, j);
k = (x + 1) * pixels_per_x_mesh_pnt - 1 - suppress_x_offset;
l = (y + 1) * pixels_per_y_mesh_pnt - 1 - suppress_y_offset;
k = (x_plot + 1) * pixels_per_x_mesh_pnt - 1 - suppress_x_offset;
l = (y_plot_inv + 1) * pixels_per_y_mesh_pnt - 1 - suppress_y_offset;
lower_right = pixel_location(k, l);
bottom_right_corner = pixel_location(x_map_pixels, y_map_pixels);
@@ -1327,7 +1328,7 @@ void MarlinUI::draw_status_screen() {
*/
clear_custom_char(&new_char);
const uint8_t ypix = _MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
const lcd_uint_t ypix = _MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
for (j = upper_left.y_pixel_offset; j < ypix; j++) {
i = upper_left.x_pixel_mask;
for (k = 0; k < pixels_per_x_mesh_pnt; k++) {
@@ -1398,11 +1399,10 @@ void MarlinUI::draw_status_screen() {
/**
* Print plot position
*/
lcd_moveto(_LCD_W_POS, 0);
lcd_put_wchar('(');
lcd_put_u8str(ui8tostr3(x));
lcd_put_wchar(_LCD_W_POS, 0, '(');
lcd_put_u8str(ui8tostr3(x_plot));
lcd_put_wchar(',');
lcd_put_u8str(ui8tostr3(inverted_y));
lcd_put_u8str(ui8tostr3(y_plot));
lcd_put_wchar(')');
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
@@ -1411,8 +1411,8 @@ void MarlinUI::draw_status_screen() {
* Print Z values
*/
_ZLABEL(_LCD_W_POS, 1);
if (!isnan(ubl.z_values[x][inverted_y]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x][inverted_y]));
if (!isnan(ubl.z_values[x_plot][y_plot]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
else
lcd_put_u8str_P(PSTR(" -----"));
@@ -1422,16 +1422,16 @@ void MarlinUI::draw_status_screen() {
* Show all values at right of screen
*/
_XLABEL(_LCD_W_POS, 1);
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x]))));
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
_YLABEL(_LCD_W_POS, 2);
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[inverted_y]))));
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
/**
* Show the location value
*/
_ZLABEL(_LCD_W_POS, 3);
if (!isnan(ubl.z_values[x][inverted_y]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x][inverted_y]));
if (!isnan(ubl.z_values[x_plot][y_plot]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
else
lcd_put_u8str_P(PSTR(" -----"));
+5 -1
View File
@@ -40,10 +40,14 @@
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
#elif defined(ARDUINO_ARCH_STM32)
uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
#elif defined(__AVR__)
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
+397 -2
View File
@@ -35,7 +35,7 @@
#include "../../../_Bootscreen.h"
#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH
#define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8)
#define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8)
#endif
#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT
#define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH))
@@ -69,6 +69,142 @@
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
const unsigned char start_bmp1[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
const unsigned char start_bmp2[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000111,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000011,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
const unsigned char start_bmp3[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000000,B00000000,B00000000,B00000111,
B10001100,B00110000,B11001111,B11000000,B00000000,B00000000,B00000011,
B10001100,B00110000,B11011100,B11100000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11011000,B01100000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11010000,B01100000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11011000,B01100000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11011100,B01100000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11001111,B01110000,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000111,B01110000,B00000000,B00000000,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
const unsigned char start_bmp4[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000011,B10000000,B00000000,B00000111,
B10001100,B00110000,B11001111,B11000111,B11000000,B00000000,B00000011,
B10001100,B00110000,B11011100,B11101100,B11100000,B00000000,B00000001,
B10001100,B00110000,B11011000,B01101100,B01100000,B00000000,B00000001,
B10001100,B00110000,B11010000,B01101100,B00000000,B00000000,B00000001,
B10001100,B00110000,B11011000,B01101100,B00000000,B00000000,B00000001,
B10001100,B00110000,B11011100,B01101100,B00000000,B00000000,B00000001,
B10001100,B00110000,B11001111,B01111100,B00000000,B00000000,B00000001,
B10001100,B00110000,B11000111,B01111100,B00000000,B00000000,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
const unsigned char start_bmp5[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00001100,B00000000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00001100,B00000000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000011,B10001100,B00000000,B00000111,
B10001100,B00110000,B11001111,B11000111,B11001100,B00000000,B00000011,
B10001100,B00110000,B11011100,B11101100,B11101100,B00000000,B00000001,
B10001100,B00110000,B11011000,B01101100,B01101100,B00000000,B00000001,
B10001100,B00110000,B11010000,B01101100,B00001100,B00000000,B00000001,
B10001100,B00110000,B11011000,B01101100,B00001100,B00000000,B00000001,
B10001100,B00110000,B11011100,B01101100,B00001110,B00000000,B00000001,
B10001100,B00110000,B11001111,B01111100,B00000111,B10000000,B00000001,
B10001100,B00110000,B11000111,B01111100,B00000011,B10000000,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
const unsigned char start_bmp6[] PROGMEM = {
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111,
B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111,
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B00000111,
B10001100,B00110000,B11001111,B11000111,B11001100,B00110000,B00000011,
B10001100,B00110000,B11011100,B11101100,B11101100,B00110000,B00000001,
B10001100,B00110000,B11011000,B01101100,B01101100,B00110000,B00000001,
B10001100,B00110000,B11010000,B01101100,B00001100,B00110000,B00000001,
B10001100,B00110000,B11011000,B01101100,B00001100,B00110000,B00000001,
B10001100,B00110000,B11011100,B01101100,B00001110,B00111000,B00000001,
B10001100,B00110000,B11001111,B01111100,B00000111,B10011100,B00000001,
B10001100,B00110000,B11000111,B01111100,B00000011,B10001100,B00000001,
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
};
#endif
#else
#define START_BMPWIDTH 112
@@ -114,10 +250,269 @@
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
const unsigned char start_bmp1[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
const unsigned char start_bmp2[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
const unsigned char start_bmp3[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
const unsigned char start_bmp4[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B00000000,B00000000,B00000000,B00000000,B00111111,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B00000000,B00000000,B00000000,B00000000,B00011111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00001111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B00000000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
const unsigned char start_bmp5[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00011111,B11111111,
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00001111,B11111111,
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000111,B11111111,
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000011,B11111111,
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111,
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00000000,B00000000,B00000000,B01111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00000000,B00000000,B00000000,B00111111,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00000000,B00000000,B00000000,B00011111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00000000,B00000000,B00000000,B00001111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00000000,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B00000000,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B00000000,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
const unsigned char start_bmp6[] PROGMEM = {
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111,
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111,
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111,
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111,
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111,
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111,
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000000,B00000000,B01111111,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000000,B00000000,B00111111,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00000000,B00000000,B00011111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00000000,B00000000,B00001111,
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00000000,B00000000,B00000111,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B00000000,B00000000,B00000011,
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B00000000,B00000000,B00000011,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
};
#endif
#endif
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
#ifndef MARLIN_BOOTSCREEN_FRAME_TIME
#define MARLIN_BOOTSCREEN_FRAME_TIME 100 // (ms)
#endif
const unsigned char * const marlin_bootscreen_animation[] PROGMEM = {
start_bmp1, start_bmp2, start_bmp3, start_bmp4, start_bmp5, start_bmp6, start_bmp
};
#endif
#ifndef START_BMP_BYTEWIDTH
#define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8)
#define START_BMP_BYTEWIDTH CEILING(START_BMPWIDTH, 8)
#endif
#ifndef START_BMPHEIGHT
#define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH))
+6 -6
View File
@@ -1220,10 +1220,10 @@
#define STATUS_HOTEND4_WIDTH STATUS_HOTEND3_WIDTH
#endif
#ifndef STATUS_HOTEND5_WIDTH
#define STATUS_HOTEND5_WIDTH STATUS_HOTEND5_WIDTH
#define STATUS_HOTEND5_WIDTH STATUS_HOTEND4_WIDTH
#endif
#ifndef STATUS_HOTEND6_WIDTH
#define STATUS_HOTEND6_WIDTH STATUS_HOTEND6_WIDTH
#define STATUS_HOTEND6_WIDTH STATUS_HOTEND5_WIDTH
#endif
constexpr uint8_t status_hotend_width[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_WIDTH, STATUS_HOTEND2_WIDTH, STATUS_HOTEND3_WIDTH, STATUS_HOTEND4_WIDTH, STATUS_HOTEND5_WIDTH, STATUS_HOTEND6_WIDTH);
@@ -1264,10 +1264,10 @@
#define STATUS_HOTEND4_X STATUS_HOTEND3_X + STATUS_HEATERS_XSPACE
#endif
#ifndef STATUS_HOTEND5_X
#define STATUS_HOTEND5_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE
#define STATUS_HOTEND5_X STATUS_HOTEND4_X + STATUS_HEATERS_XSPACE
#endif
#ifndef STATUS_HOTEND6_X
#define STATUS_HOTEND6_X STATUS_HOTEND6_X + STATUS_HEATERS_XSPACE
#define STATUS_HOTEND6_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE
#endif
#if HOTENDS > 2
@@ -1291,10 +1291,10 @@
#define STATUS_HOTEND4_TEXT_X STATUS_HOTEND3_TEXT_X + STATUS_HEATERS_XSPACE
#endif
#ifndef STATUS_HOTEND5_TEXT_X
#define STATUS_HOTEND5_TEXT_X STATUS_HOTEND5_TEXT_X + STATUS_HEATERS_XSPACE
#define STATUS_HOTEND5_TEXT_X STATUS_HOTEND4_TEXT_X + STATUS_HEATERS_XSPACE
#endif
#ifndef STATUS_HOTEND6_TEXT_X
#define STATUS_HOTEND6_TEXT_X STATUS_HOTEND6_TEXT_X + STATUS_HEATERS_XSPACE
#define STATUS_HOTEND6_TEXT_X STATUS_HOTEND5_TEXT_X + STATUS_HEATERS_XSPACE
#endif
constexpr uint8_t status_hotend_text_x[] = ARRAY_N(HOTENDS, STATUS_HOTEND1_TEXT_X, STATUS_HOTEND2_TEXT_X, STATUS_HOTEND3_TEXT_X, STATUS_HOTEND4_TEXT_X, STATUS_HOTEND5_TEXT_X, STATUS_HOTEND6_TEXT_X);
#define STATUS_HOTEND_TEXT_X(N) status_hotend_text_x[N]
@@ -22,18 +22,18 @@
// reduced font (only symbols 1 - 127) - saves about 1278 bytes of FLASH
/*
Fontname: -Marlin6x12-Fixed-Medium-R-SemiCondensed--12-110-75-75-C-60-ISO10646-1
Fontname: -Marlin6x12-Fixed-Medium-R-SemiCondensed--12-90-100-100-C-111-ISO10646-1
Copyright: Public domain terminal emulator font. Share and enjoy. original font -Misc-Fixed-Medium-R-SemiCondensed--12-110-75-75-C-60-ISO10646-1
Capital A Height: 7, '1' Height: 7
Calculated Max Values w= 5 h=10 x= 5 y= 5 dx= 6 dy= 0 ascent= 8 len=10
Font Bounding box w= 6 h=12 x= 0 y=-2
Font Bounding box w=12 h=13 x= 0 y=-2
Calculated Min Values x= 0 y=-2 dx= 0 dy= 0
Pure Font ascent = 7 descent=-2
X Font ascent = 8 descent=-2
Max Font ascent = 8 descent=-2
*/
const u8g_fntpgm_uint8_t ISO10646_1_5x7[1325] U8G_FONT_SECTION("ISO10646_1_5x7") = {
0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0x7f,0xfe,0x08,0xfe,0x08,
0x00,0x0c,0x0d,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0x7f,0xfe,0x08,0xfe,0x08,
0xfe,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0xf0,0xc8,0x88,0x88,0x98,0x78,0x10,0x05,
0x08,0x08,0x06,0x00,0x00,0xc0,0xf8,0x88,0x88,0x88,0x88,0x88,0xf8,0x05,0x05,0x05,
0x06,0x00,0x01,0x20,0x30,0xf8,0x30,0x20,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x70,
@@ -120,18 +120,18 @@ const u8g_fntpgm_uint8_t ISO10646_1_5x7[1325] U8G_FONT_SECTION("ISO10646_1_5x7")
// extended (original) font (symbols 1 - 255)
/*
Fontname: -Marlin6x12-Fixed-Medium-R-SemiCondensed--12-110-75-75-C-60-ISO10646-1
Fontname: -Marlin6x12-Fixed-Medium-R-SemiCondensed--12-90-100-100-C-111-ISO10646-1
Copyright: Public domain terminal emulator font. Share and enjoy. original font -Misc-Fixed-Medium-R-SemiCondensed--12-110-75-75-C-60-ISO10646-1
Capital A Height: 7, '1' Height: 7
Calculated Max Values w= 6 h=10 x= 5 y= 7 dx= 6 dy= 0 ascent=10 len=10
Font Bounding box w= 6 h=12 x= 0 y=-2
Font Bounding box w=12 h=13 x= 0 y=-2
Calculated Min Values x= 0 y=-2 dx= 0 dy= 0
Pure Font ascent = 7 descent=-2
X Font ascent = 8 descent=-2
Max Font ascent =10 descent=-2
*/
const u8g_fntpgm_uint8_t ISO10646_1_5x7[2648] U8G_FONT_SECTION("ISO10646_1_5x7") = {
0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0xff,0xfe,0x0a,0xfe,0x08,
0x00,0x0c,0x0d,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0xff,0xfe,0x0a,0xfe,0x08,
0xfe,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0xf0,0xc8,0x88,0x88,0x98,0x78,0x10,0x05,
0x08,0x08,0x06,0x00,0x00,0xc0,0xf8,0x88,0x88,0x88,0x88,0x88,0xf8,0x05,0x05,0x05,
0x06,0x00,0x01,0x20,0x30,0xf8,0x30,0x20,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x70,
+232
View File
@@ -0,0 +1,232 @@
/**
* Generated automatically by buildroot/share/fonts/uxggenpages.sh
* Contents will be REPLACED by future processing!
* Use genallfont.sh to generate font data for updated languages.
*/
#include <U8glib.h>
const u8g_fntpgm_uint8_t fontpage_2_131_131[31] U8G_FONT_SECTION("fontpage_2_131_131") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x83,0x83,0x00,0x08,0x00,0x00,
0x00,0x05,0x08,0x08,0x06,0x00,0x00,0x88,0x70,0x00,0x70,0x08,0x78,0x88,0x78};
const u8g_fntpgm_uint8_t fontpage_2_144_145[44] U8G_FONT_SECTION("fontpage_2_144_145") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x90,0x91,0x00,0x08,0x00,0x00,
0x00,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0xe8,0x48,0x48,0xf0,0x06,0x08,
0x08,0x06,0x00,0x00,0x08,0x1c,0x08,0x78,0x88,0x88,0x88,0x78};
const u8g_fntpgm_uint8_t fontpage_2_169_169[31] U8G_FONT_SECTION("fontpage_2_169_169") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa9,0xa9,0x00,0x08,0x00,0x00,
0x00,0x04,0x08,0x08,0x06,0x00,0x00,0x50,0xa0,0x00,0x60,0x20,0x20,0x20,0x70};
const u8g_fntpgm_uint8_t fontpage_3_161_161[30] U8G_FONT_SECTION("fontpage_3_161_161") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa1,0xa1,0x00,0x07,0x00,0x00,
0x00,0x05,0x07,0x07,0x06,0x00,0x00,0x08,0x08,0x70,0x88,0x88,0x88,0x70};
const u8g_fntpgm_uint8_t fontpage_3_175_176[43] U8G_FONT_SECTION("fontpage_3_175_176") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xaf,0xb0,0x00,0x08,0x00,0x00,
0x00,0x05,0x08,0x08,0x06,0x00,0x00,0x08,0x98,0x90,0x90,0x90,0x90,0x90,0x60,0x05,
0x06,0x06,0x06,0x00,0x00,0x08,0x98,0x90,0x90,0xb0,0x50};
const u8g_fntpgm_uint8_t fontpage_6_131_131[25] U8G_FONT_SECTION("fontpage_6_131_131") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x83,0x83,0x00,0x0a,0x00,0x00,
0x00,0x05,0x02,0x02,0x06,0x00,0x08,0x68,0xb0};
const u8g_fntpgm_uint8_t fontpage_6_137_137[26] U8G_FONT_SECTION("fontpage_6_137_137") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x89,0x89,0x00,0x0a,0x00,0x00,
0x00,0x03,0x03,0x03,0x06,0x01,0x07,0xc0,0x20,0x40};
const u8g_fntpgm_uint8_t fontpage_6_163_163[24] U8G_FONT_SECTION("fontpage_6_163_163") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa3,0xa3,0x00,0x00,0xfe,0x00,
0x00,0x01,0x01,0x01,0x06,0x02,0xfe,0x80};
const u8g_fntpgm_uint8_t fontpage_6_192_193[33] U8G_FONT_SECTION("fontpage_6_192_193") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc0,0xc1,0x00,0x0a,0x00,0x00,
0x00,0x02,0x02,0x02,0x06,0x01,0x08,0x80,0x40,0x02,0x02,0x02,0x06,0x02,0x08,0x40,
0x80};
const u8g_fntpgm_uint8_t fontpage_61_161_161[30] U8G_FONT_SECTION("fontpage_61_161_161") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa1,0xa1,0x00,0x05,0xfe,0x00,
0x00,0x05,0x07,0x07,0x07,0x00,0xfe,0x70,0x08,0x78,0x88,0x78,0x00,0x20};
const u8g_fntpgm_uint8_t fontpage_61_163_163[32] U8G_FONT_SECTION("fontpage_61_163_163") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa3,0xa3,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x30,0x10,0x20,0x00,0x70,0x08,0x78,0x88,0x78
};
const u8g_fntpgm_uint8_t fontpage_61_165_165[33] U8G_FONT_SECTION("fontpage_61_165_165") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa5,0xa5,0x00,0x0a,0x00,0x00,
0x00,0x06,0x0a,0x0a,0x07,0x00,0x00,0x04,0x08,0x30,0x48,0x00,0x70,0x08,0x78,0x88,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_167_167[33] U8G_FONT_SECTION("fontpage_61_167_167") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa7,0xa7,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x10,0x08,0x30,0x48,0x00,0x70,0x08,0x78,0x88,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_169_169[34] U8G_FONT_SECTION("fontpage_61_169_169") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa9,0xa9,0x00,0x0b,0x00,0x00,
0x00,0x06,0x0b,0x0b,0x07,0x00,0x00,0x0c,0x04,0x08,0x30,0x48,0x00,0x70,0x08,0x78,
0x88,0x78};
const u8g_fntpgm_uint8_t fontpage_61_173_173[33] U8G_FONT_SECTION("fontpage_61_173_173") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xad,0xad,0x00,0x08,0xfe,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0xfe,0x30,0x48,0x00,0x70,0x08,0x78,0x88,0x78,0x00,
0x20};
const u8g_fntpgm_uint8_t fontpage_61_175_175[33] U8G_FONT_SECTION("fontpage_61_175_175") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xaf,0xaf,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x08,0x10,0x48,0x30,0x00,0x70,0x08,0x78,0x88,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_177_177[33] U8G_FONT_SECTION("fontpage_61_177_177") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb1,0xb1,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x40,0x20,0x48,0x30,0x00,0x70,0x08,0x78,0x88,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_179_179[34] U8G_FONT_SECTION("fontpage_61_179_179") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb3,0xb3,0x00,0x0b,0x00,0x00,
0x00,0x05,0x0b,0x0b,0x07,0x00,0x00,0x18,0x08,0x10,0x48,0x30,0x00,0x70,0x08,0x78,
0x88,0x78};
const u8g_fntpgm_uint8_t fontpage_61_181_181[34] U8G_FONT_SECTION("fontpage_61_181_181") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb5,0xb5,0x00,0x0b,0x00,0x00,
0x00,0x06,0x0b,0x0b,0x07,0x00,0x00,0x14,0x28,0x00,0x48,0x30,0x00,0x70,0x08,0x78,
0x88,0x78};
const u8g_fntpgm_uint8_t fontpage_61_183_183[33] U8G_FONT_SECTION("fontpage_61_183_183") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb7,0xb7,0x00,0x08,0xfe,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0xfe,0x48,0x30,0x00,0x70,0x08,0x78,0x88,0x78,0x00,
0x20};
const u8g_fntpgm_uint8_t fontpage_61_187_187[32] U8G_FONT_SECTION("fontpage_61_187_187") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x30,0x10,0x20,0x00,0x70,0x88,0xf0,0x80,0x78
};
const u8g_fntpgm_uint8_t fontpage_61_191_191[33] U8G_FONT_SECTION("fontpage_61_191_191") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x0a,0x00,0x00,
0x00,0x06,0x0a,0x0a,0x07,0x00,0x00,0x04,0x08,0x20,0x50,0x00,0x70,0x88,0xf0,0x80,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_193_193[33] U8G_FONT_SECTION("fontpage_61_193_193") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc1,0xc1,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x10,0x08,0x20,0x50,0x00,0x70,0x88,0xf0,0x80,
0x78};
const u8g_fntpgm_uint8_t fontpage_61_195_195[34] U8G_FONT_SECTION("fontpage_61_195_195") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0x00,0x0b,0x00,0x00,
0x00,0x05,0x0b,0x0b,0x07,0x00,0x00,0x18,0x08,0x10,0x60,0x90,0x00,0x60,0x90,0xf0,
0x80,0x70};
const u8g_fntpgm_uint8_t fontpage_61_199_199[33] U8G_FONT_SECTION("fontpage_61_199_199") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc7,0xc7,0x00,0x08,0xfe,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0xfe,0x20,0x50,0x00,0x70,0x88,0xf0,0x80,0x78,0x00,
0x20};
const u8g_fntpgm_uint8_t fontpage_61_201_201[32] U8G_FONT_SECTION("fontpage_61_201_201") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc9,0xc9,0x00,0x09,0x00,0x00,
0x00,0x03,0x09,0x09,0x07,0x02,0x00,0x60,0x20,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0
};
const u8g_fntpgm_uint8_t fontpage_61_203_203[32] U8G_FONT_SECTION("fontpage_61_203_203") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xcb,0xcb,0x00,0x07,0xfe,0x00,
0x00,0x03,0x09,0x09,0x07,0x02,0xfe,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0,0x00,0x40
};
const u8g_fntpgm_uint8_t fontpage_61_205_205[30] U8G_FONT_SECTION("fontpage_61_205_205") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xcd,0xcd,0x00,0x05,0xfe,0x00,
0x00,0x05,0x07,0x07,0x07,0x00,0xfe,0x70,0x88,0x88,0x88,0x70,0x00,0x20};
const u8g_fntpgm_uint8_t fontpage_61_207_207[32] U8G_FONT_SECTION("fontpage_61_207_207") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xcf,0xcf,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x30,0x10,0x20,0x00,0x70,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_209_209[33] U8G_FONT_SECTION("fontpage_61_209_209") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xd1,0xd1,0x00,0x0a,0x00,0x00,
0x00,0x06,0x0a,0x0a,0x07,0x00,0x00,0x04,0x08,0x20,0x50,0x00,0x70,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_211_211[33] U8G_FONT_SECTION("fontpage_61_211_211") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xd3,0xd3,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x10,0x08,0x20,0x50,0x00,0x70,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_213_213[33] U8G_FONT_SECTION("fontpage_61_213_213") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xd5,0xd5,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x18,0x08,0x30,0x50,0x00,0x70,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_215_215[34] U8G_FONT_SECTION("fontpage_61_215_215") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xd7,0xd7,0x00,0x0b,0x00,0x00,
0x00,0x05,0x0b,0x0b,0x07,0x00,0x00,0x28,0x50,0x00,0x20,0x50,0x00,0x70,0x88,0x88,
0x88,0x70};
const u8g_fntpgm_uint8_t fontpage_61_217_217[33] U8G_FONT_SECTION("fontpage_61_217_217") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xd9,0xd9,0x00,0x08,0xfe,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0xfe,0x20,0x50,0x00,0x70,0x88,0x88,0x88,0x70,0x00,
0x20};
const u8g_fntpgm_uint8_t fontpage_61_219_219[32] U8G_FONT_SECTION("fontpage_61_219_219") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xdb,0xdb,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x20,0x40,0x10,0x08,0x70,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_221_221[32] U8G_FONT_SECTION("fontpage_61_221_221") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xdd,0xdd,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x80,0x40,0x10,0x08,0x70,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_223_223[33] U8G_FONT_SECTION("fontpage_61_223_223") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xdf,0xdf,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x60,0x20,0x40,0x10,0x08,0x70,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_225_225[32] U8G_FONT_SECTION("fontpage_61_225_225") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xe1,0xe1,0x00,0x09,0x00,0x00,
0x00,0x05,0x09,0x09,0x07,0x00,0x00,0x50,0xa0,0x10,0x08,0x70,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_227_227[32] U8G_FONT_SECTION("fontpage_61_227_227") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xe3,0xe3,0x00,0x07,0xfe,0x00,
0x00,0x05,0x09,0x09,0x00,0x00,0xfe,0x10,0x08,0x70,0x88,0x88,0x88,0x70,0x00,0x20
};
const u8g_fntpgm_uint8_t fontpage_61_229_229[30] U8G_FONT_SECTION("fontpage_61_229_229") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xe5,0xe5,0x00,0x05,0xfe,0x00,
0x00,0x05,0x07,0x07,0x07,0x00,0xfe,0x88,0x88,0x88,0x88,0x70,0x00,0x20};
const u8g_fntpgm_uint8_t fontpage_61_231_231[33] U8G_FONT_SECTION("fontpage_61_231_231") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xe7,0xe7,0x00,0x0a,0x00,0x00,
0x00,0x05,0x0a,0x0a,0x07,0x00,0x00,0x30,0x10,0x20,0x00,0x00,0x88,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_233_233[32] U8G_FONT_SECTION("fontpage_61_233_233") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xe9,0xe9,0x00,0x09,0x00,0x00,
0x00,0x06,0x09,0x09,0x07,0x00,0x00,0x10,0x20,0x0c,0x04,0x88,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_235_235[32] U8G_FONT_SECTION("fontpage_61_235_235") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xeb,0xeb,0x00,0x09,0x00,0x00,
0x00,0x06,0x09,0x09,0x07,0x00,0x00,0x40,0x20,0x0c,0x04,0x88,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_237_237[33] U8G_FONT_SECTION("fontpage_61_237_237") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xed,0xed,0x00,0x0a,0x00,0x00,
0x00,0x06,0x0a,0x0a,0x07,0x00,0x00,0x30,0x10,0x20,0x0c,0x04,0x88,0x88,0x88,0x88,
0x70};
const u8g_fntpgm_uint8_t fontpage_61_239_239[32] U8G_FONT_SECTION("fontpage_61_239_239") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xef,0xef,0x00,0x09,0x00,0x00,
0x00,0x06,0x09,0x09,0x07,0x00,0x00,0x28,0x50,0x0c,0x04,0x88,0x88,0x88,0x88,0x70
};
const u8g_fntpgm_uint8_t fontpage_61_241_241[32] U8G_FONT_SECTION("fontpage_61_241_241") = {
0x00,0x0c,0x0d,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xf1,0xf1,0x00,0x07,0xfe,0x00,
0x00,0x06,0x09,0x09,0x07,0x00,0xfe,0x0c,0x04,0x88,0x88,0x88,0x88,0x70,0x00,0x20
};
#define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data }
static const uxg_fontinfo_t g_fontinfo[] PROGMEM = {
FONTDATA_ITEM(2, 131, 131, fontpage_2_131_131), // 'ă' -- 'ă'
FONTDATA_ITEM(2, 144, 145, fontpage_2_144_145), // 'Đ' -- 'đ'
FONTDATA_ITEM(2, 169, 169, fontpage_2_169_169), // 'ĩ' -- 'ĩ'
FONTDATA_ITEM(3, 161, 161, fontpage_3_161_161), // 'ơ' -- 'ơ'
FONTDATA_ITEM(3, 175, 176, fontpage_3_175_176), // 'Ư' -- 'ư'
FONTDATA_ITEM(6, 131, 131, fontpage_6_131_131), // '̃' -- '̃'
FONTDATA_ITEM(6, 137, 137, fontpage_6_137_137), // '̉' -- '̉'
FONTDATA_ITEM(6, 163, 163, fontpage_6_163_163), // '̣' -- '̣'
FONTDATA_ITEM(6, 192, 193, fontpage_6_192_193), // '̀' -- '́'
FONTDATA_ITEM(61, 161, 161, fontpage_61_161_161), // 'ạ' -- 'ạ'
FONTDATA_ITEM(61, 163, 163, fontpage_61_163_163), // 'ả' -- 'ả'
FONTDATA_ITEM(61, 165, 165, fontpage_61_165_165), // 'ấ' -- 'ấ'
FONTDATA_ITEM(61, 167, 167, fontpage_61_167_167), // 'ầ' -- 'ầ'
FONTDATA_ITEM(61, 169, 169, fontpage_61_169_169), // 'ẩ' -- 'ẩ'
FONTDATA_ITEM(61, 173, 173, fontpage_61_173_173), // 'ậ' -- 'ậ'
FONTDATA_ITEM(61, 175, 175, fontpage_61_175_175), // 'ắ' -- 'ắ'
FONTDATA_ITEM(61, 177, 177, fontpage_61_177_177), // 'ằ' -- 'ằ'
FONTDATA_ITEM(61, 179, 179, fontpage_61_179_179), // 'ẳ' -- 'ẳ'
FONTDATA_ITEM(61, 181, 181, fontpage_61_181_181), // 'ẵ' -- 'ẵ'
FONTDATA_ITEM(61, 183, 183, fontpage_61_183_183), // 'ặ' -- 'ặ'
FONTDATA_ITEM(61, 187, 187, fontpage_61_187_187), // 'ẻ' -- 'ẻ'
FONTDATA_ITEM(61, 191, 191, fontpage_61_191_191), // 'ế' -- 'ế'
FONTDATA_ITEM(61, 193, 193, fontpage_61_193_193), // 'ề' -- 'ề'
FONTDATA_ITEM(61, 195, 195, fontpage_61_195_195), // 'ể' -- 'ể'
FONTDATA_ITEM(61, 199, 199, fontpage_61_199_199), // 'ệ' -- 'ệ'
FONTDATA_ITEM(61, 201, 201, fontpage_61_201_201), // 'ỉ' -- 'ỉ'
FONTDATA_ITEM(61, 203, 203, fontpage_61_203_203), // 'ị' -- 'ị'
FONTDATA_ITEM(61, 205, 205, fontpage_61_205_205), // 'ọ' -- 'ọ'
FONTDATA_ITEM(61, 207, 207, fontpage_61_207_207), // 'ỏ' -- 'ỏ'
FONTDATA_ITEM(61, 209, 209, fontpage_61_209_209), // 'ố' -- 'ố'
FONTDATA_ITEM(61, 211, 211, fontpage_61_211_211), // 'ồ' -- 'ồ'
FONTDATA_ITEM(61, 213, 213, fontpage_61_213_213), // 'ổ' -- 'ổ'
FONTDATA_ITEM(61, 215, 215, fontpage_61_215_215), // 'ỗ' -- 'ỗ'
FONTDATA_ITEM(61, 217, 217, fontpage_61_217_217), // 'ộ' -- 'ộ'
FONTDATA_ITEM(61, 219, 219, fontpage_61_219_219), // 'ớ' -- 'ớ'
FONTDATA_ITEM(61, 221, 221, fontpage_61_221_221), // 'ờ' -- 'ờ'
FONTDATA_ITEM(61, 223, 223, fontpage_61_223_223), // 'ở' -- 'ở'
FONTDATA_ITEM(61, 225, 225, fontpage_61_225_225), // 'ỡ' -- 'ỡ'
FONTDATA_ITEM(61, 227, 227, fontpage_61_227_227), // 'ợ' -- 'ợ'
FONTDATA_ITEM(61, 229, 229, fontpage_61_229_229), // 'ụ' -- 'ụ'
FONTDATA_ITEM(61, 231, 231, fontpage_61_231_231), // 'ủ' -- 'ủ'
FONTDATA_ITEM(61, 233, 233, fontpage_61_233_233), // 'ứ' -- 'ứ'
FONTDATA_ITEM(61, 235, 235, fontpage_61_235_235), // 'ừ' -- 'ừ'
FONTDATA_ITEM(61, 237, 237, fontpage_61_237_237), // 'ử' -- 'ử'
FONTDATA_ITEM(61, 239, 239, fontpage_61_239_239), // 'ữ' -- 'ữ'
FONTDATA_ITEM(61, 241, 241, fontpage_61_241_241), // 'ự' -- 'ự'
};
+7 -11
View File
@@ -22,7 +22,7 @@
int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(u8g.getU8g()); }
void lcd_moveto(const uint8_t col, const uint8_t row) { u8g.setPrintPos(col, row); }
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { u8g.setPrintPos(col, row); }
void lcd_put_int(const int i) { u8g.print(i); }
@@ -33,26 +33,22 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
u8g.print((char)c);
return u8g_GetFontBBXWidth(u8g.getU8g());
}
unsigned int x = u8g.getPrintCol(),
y = u8g.getPrintRow(),
ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length);
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length);
u8g.setPrintPos(x + ret, y);
return ret;
}
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
unsigned int x = u8g.getPrintCol(),
y = u8g.getPrintRow(),
ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
u8g.setPrintPos(x + ret, y);
return ret;
}
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
unsigned int x = u8g.getPrintCol(),
y = u8g.getPrintRow(),
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
u8g.setPrintPos(x + ret, y);
return ret;
}
+12 -29
View File
@@ -100,8 +100,7 @@
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, const uint8_t ty) {
const char *str = i16tostr3(temp);
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
lcd_moveto(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty);
lcd_put_u8str(&str[3-len]);
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
lcd_put_wchar(LCD_STR_DEGREE[0]);
}
@@ -264,8 +263,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin
//
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
const uint8_t offs = (XYZ_SPACING) * axis;
lcd_moveto(X_LABEL_POS + offs, XYZ_BASELINE);
lcd_put_wchar('X' + axis);
lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, 'X' + axis);
lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE);
if (blink)
lcd_put_u8str(value);
@@ -429,8 +427,7 @@ void MarlinUI::draw_status_screen() {
c = '*';
}
#endif
lcd_moveto(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y);
lcd_put_u8str(i16tostr3(thermalManager.fanPercent(spd)));
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3(thermalManager.fanPercent(spd)));
lcd_put_wchar(c);
}
}
@@ -488,8 +485,7 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(DOGM_SD_PERCENT)
if (PAGE_CONTAINS(41, 48)) {
// Percent complete
lcd_moveto(55, 48);
lcd_put_u8str(ui8tostr3(progress));
lcd_put_u8str(55, 48, ui8tostr3(progress));
lcd_put_wchar('%');
}
#endif
@@ -510,8 +506,7 @@ void MarlinUI::draw_status_screen() {
duration_t elapsed = print_job_timer.duration();
bool has_days = (elapsed.value >= 60*60*24L);
uint8_t len = elapsed.toDigital(buffer, has_days);
lcd_moveto(SD_DURATION_X, EXTRAS_BASELINE);
lcd_put_u8str(buffer);
lcd_put_u8str(SD_DURATION_X, EXTRAS_BASELINE, buffer);
}
#endif // HAS_PRINT_PROGRESS
@@ -520,10 +515,6 @@ void MarlinUI::draw_status_screen() {
// XYZ Coordinates
//
#define X_LABEL_POS 3
#define X_VALUE_POS 11
#define XYZ_SPACING 37
#if ENABLED(XYZ_HOLLOW_FRAME)
#define XYZ_FRAME_TOP 29
#define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3
@@ -550,8 +541,6 @@ void MarlinUI::draw_status_screen() {
// Two-component mix / gradient instead of XY
lcd_moveto(X_LABEL_POS, XYZ_BASELINE);
char mixer_messages[12];
const char *mix_label;
#if ENABLED(GRADIENT_MIX)
@@ -566,7 +555,7 @@ void MarlinUI::draw_status_screen() {
mix_label = "Mx";
}
sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
lcd_put_u8str(mixer_messages);
lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
#else
@@ -591,28 +580,22 @@ void MarlinUI::draw_status_screen() {
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
set_font(FONT_MENU);
lcd_moveto(3, EXTRAS_2_BASELINE);
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
set_font(FONT_STATUSMENU);
lcd_moveto(12, EXTRAS_2_BASELINE);
lcd_put_u8str(i16tostr3(feedrate_percentage));
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3(feedrate_percentage));
lcd_put_wchar('%');
//
// Filament sensor display if SD is disabled
//
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
lcd_moveto(56, EXTRAS_2_BASELINE);
lcd_put_u8str(wstring);
lcd_moveto(102, EXTRAS_2_BASELINE);
lcd_put_u8str(mstring);
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
lcd_put_wchar('%');
set_font(FONT_MENU);
lcd_moveto(47, EXTRAS_2_BASELINE);
lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
lcd_moveto(93, EXTRAS_2_BASELINE);
lcd_put_wchar(LCD_STR_FILAM_MUL[0]);
lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
#endif
}
@@ -666,17 +666,14 @@ void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, cons
// If position is unknown, flash the labels.
const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0);
dtostrf(x, -4, 0, str);
write_byte(alt_label ? alt_label : 'X');
write_str(str, 4);
write_str(dtostrf(x, -4, 0, str), 4);
dtostrf(y, -4, 0, str);
write_byte(alt_label ? alt_label : 'Y');
write_str(str, 4);
write_str(dtostrf(y, -4, 0, str), 4);
dtostrf(z, -5, 1, str);
write_byte(alt_label ? alt_label : 'Z');
write_str(str, 5);
write_str(dtostrf(z, -5, 1, str), 5);
}
bool ST7920_Lite_Status_Screen::indicators_changed() {
+74 -74
View File
@@ -102,30 +102,29 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
}
}
bool MarlinUI::detected() { return true; }
#if ENABLED(SHOW_BOOTSCREEN)
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
// Draws a slice of a particular frame of the custom bootscreen, without the u8g loop
void MarlinUI::draw_custom_bootscreen(const uint8_t frame/*=0*/) {
constexpr u8g_uint_t left = u8g_uint_t((LCD_PIXEL_WIDTH - (CUSTOM_BOOTSCREEN_BMPWIDTH)) / 2),
top = u8g_uint_t((LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2);
top = u8g_uint_t((LCD_PIXEL_HEIGHT - (CUSTOM_BOOTSCREEN_BMPHEIGHT)) / 2);
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
constexpr u8g_uint_t right = left + CUSTOM_BOOTSCREEN_BMPWIDTH,
bottom = top + CUSTOM_BOOTSCREEN_BMPHEIGHT;
#endif
const u8g_pgm_uint8_t * const bmp =
#if ENABLED(ANIMATED_BOOTSCREEN)
#if ENABLED(CUSTOM_BOOTSCREEN_ANIMATED)
(u8g_pgm_uint8_t*)pgm_read_ptr(&custom_bootscreen_animation[frame])
#else
custom_start_bmp
#endif
;
u8g.drawBitmapP(
left, top,
CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8), CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp
);
u8g.drawBitmapP(left, top, CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH, CUSTOM_BOOTSCREEN_BMPHEIGHT, bmp);
#if ENABLED(CUSTOM_BOOTSCREEN_INVERTED)
if (frame == 0) {
@@ -140,7 +139,7 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
// Shows the custom bootscreen, with the u8g loop, animations and delays
void MarlinUI::show_custom_bootscreen() {
#if DISABLED(ANIMATED_BOOTSCREEN)
#if DISABLED(CUSTOM_BOOTSCREEN_ANIMATED)
constexpr millis_t d = 0;
constexpr uint8_t f = 0;
#else
@@ -163,23 +162,22 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
// Draws a slice of the Marlin bootscreen, without the u8g loop
void MarlinUI::draw_marlin_bootscreen() {
// Screen dimensions.
//const uint8_t width = u8g.getWidth(), height = u8g.getHeight();
constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
//const u8g_uint_t width = u8g.getWidth(), height = u8g.getHeight();
constexpr u8g_uint_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT;
// Determine text space needed
#ifndef STRING_SPLASH_LINE2
constexpr uint8_t text_total_height = MENU_FONT_HEIGHT,
text_width_1 = uint8_t(sizeof(STRING_SPLASH_LINE1) - 1) * uint8_t(MENU_FONT_WIDTH),
text_width_2 = 0;
constexpr u8g_uint_t text_total_height = MENU_FONT_HEIGHT,
text_width_2 = 0;
#else
constexpr uint8_t text_total_height = uint8_t(MENU_FONT_HEIGHT) * 2,
text_width_1 = uint8_t(sizeof(STRING_SPLASH_LINE1) - 1) * uint8_t(MENU_FONT_WIDTH),
text_width_2 = uint8_t(sizeof(STRING_SPLASH_LINE2) - 1) * uint8_t(MENU_FONT_WIDTH);
constexpr u8g_uint_t text_total_height = (MENU_FONT_HEIGHT) * 2,
text_width_2 = u8g_uint_t((sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH));
#endif
constexpr uint8_t text_max_width = _MAX(text_width_1, text_width_2),
rspace = width - (START_BMPWIDTH);
constexpr u8g_uint_t text_width_1 = u8g_uint_t((sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)),
text_max_width = _MAX(text_width_1, text_width_2),
rspace = width - (START_BMPWIDTH);
int8_t offx, offy, txt_base, txt_offx_1, txt_offx_2;
u8g_int_t offx, offy, txt_base, txt_offx_1, txt_offx_2;
// Can the text fit to the right of the bitmap?
if (text_max_width < rspace) {
@@ -200,13 +198,29 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
NOLESS(offx, 0);
NOLESS(offy, 0);
u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp);
set_font(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1);
auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
set_font(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
lcd_put_u8str_P(txt_offx_1, txt_base, PSTR(STRING_SPLASH_LINE1));
#else
lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(STRING_SPLASH_LINE1));
lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(STRING_SPLASH_LINE2));
#endif
};
#if DISABLED(BOOT_MARLIN_LOGO_ANIMATED)
draw_bootscreen_bmp(start_bmp);
#else
u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1);
u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2);
constexpr millis_t d = MARLIN_BOOTSCREEN_FRAME_TIME;
LOOP_L_N(f, COUNT(marlin_bootscreen_animation)) {
u8g.firstPage();
do {
const u8g_pgm_uint8_t * const bmp = (u8g_pgm_uint8_t*)pgm_read_ptr(&marlin_bootscreen_animation[f]);
draw_bootscreen_bmp(bmp);
} while (u8g.nextPage());
if (d) safe_delay(d);
}
#endif
}
@@ -286,16 +300,13 @@ void MarlinUI::draw_kill_screen() {
#if ENABLED(LIGHTWEIGHT_UI)
ST7920_Lite_Status_Screen::clear_text_buffer();
#endif
const uint8_t h4 = u8g.getHeight() / 4;
const u8g_uint_t h4 = u8g.getHeight() / 4;
u8g.firstPage();
do {
set_font(FONT_MENU);
lcd_moveto(0, h4 * 1);
lcd_put_u8str(status_message);
lcd_moveto(0, h4 * 2);
lcd_put_u8str_P(PSTR(MSG_HALTED));
lcd_moveto(0, h4 * 3);
lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
lcd_put_u8str(0, h4 * 1, status_message);
lcd_put_u8str_P(0, h4 * 2, PSTR(MSG_HALTED));
lcd_put_u8str_P(0, h4 * 3, PSTR(MSG_PLEASE_RESET));
} while (u8g.nextPage());
}
@@ -303,7 +314,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
#if HAS_LCD_MENU
uint8_t row_y1, row_y2;
u8g_uint_t row_y1, row_y2;
#if ENABLED(ADVANCED_PAUSE_FEATURE)
@@ -313,8 +324,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return;
lcd_moveto(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2);
lcd_put_wchar('E');
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
lcd_put_wchar((char)('1' + extruder));
lcd_put_wchar(' ');
lcd_put_u8str(i16tostr3(thermalManager.degHotend(extruder)));
@@ -360,7 +370,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (mark_as_selected(row, invert)) {
uint8_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
u8g_uint_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
if (center && !valstr) {
int8_t pad = (LCD_WIDTH - utf8_strlen_P(pstr)) / 2;
@@ -377,11 +387,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
UNUSED(pre_char);
if (mark_as_selected(row, sel)) {
uint8_t n = (LCD_WIDTH - 2) * (MENU_FONT_WIDTH);
u8g_uint_t n = (LCD_WIDTH - 2) * (MENU_FONT_WIDTH);
n -= lcd_put_u8str_max_P(pstr, n);
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2);
lcd_put_wchar(post_char);
lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
lcd_put_wchar(' ');
}
}
@@ -390,7 +399,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
if (mark_as_selected(row, sel)) {
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
uint8_t n = (LCD_WIDTH - 2 - vallen) * (MENU_FONT_WIDTH);
u8g_uint_t n = (LCD_WIDTH - 2 - vallen) * (MENU_FONT_WIDTH);
n -= lcd_put_u8str_max_P(pstr, n);
lcd_put_wchar(':');
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
@@ -402,13 +411,13 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
void draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
ui.encoder_direction_normal();
const uint8_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);
const u8g_uint_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);
bool extra_row = labellen > LCD_WIDTH - 2 - vallen;
#if ENABLED(USE_BIG_EDIT_FONT)
// Use the menu font if the label won't fit on a single line
constexpr uint8_t lcd_edit_width = (LCD_PIXEL_WIDTH) / (EDIT_FONT_WIDTH);
uint8_t lcd_chr_fit, one_chr_width;
constexpr u8g_uint_t lcd_edit_width = (LCD_PIXEL_WIDTH) / (EDIT_FONT_WIDTH);
u8g_uint_t lcd_chr_fit, one_chr_width;
if (labellen <= lcd_edit_width - 1) {
if (labellen + vallen + 1 > lcd_edit_width) extra_row = true;
lcd_chr_fit = lcd_edit_width + 1;
@@ -421,20 +430,17 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
ui.set_font(FONT_MENU);
}
#else
constexpr uint8_t lcd_chr_fit = LCD_WIDTH,
one_chr_width = MENU_FONT_WIDTH;
constexpr u8g_uint_t lcd_chr_fit = LCD_WIDTH,
one_chr_width = MENU_FONT_WIDTH;
#endif
// Center the label and value lines on the middle line
uint8_t baseline = extra_row ? (LCD_PIXEL_HEIGHT) / 2 - 1
: (LCD_PIXEL_HEIGHT + EDIT_FONT_ASCENT) / 2;
u8g_uint_t baseline = extra_row ? (LCD_PIXEL_HEIGHT) / 2 - 1
: (LCD_PIXEL_HEIGHT + EDIT_FONT_ASCENT) / 2;
// Assume the label is alpha-numeric (with a descender)
bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT);
if (onpage) {
lcd_moveto(0, baseline);
lcd_put_u8str_P(pstr);
}
if (onpage) lcd_put_u8str_P(0, baseline, pstr);
// If a value is included, print a colon, then print the value right-justified
if (value != nullptr) {
@@ -445,23 +451,21 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
}
if (onpage) {
lcd_moveto(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline); // Right-justified, leaving padded by spaces
lcd_put_wchar(' '); // overwrite char if value gets shorter
lcd_put_wchar(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
lcd_put_u8str(value);
}
}
}
inline void draw_boxed_string(const uint8_t x, const uint8_t y, PGM_P const pstr, const bool inv) {
const uint8_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH),
bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT);
inline void draw_boxed_string(const u8g_uint_t x, const u8g_uint_t y, PGM_P const pstr, const bool inv) {
const u8g_uint_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH),
bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT);
if (inv) {
u8g.setColorIndex(1);
u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1);
u8g.setColorIndex(0);
}
lcd_moveto(bx, by);
lcd_put_u8str_P(pstr);
lcd_put_u8str_P(bx, by, pstr);
if (inv) u8g.setColorIndex(1);
}
@@ -479,8 +483,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (mark_as_selected(row, sel)) {
if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
constexpr uint8_t maxlen = LCD_WIDTH - 1;
const uint8_t pixw = maxlen * (MENU_FONT_WIDTH);
uint8_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
const u8g_uint_t pixw = maxlen * (MENU_FONT_WIDTH);
u8g_uint_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
}
}
@@ -499,8 +503,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
// Scale the box pixels appropriately
uint8_t x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X),
y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y),
u8g_uint_t x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X),
y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y),
pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X),
pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y),
@@ -522,8 +526,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
// Display Mesh Point Locations
u8g.setColorIndex(1);
const uint8_t sx = x_offset + pixels_per_x_mesh_pnt / 2;
uint8_t y = y_offset + pixels_per_y_mesh_pnt / 2;
const u8g_uint_t sx = x_offset + pixels_per_x_mesh_pnt / 2;
u8g_uint_t y = y_offset + pixels_per_y_mesh_pnt / 2;
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt)
if (PAGE_CONTAINS(y, y))
for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt)
@@ -531,10 +535,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
// Fill in the Specified Mesh Point
uint8_t inverted_y = GRID_MAX_POINTS_Y - y_plot - 1; // The origin is typically in the lower right corner. We need to
// invert the Y to get it to plot in the right location.
const uint8_t y_plot_inv = (GRID_MAX_POINTS_Y - 1) - y_plot; // The origin is typically in the lower right corner. We need to
// invert the Y to get it to plot in the right location.
const uint8_t by = y_offset + inverted_y * pixels_per_y_mesh_pnt;
const u8g_uint_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt;
if (PAGE_CONTAINS(by, by + pixels_per_y_mesh_pnt))
u8g.drawBox(
x_offset + x_plot * pixels_per_x_mesh_pnt, by,
@@ -546,26 +550,22 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
// Show X and Y positions at top of screen
u8g.setColorIndex(1);
if (PAGE_UNDER(7)) {
lcd_moveto(5, 7);
lcd_put_u8str("X:");
lcd_put_u8str(5, 7, "X:");
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
lcd_moveto(74, 7);
lcd_put_u8str("Y:");
lcd_put_u8str(74, 7, "Y:");
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
}
// Print plot position
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
lcd_moveto(5, LCD_PIXEL_HEIGHT);
lcd_put_wchar('(');
lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '(');
u8g.print(x_plot);
lcd_put_wchar(',');
u8g.print(y_plot);
lcd_put_wchar(')');
// Show the location value
lcd_moveto(74, LCD_PIXEL_HEIGHT);
lcd_put_u8str("Z:");
lcd_put_u8str(74, LCD_PIXEL_HEIGHT, "Z:");
if (!isnan(ubl.z_values[x_plot][y_plot]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
else
@@ -0,0 +1,560 @@
/*********************
* flash_storage.cpp *
*********************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#include "../compat.h"
#if ENABLED(LULZBOT_TOUCH_UI)
#include "../ftdi_eve_lib/ftdi_eve_lib.h"
#include "media_file_reader.h"
#include "flash_storage.h"
// The following must be changed whenever the layout of the flash
// data is changed in a manner that would render the data invalid.
constexpr uint32_t flash_eeprom_version = 1;
/* SPI Flash Memory Map:
*
* The following offsets and sizes are specified in 4k erase units:
*
* Page Size Description
* 0 16 DATA STORAGE AREA
* 16 1 VERSIONING DATA
* 17 inf MEDIA STORAGE AREA
*
*/
#define DATA_STORAGE_SIZE_64K
using namespace FTDI::SPI;
using namespace FTDI::SPI::most_significant_byte_first;
bool UIFlashStorage::is_present = false;
#ifdef SPI_FLASH_SS
/************************** SPI Flash Chip Interface **************************/
void SPIFlash::wait_while_busy() {
uint8_t status;
safe_delay(1);
do {
spi_flash_select();
spi_write_8(READ_STATUS_1);
status = spi_read_8();
spi_flash_deselect();
safe_delay(1);
} while (status & 1);
}
void SPIFlash::erase_sector_4k(uint32_t addr) {
spi_flash_select();
spi_write_8(WRITE_ENABLE);
spi_flash_deselect();
spi_flash_select();
spi_write_8(ERASE_4K);
spi_write_24(addr);
spi_flash_deselect();
wait_while_busy();
}
void SPIFlash::erase_sector_64k(uint32_t addr) {
spi_flash_select();
spi_write_8(WRITE_ENABLE);
spi_flash_deselect();
spi_flash_select();
spi_write_8(ERASE_64K);
spi_write_24(addr);
spi_flash_deselect();
wait_while_busy();
}
void SPIFlash::spi_write_begin(uint32_t addr) {
spi_flash_select();
spi_write_8(WRITE_ENABLE);
spi_flash_deselect();
spi_flash_select();
spi_write_8(PAGE_PROGRAM);
spi_write_24(addr);
}
void SPIFlash::spi_write_end() {
spi_flash_deselect();
wait_while_busy();
}
void SPIFlash::spi_read_begin(uint32_t addr) {
spi_flash_select();
spi_write_8(READ_DATA);
spi_write_24(addr);
}
void SPIFlash::spi_read_end() {
spi_flash_deselect();
}
void SPIFlash::erase_chip() {
spi_flash_select();
spi_write_8(WRITE_ENABLE);
spi_flash_deselect();
spi_flash_select();
spi_write_8(ERASE_CHIP);
spi_flash_deselect();
wait_while_busy();
}
void SPIFlash::read_jedec_id(uint8_t &manufacturer_id, uint8_t &device_type, uint8_t &capacity) {
spi_flash_select();
spi_write_8(READ_JEDEC_ID);
manufacturer_id = spi_recv();
device_type = spi_recv();
capacity = spi_recv();
spi_flash_deselect ();
}
/* This function writes "size" bytes from "data" starting at addr, while properly
* taking into account the special case of writing across a 256 byte page boundary.
* Returns the addr directly after the write.
*/
uint32_t SPIFlash::write(uint32_t addr, const void *_data, size_t size) {
const uint8_t *data = (const uint8_t*) _data;
while (size) {
const uint32_t page_start = addr & 0xFFFF00ul;
const uint32_t page_end = page_start + 256;
const uint32_t write_size = min(page_end - addr, size);
spi_write_begin(addr);
spi_write_bulk<ram_write>(data, write_size);
spi_write_end();
addr += write_size;
size -= write_size;
data += write_size;
}
return addr;
}
uint32_t SPIFlash::read(uint32_t addr, void *data, size_t size) {
spi_read_begin(addr);
spi_read_bulk(data, size);
spi_read_end();
return addr + size;
}
/********************************** UTILITY ROUTINES *********************************/
bool UIFlashStorage::check_known_device() {
uint8_t manufacturer_id, device_type, capacity;
read_jedec_id(manufacturer_id, device_type, capacity);
const bool is_known =
((manufacturer_id == 0xEF) && (device_type == 0x40) && (capacity == 0x15)) || // unknown
((manufacturer_id == 0x01) && (device_type == 0x40) && (capacity == 0x15)) || // Cypress S25FL116K
((manufacturer_id == 0xEF) && (device_type == 0x14) && (capacity == 0x15)) || // Winbond W25Q16JV
((manufacturer_id == 0x1F) && (device_type == 0x86) && (capacity == 0x01)) ; // Adesto AT255F161
if (!is_known) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to locate supported SPI Flash Memory.");
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Manufacturer ID, got: ", manufacturer_id);
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Device Type , got: ", device_type);
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Capacity , got: ", capacity);
}
return is_known;
}
void UIFlashStorage::initialize() {
for(uint8_t i = 0; i < 10; i++) {
if (check_known_device()) {
is_present = true;
break;
}
safe_delay(1000);
}
}
/**************************** DATA STORAGE AREA (first 4K or 64k) ********************/
#ifdef DATA_STORAGE_SIZE_64K
constexpr uint32_t data_storage_area_size = 64 * 1024; // Large erase unit
#else
constexpr uint32_t data_storage_area_size = 4 * 1024; // Small erase unit
#endif
/* In order to provide some degree of wear leveling, each data write to the
* SPI Flash chip is appended to data that was already written before, until
* the data storage area is completely filled. New data is written preceeded
* with a 32-bit delimiter 'LULZ', so that we can distinguish written and
* unwritten data:
*
* 'LULZ' <--- 1st record delimiter
* <data_byte>
* <data_byte>
* <data_byte>
* 'LULZ' <--- 2nd record delimiter
* <data_byte>
* <data_byte>
* <data_byte>
* ...
* 'LULZ' <--- Last record delimiter
* <data_byte>
* <data_byte>
* <data_byte>
* 0xFF <--- Start of free space
* 0xFF
* ...
*
* This function walks down the data storage area, verifying that the
* delimiters are either 'LULZ' or 0xFFFFFFFF. In the case that an invalid
* delimiter is found, this function returns -1, indicating that the Flash
* data is invalid (this will happen if the block_size changed with respect
* to earlier firmware). Otherwise, it returns the offset of the last
* valid delimiter 'LULZ', indicating the most recently written data.
*/
int32_t UIFlashStorage::get_config_read_offset(uint32_t block_size) {
uint16_t stride = 4 + block_size;
int32_t read_offset = -1;
for(uint32_t offset = 0; offset < (data_storage_area_size - stride); offset += stride) {
uint32_t delim;
spi_read_begin(offset);
spi_read_bulk (&delim, sizeof(delim));
spi_read_end();
switch (delim) {
case 0xFFFFFFFFul: return read_offset;
case delimiter: read_offset = offset; break;
default:
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("Invalid delimiter in Flash: ", delim);
return -1;
}
}
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("No LULZ delimiter found.");
return -1;
}
/* This function returns the offset at which new data should be
* appended, or -1 if the Flash needs to be erased */
int32_t UIFlashStorage::get_config_write_offset(uint32_t block_size) {
int32_t read_offset = get_config_read_offset(block_size);
if (read_offset == -1) return -1; // The SPI flash is invalid
int32_t write_offset = read_offset + 4 + block_size;
if ((write_offset + 4 + block_size) > data_storage_area_size) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Not enough free space in Flash.");
return -1; // Not enough free space
}
return write_offset;
}
bool UIFlashStorage::verify_config_data(const void *data, size_t size) {
if (!is_present) return false;
int32_t read_addr = get_config_read_offset(size);
if (read_addr == -1) return false;
uint32_t delim;
spi_read_begin(read_addr);
spi_read_bulk (&delim, sizeof(delim));
bool ok = spi_verify_bulk(data,size);
spi_read_end();
return ok && delim == delimiter;
}
bool UIFlashStorage::read_config_data(void *data, size_t size) {
if (!is_present) return false;
int32_t read_addr = get_config_read_offset(size);
if (read_addr == -1) return false;
uint32_t delim;
spi_read_begin(read_addr);
spi_read_bulk (&delim, sizeof(delim));
spi_read_bulk (data, size);
spi_read_end();
return delim == delimiter;
}
void UIFlashStorage::write_config_data(const void *data, size_t size) {
if (!is_present) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("SPI Flash chip not present. Not saving UI settings.");
return;
}
// Since Flash storage has a limited number of write cycles,
// make sure that the data is different before rewriting.
if (verify_config_data(data, size)) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("UI settings already written, skipping write.");
return;
}
int16_t write_addr = get_config_write_offset(size);
if (write_addr == -1) {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Erasing UI settings from SPI Flash... ");
#ifdef DATA_STORAGE_SIZE_64K
erase_sector_64k(0);
#else
erase_sector_4k(0);
#endif
write_addr = 0;
SERIAL_ECHOLNPGM("DONE");
}
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Writing UI settings to SPI Flash (offset ", write_addr);
SERIAL_ECHOPGM(")...");
const uint32_t delim = delimiter;
write_addr = write(write_addr, &delim, sizeof(delim));
write_addr = write(write_addr, data, size);
SERIAL_ECHOLNPGM("DONE");
}
/************************** VERSIONING INFO AREA ************************/
/* The version info area follows the data storage area. If the version
* is incorrect, the data on the chip is invalid and format_flash should
* be called.
*/
typedef struct {
uint32_t magic;
uint32_t version;
} flash_version_info;
constexpr uint32_t version_info_addr = data_storage_area_size;
constexpr uint32_t version_info_size = 4 * 1024; // Small erase unit
bool UIFlashStorage::is_valid() {
flash_version_info info;
spi_read_begin(version_info_addr);
spi_read_bulk (&info, sizeof(flash_version_info));
spi_read_end();
return info.magic == delimiter && info.version == flash_eeprom_version;
}
void UIFlashStorage::write_version_info() {
flash_version_info info;
info.magic = delimiter;
info.version = flash_eeprom_version;
spi_write_begin(version_info_addr);
spi_write_bulk<ram_write>(&info, sizeof(flash_version_info));
spi_write_end();
}
/**************************** MEDIA STORAGE AREA *****************************/
/* The media storage area follows the versioning info area. It consists
* of a file index followed by the data for one or more media files.
*
* The file index consists of an array of 32-bit file sizes. If a file
* is not present, the file's size will be set to 0xFFFFFFFF
*/
constexpr uint32_t media_storage_addr = version_info_addr + version_info_size;
constexpr uint8_t media_storage_slots = 4;
void UIFlashStorage::format_flash() {
SERIAL_ECHO_START(); SERIAL_ECHOPGM("Erasing SPI Flash...");
SPIFlash::erase_chip();
SERIAL_ECHOLNPGM("DONE");
write_version_info();
}
uint32_t UIFlashStorage::get_media_file_start(uint8_t slot) {
uint32_t addr = media_storage_addr + sizeof(uint32_t) * media_storage_slots;
spi_read_begin(media_storage_addr);
for(uint8_t i = 0; i < slot; i++) {
addr += spi_read_32();
}
spi_read_end();
return addr;
}
void UIFlashStorage::set_media_file_size(uint8_t slot, uint32_t size) {
spi_write_begin(media_storage_addr + sizeof(uint32_t) * slot);
spi_write_32(size);
spi_write_end();
}
uint32_t UIFlashStorage::get_media_file_size(uint8_t slot) {
spi_read_begin(media_storage_addr + sizeof(uint32_t) * slot);
uint32_t size = spi_read_32();
spi_read_end();
return size;
}
/* Writes a media file from the SD card/USB flash drive into a slot on the SPI Flash. Media
* files must be written sequentially following by a chip erase and it is not possible to
* overwrite files. */
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str filename, uint8_t slot) {
#if ENABLED(SDSUPPORT)
uint32_t addr;
uint8_t buff[write_page_size];
strcpy_P( (char*) buff, (const char*) filename);
MediaFileReader reader;
if (!reader.open((char*) buff)) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to find media file");
return FILE_NOT_FOUND;
}
if (get_media_file_size(slot) != 0xFFFFFFFFUL) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Media file already exists");
return WOULD_OVERWRITE;
}
SERIAL_ECHO_START(); SERIAL_ECHOPGM("Writing SPI Flash...");
set_media_file_size(slot, reader.size());
addr = get_media_file_start(slot);
// Write out the file itself
for(;;) {
const int16_t nBytes = reader.read(buff, write_page_size);
if (nBytes == -1) {
SERIAL_ECHOLNPGM("Failed to read from file");
return READ_ERROR;
}
addr = write(addr, buff, nBytes);
if (nBytes != write_page_size)
break;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::yield();
#endif
}
SERIAL_ECHOLNPGM("DONE");
SERIAL_ECHO_START(); SERIAL_ECHOPGM("Verifying SPI Flash...");
bool verifyOk = true;
// Verify the file index
if (get_media_file_start(slot+1) != (get_media_file_start(slot) + reader.size())) {
SERIAL_ECHOLNPGM("File index verification failed. ");
verifyOk = false;
}
// Verify the file itself
addr = get_media_file_start(slot);
reader.rewind();
while (verifyOk) {
const int16_t nBytes = reader.read(buff, write_page_size);
if (nBytes == -1) {
SERIAL_ECHOPGM("Failed to read from file");
verifyOk = false;
break;
}
spi_read_begin(addr);
if (!spi_verify_bulk(buff, nBytes)) {
verifyOk = false;
spi_read_end();
break;
}
spi_read_end();
addr += nBytes;
if (nBytes != write_page_size) break;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::yield();
#endif
};
if (verifyOk) {
SERIAL_ECHOLNPGM("DONE");
return SUCCESS;
} else {
SERIAL_ECHOLNPGM("FAIL");
return VERIFY_ERROR;
}
#else
return VERIFY_ERROR;
#endif // ENABLED(SDSUPPORT)
}
bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t slot) {
if (!is_present) return false;
bytes_remaining = get_media_file_size(slot);
if (bytes_remaining != 0xFFFFFFFFUL) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("Boot media file size:", bytes_remaining);
addr = get_media_file_start(slot);
return true;
} else {
return false;
}
}
int16_t UIFlashStorage::BootMediaReader::read(void *data, const size_t size) {
if (bytes_remaining == 0xFFFFFFFFUL) return -1;
if (size > bytes_remaining)
return read(data, bytes_remaining);
if (size > 0) {
spi_read_begin(addr);
spi_read_bulk(data, size);
spi_read_end();
addr += size;
bytes_remaining -= size;
}
return size;
}
int16_t UIFlashStorage::BootMediaReader::read(void *obj, void *data, const size_t size) {
return reinterpret_cast<UIFlashStorage::BootMediaReader*>(obj)->read(data, size);
}
#else
void UIFlashStorage::initialize() {}
bool UIFlashStorage::is_valid() {return true;}
void UIFlashStorage::write_config_data(const void *, size_t) {}
bool UIFlashStorage::verify_config_data(const void *, size_t) {return false;}
bool UIFlashStorage::read_config_data(void *, size_t ) {return false;}
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str, uint8_t) {return FILE_NOT_FOUND;}
void UIFlashStorage::format_flash() {}
bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;}
int16_t UIFlashStorage::BootMediaReader::read(void *, const size_t) {return -1;}
int16_t UIFlashStorage::BootMediaReader::read(void *, void *, const size_t) {return -1;}
#endif // SPI_FLASH_SS
#endif // LULZBOT_TOUCH_UI
@@ -0,0 +1,106 @@
/*******************
* flash_storage.h *
*******************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
class SPIFlash {
public:
static constexpr uint32_t erase_unit_size = 4 * 1024; // Minimum erase unit
static constexpr uint32_t write_page_size = 256; // Minimum page write unit
enum {
READ_STATUS_1 = 0x05,
READ_STATUS_2 = 0x35,
READ_STATUS_3 = 0x33,
WRITE_ENABLE = 0x06,
WRITE_DISABLE = 0x04,
READ_ID = 0x90,
READ_JEDEC_ID = 0x9F,
READ_DATA = 0x03,
PAGE_PROGRAM = 0x02,
ERASE_4K = 0x20,
ERASE_64K = 0xD8,
ERASE_CHIP = 0xC7
};
static void wait_while_busy();
static void erase_sector_4k(uint32_t addr);
static void erase_sector_64k(uint32_t addr);
static void erase_chip ();
static void read_jedec_id(uint8_t &manufacturer_id, uint8_t &device_type, uint8_t &capacity);
static void spi_read_begin(uint32_t addr);
static void spi_read_end();
static void spi_write_begin(uint32_t addr);
static void spi_write_end();
static uint32_t write(uint32_t addr, const void *data, size_t size);
static uint32_t read(uint32_t addr, void *data, size_t size);
};
class UIFlashStorage : private SPIFlash {
private:
static bool is_present;
static int32_t get_config_read_offset(uint32_t block_size);
static int32_t get_config_write_offset(uint32_t block_size);
static uint32_t get_media_file_start(uint8_t slot);
static void set_media_file_size(uint8_t slot, uint32_t size);
static uint32_t get_media_file_size(uint8_t slot);
static constexpr uint32_t delimiter = 0x4C554C5A; // 'LULZ'
public:
enum error_t {
SUCCESS,
FILE_NOT_FOUND,
READ_ERROR,
VERIFY_ERROR,
WOULD_OVERWRITE
};
static void initialize ();
static void format_flash ();
static bool check_known_device();
static bool is_valid ();
static void write_version_info();
static void write_config_data (const void *data, size_t size);
static bool verify_config_data (const void *data, size_t size);
static bool read_config_data (void *data, size_t size);
static error_t write_media_file (progmem_str filename, uint8_t slot = 0);
class BootMediaReader;
};
class UIFlashStorage::BootMediaReader {
private:
uint32_t addr;
uint32_t bytes_remaining;
public:
bool isAvailable(uint32_t slot = 0);
int16_t read(void *buffer, size_t const size);
static int16_t read(void *obj, void *buffer, const size_t size);
};
@@ -0,0 +1,63 @@
/************************
* media_filereader.cpp *
************************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#include "../compat.h"
#if ENABLED(LULZBOT_TOUCH_UI)
#include "media_file_reader.h"
#if ENABLED(SDSUPPORT)
bool MediaFileReader::open(const char* filename) {
card.init(SPI_SPEED, SDSS);
volume.init(&card);
root.openRoot(&volume);
return file.open(&root, filename, O_READ);
}
int16_t MediaFileReader::read(void *buff, size_t bytes) {
return file.read(buff, bytes);
}
void MediaFileReader::close() {
file.close();
}
uint32_t MediaFileReader::size() {
return file.fileSize();
}
void MediaFileReader::rewind() {
file.rewind();
}
int16_t MediaFileReader::read(void *obj, void *buff, size_t bytes) {
return reinterpret_cast<MediaFileReader*>(obj)->read(buff, bytes);
}
#else
bool MediaFileReader::open(const char*) {return -1;}
int16_t MediaFileReader::read(void *, size_t) {return 0;}
void MediaFileReader::close() {}
uint32_t MediaFileReader::size() {return 0;}
void MediaFileReader::rewind() {}
int16_t MediaFileReader::read(void *, void *, size_t) {return 0;}
#endif
#endif // LULZBOT_TOUCH_UI
@@ -0,0 +1,48 @@
/**********************
* media_filereader.h *
**********************/
/****************************************************************************
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
#include "../../../../../inc/MarlinConfigPre.h"
#if ENABLED(SDSUPPORT)
#include "../../../../../sd/SdFile.h"
#include "../../../../../sd/cardreader.h"
#endif
class MediaFileReader {
private:
#if ENABLED(SDSUPPORT)
Sd2Card card;
SdVolume volume;
SdFile root, file;
#endif
public:
bool open(const char* filename);
int16_t read(void *buff, size_t bytes);
uint32_t size();
void rewind();
void close();
static int16_t read(void *obj, void *buff, size_t bytes);
};
@@ -0,0 +1,53 @@
/************
* compat.h *
************/
/****************************************************************************
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
/**
* This following provides compatibility whether compiling
* as a part of Marlin or outside it
*/
#ifdef __has_include
#if __has_include("../../ui_api.h")
#include "../../ui_api.h"
#endif
#else
#include "../../ui_api.h"
#endif
#ifdef __MARLIN_FIRMWARE__
// __MARLIN_FIRMWARE__ exists when compiled within Marlin.
#include "pin_mappings.h"
#else
// Messages that are declared in Marlin
#define WELCOME_MSG "Printer Ready"
#define MSG_MEDIA_INSERTED "Media Inserted"
#define MSG_MEDIA_REMOVED "Media Removed"
namespace UI {
static inline uint32_t safe_millis() {return millis();};
static inline void yield() {};
};
#endif
class __FlashStringHelper;
typedef const __FlashStringHelper *progmem_str;
@@ -0,0 +1,97 @@
/************
* config.h *
************/
/****************************************************************************
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* To view a copy of the GNU General Public License, go to the following *
* location: <http://www.gnu.org/licenses/>. *
****************************************************************************/
#pragma once
#include "compat.h"
// Define the display board used (see "ftdi_eve_boards.h" for definitions)
//#define LCD_FTDI_VM800B35A // FTDI 3.5" 320x240 with FT800
//#define LCD_4DSYSTEMS_4DLCD_FT843 // 4D Systems 4.3" 480x272
//#define LCD_HAOYU_FT800CB // Haoyu with 4.3" or 5" 480x272
//#define LCD_HAOYU_FT810CB // Haoyu with 5" 800x480
//#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD User Interface
// Leave the following commented out to use a board's default resolution.
// If you have changed the LCD panel, you may override the resolution
// below (see "ftdi_eve_resolutions.h" for definitions):
//#define TOUCH_UI_320x240
//#define TOUCH_UI_480x272
//#define TOUCH_UI_800x480
// Define the printer interface or pins used (see "ui_pin_mappings.h" for definitions):
//#define CR10_TFT_PINMAP
//#define AO_EXP1_DEPRECATED_PINMAP // UltraLCD EXP1 connector, old AlephObject's wiring
//#define AO_EXP1_PINMAP // UltraLCD EXP1 connector, new AlephObject's wiring
//#define AO_EXP2_PINMAP // UltraLCD EXP2 connector, new AlephObject's wiring
//#define OTHER_PIN_LAYOUT
// Otherwise. Define all the pins manually:
#ifdef OTHER_PIN_LAYOUT
// Select interfacing pins, the following pin specifiers are supported:
//
// ARDUINO_DIGITAL_1 - Arduino pin via digitalWrite/digitalRead
// AVR_A1 - Fast AVR port access via PORTA/PINA/DDRA
// 1 - When compiling Marlin, use Marlin pin IDs.
// The pins for CS and MOD_RESET (PD) must be chosen.
#define CLCD_MOD_RESET 9
#define CLCD_SPI_CS 10
// If using software SPI, specify pins for SCLK, MOSI, MISO
//#define CLCD_USE_SOFT_SPI
#ifdef CLCD_USE_SOFT_SPI
#define CLCD_SOFT_SPI_MOSI 11
#define CLCD_SOFT_SPI_MISO 12
#define CLCD_SOFT_SPI_SCLK 13
#endif
#endif
// Defines how to orient the display. An inverted (i.e. upside-down) display
// is supported on the FT800. The FT810 or better also support a portrait
// and mirrored orientation.
//#define TOUCH_UI_INVERTED
//#define TOUCH_UI_PORTRAIT
//#define TOUCH_UI_MIRRORED
// Use a numeric passcode for "Parental lock".
// This is a recommended for smaller displays.
//#define TOUCH_UI_PASSCODE
// The timeout (in ms) to return to the status screen from sub-menus
//#define LCD_TIMEOUT_TO_STATUS 15000
// Enable this to debug the event framework
//#define UI_FRAMEWORK_DEBUG
// Enable the developer's menu and screens
//#define DEVELOPER_SCREENS
// Maximum feed rate for manual extrusion (mm/s)
//#define MAX_MANUAL_FEEDRATE 240
// Sets the SPI speed in Hz
#define SPI_FREQUENCY 8000000 >> SPI_SPEED
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,28 @@
FTDI EVE Library
----------------
The FTDI EVE Library is a fully open-source library and UI framework for the FTDI
FT800 and FT810 graphics processor.
Although the library has been developed within Lulzbot for providing a user interface
for Marlin, the library has been written so that it can be used in any Arduino sketch.
The library is split into two parts. The "basic" API provides a shallow interface to
the underlying FTDI hardware and command FIFO and provides low-level access to the
hardware as closely as possible to the API described in the FTDI Programmer's Guide.
The "extended" API builds on top of the "basic" API to provide a GUI framework for
handling common challenges in building a usable GUI. The GUI framework provides the
following features:
- Macros for a resolution-independent placement of widgets based on a grid.
- Class-based UI screens, with press and unpress touch events, as well as touch repeat.
- Event loop with button debouncing and button push visual and auditory feedback.
- Easy screen-to-screen navigation including a navigation stack for going backwards.
- Visual feedback for disabled vs enabled buttons, and custom button styles.
- A sound player class for playing individual notes or complete sound sequences.
- Display list caching, for storing static background elements of a screen in RAM_G.
See the "examples" folder for Arduino sketches. Modify the "src/config.h" file in
each to suit your particular setup. The "sample_configs" contain sample configuration
files for running the sketches on our 3D printer boards.

Some files were not shown because too many files have changed in this diff Show More