Commit 15b81c00 authored by MagoKimbra's avatar MagoKimbra

Update 4.2.5

parent 85ada325
......@@ -30,7 +30,7 @@
// Enable the Bluetooth serial interface
//#define BLUETOOTH
#define BLUETOOTH_SERIAL 1
#define BLUETOOTH_PORT 1
#define BLUETOOTH_BAUD 115200
// User-specified version info of this build to display in [Pronterface, etc] terminal window during
......
......@@ -49,6 +49,7 @@
* - Filament diameter sensor
* - Filament Runout sensor
* - Power consumption sensor
* - RFID card sensor
* ADDON FEATURES:
* - EEPROM
* - SDCARD
......@@ -322,7 +323,7 @@
// Extruder cooling fans
// Configure fan pin outputs to automatically turn on/off when the associated
// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
// extruder temperature is above/below EXTRUDER AUTO FAN TEMPERATURE.
// Multiple extruders can be assigned to the same pin in which case
// the fan will turn on when any selected extruder is above the threshold.
// You need to set _AUTO_FAN_PIN in Configuration_pins.h
......@@ -1150,9 +1151,9 @@
// http://reprap.org/wiki/Mini_panel
//#define MINIPANEL
// Nextion HMI panel
// REMEMBER TO INSTALL Nextion library in your ARDUINO library folder. You can find it in Arduino/libraries/
// Nextion HMI panel Serial
//#define NEXTION
#define NEXTION_PORT 1
// For GFX Visualization enable Nextion GFX
//#define NEXTION_GFX
......
/**
* Configuration_Overall.h
* Here you can define all your custom settings and they will overwrite configurations in the main configuration files.
* Decomment or comment CONFIGURATION OVERALL ON for active or deactive this file.
*/
//#define CONFIGURATION_OVERALL_ON
......@@ -133,7 +133,7 @@
#endif
#if ENABLED(Z_PROBE_ENDSTOP)
#define Z_PROBE_PIN -1
#define Z_PROBE_PIN ORIG_Z_MIN_PIN
#endif
//============================================================================
......
......@@ -410,7 +410,7 @@ void Config_RetrieveSettings() {
updatePID();
// Report settings retrieved and length
ECHO_ST(DB, ver);
ECHO_SV(DB, ver);
ECHO_MV(" stored settings retrieved (", (unsigned long)i);
ECHO_EM(" bytes)");
}
......
......@@ -22,7 +22,9 @@ FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_Prin
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
#define CFG_SD_MAX_KEY_LEN 3+1 // icrease this if you add key name longer than the actual value.
#define CFG_SD_MAX_VALUE_LEN 30+1 // this should be enought for int, long and float if you need to retrive strings increase this carefully
#define CFG_SD_MAX_VALUE_LEN 10+1 // this should be enought for int, long and float if you need to retrive strings increase this carefully
//(11 = strlen("4294967295")+1) (4294967295 = (2^32)-1) (32 = the num of bits of the bigger basic data scructor used)
//If yuou need to save string increase this to strlen("YOUR LONGER STRING")+1
void ConfigSD_StoreSettings();
void ConfigSD_RetrieveSettings(bool addValue = false);
int ConfigSD_KeyIndex(char *key);
......
......@@ -2,7 +2,7 @@
* MK Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2013 MK
* Copyright (C) 2013 MagoKimbra
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
......
......@@ -11,13 +11,16 @@
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#define ENABLED defined
#define DISABLED !defined
#include "Boards.h"
#include "module/mechanics.h"
#include "Configuration_Version.h"
#include "Configuration_Overall.h"
#ifndef CONFIGURATION_OVERALL_ON
#if DISABLED(CONFIGURATION_OVERALL_ON)
#include "Configuration_Basic.h"
#if MECH(CARTESIAN)
......
......@@ -54,8 +54,6 @@
#define COS_60 0.5
// Macros to support option testing
#define ENABLED defined
#define DISABLED !defined
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define HAS(FE) (HAS_##FE)
#define HASNT(FE) (!(HAS_##FE))
......
......@@ -2805,7 +2805,7 @@ void gcode_get_destination() {
}
void unknown_command_error() {
ECHO_LMT(ER, SERIAL_UNKNOWN_COMMAND, current_command);
ECHO_LMV(ER, SERIAL_UNKNOWN_COMMAND, current_command);
}
/**
......@@ -5388,6 +5388,7 @@ inline void gcode_M140() {
*
* T<extruder> - Optional extruder number. Current extruder if omitted.
* D<mm> - Diameter of the filament. Use "D0" to set units back to millimetres.
* S<0/1> - Deactivate o Activate volumetric
*/
inline void gcode_M200() {
......@@ -5399,17 +5400,25 @@ inline void gcode_M200() {
// slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders
volumetric_enabled = (diameter != 0.0);
if (volumetric_enabled) {
filament_size[target_extruder] = diameter;
}
if (code_seen('S')) {
if (code_value())
volumetric_enabled = true;
else
volumetric_enabled = false;
}
if (volumetric_enabled) {
ECHO_LM(INFO, "Volumetric Enabled");
// make sure all extruders have some sane value for the filament size
for (int i = 0; i < EXTRUDERS; i++)
if (!filament_size[i]) filament_size[i] = DEFAULT_NOMINAL_FILAMENT_DIA;
}
}
else {
//reserved for setting filament diameter via UFID or filament measuring device
return;
}
else
ECHO_LM(INFO, "Volumetric Disabled");
calculate_volumetric_multipliers();
}
......@@ -8231,7 +8240,7 @@ bool setTargetedExtruder(int code) {
float calculate_volumetric_multiplier(float diameter) {
if (!volumetric_enabled || diameter == 0) return 1.0;
float d2 = diameter * 0.5;
return 100.0 / (M_PI * d2 * d2);
return 1.0 / (M_PI * d2 * d2);
}
void calculate_volumetric_multipliers() {
......
......@@ -13,7 +13,7 @@ static char serial_answer;
void FirmwareTest() {
ECHO_EM("---------- FIRMWARE TEST --------------");
ECHO_EM("--------- by MarlinKimbra -------------");
ECHO_EM("--------------- MK --------------------");
ECHO_EV(MSG_FWTEST_01);
ECHO_EV(MSG_FWTEST_02);
ECHO_EV(MSG_FWTEST_YES_NO);
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Establir zero"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Prec."
#define MSG_CONGIG "conf."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Изходна точка"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Подгр."
#define MSG_CONGIG "Настр."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Establir origen"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preesc."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "\xbe\xbf\xbc\xbd"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "\xc3\xc4"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " \xc5\xc6"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Set origin"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Forvarm"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " Alle"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Setze Null hier"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Vorwärmen"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Set origin"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Establecer cero"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Precalentar"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Hasiera ipini"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Berotu"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " Guztia"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Aseta origo"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Regler origine"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Prech."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " Tout"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Imposta Origine"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.za:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preriscalda"
#define MSG_PREHEAT_PLA "Preriscalda PLA"
#define MSG_PREHEAT_PLA_ALL "Prer. PLA Tutto"
......
......@@ -35,6 +35,7 @@
#define MSG_SET_ORIGIN "\xb7\xbc\xde\xad\xdd\xbe\xaf\xc4" // "Set origin"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA "PLA \xd6\xc8\xc2"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " \xbd\xcd\xde\xc3" // " All"
......
......@@ -38,6 +38,7 @@
#define MSG_SET_ORIGIN "キヅユンセツト" // "Set origin"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA "PLA ヨネシ" // "Preheat PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " スベテ" // " All"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Nulpunt instellen"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA "PLA voorverwarmen"
#define MSG_PREHEAT_PLA_ALL "PLA voorverw. aan"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Ustaw punkt zero"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Preheat"
#define MSG_PREHEAT_PLA "Rozgrzej PLA"
#define MSG_PREHEAT_PLA_ALL "Roz. PLA Wszystko"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Estabelecer orig."
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Pre-aq."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " Tudo"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Estabelecer orig."
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Pre-aq."
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " Tudo"
......
......@@ -33,6 +33,7 @@
#define MSG_SET_ORIGIN "Запомнить ноль"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_FILCONSUMED "F:"
#define MSG_PREHEAT "Преднаг"
#define MSG_PREHEAT_PLA MSG_PREHEAT " PLA"
#define MSG_PREHEAT_PLA_ALL MSG_PREHEAT_PLA " все"
......
......@@ -1132,6 +1132,13 @@ static void lcd_stats_menu() {
sprintf_P(row, PSTR(MSG_PWRCONSUMED " %iWh"), power_consumption_hour);
LCD_Printpos(0, 1); lcd_print(row);
#endif
char lung[30];
unsigned int kmeter = (long)printer_usage_filament / 1000 / 1000,
meter = ((long)printer_usage_filament / 1000) % 1000,
centimeter = ((long)printer_usage_filament / 10) % 100,
millimeter = ((long)printer_usage_filament) % 10;
sprintf_P(lung, PSTR(MSG_FILCONSUMED "%i Km %i m %i cm %i mm"), kmeter, meter, centimeter, millimeter);
LCD_Printpos(0, 2); lcd_print(lung);
if (LCD_CLICKED) lcd_goto_menu(lcd_main_menu);
}
......
/**
* @file NexButton.cpp
*
* The implementation of class NexButton.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexButton.h"
NexButton::NexButton(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint16_t NexButton::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexButton::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexButton.h
*
* The definition of class NexButton.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXBUTTON_H__
#define __NEXBUTTON_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexButton component.
*
* Commonly, you want to do something after push and pop it. It is recommanded that only
* call @ref NexTouch::attachPop to satisfy your purpose.
*
* @warning Please do not call @ref NexTouch::attachPush on this component, even though you can.
*/
class NexButton: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexButton(uint8_t pid, uint8_t cid, const char *name);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint16_t getText(char *buffer, uint16_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
};
/**
* @}
*/
#endif /* #ifndef __NEXBUTTON_H__ */
/**
* @file NexConfig.h
*
* Options for user can be found here.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "../../base.h"
#ifndef __NEXCONFIG_H__
#define __NEXCONFIG_H__
#if NEXTION_SERIAL > 0
#if NEXTION_SERIAL == 1
#define nexSerial Serial1
#elif NEXTION_SERIAL == 2
#define nexSerial Serial2
#elif NEXTION_SERIAL == 3
#define nexSerial Serial3
#endif
#else
#define nexSerial Serial1
#endif
#define dbSerialPrint(a) {}
#define dbSerialPrintln(a) {}
#define dbSerialBegin(a) {}
#endif //__NEXCONFIG_H__
/**
* @file NexCrop.cpp
*
* The implementation of class NexCrop.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexCrop.h"
NexCrop::NexCrop(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexCrop::getPic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".picc";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexCrop::setPic(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".picc=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexCrop.h
*
* The definition of class NexCrop.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXCROP_H__
#define __NEXCROP_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexCrop component.
*/
class NexCrop: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexCrop(uint8_t pid, uint8_t cid, const char *name);
/**
* Get the number of picture.
*
* @param number - an output parameter to save the number of picture.
*
* @retval true - success.
* @retval false - failed.
*/
bool getPic(uint32_t *number);
/**
* Set the number of picture.
*
* @param number - the number of picture.
*
* @retval true - success.
* @retval false - failed.
*/
bool setPic(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXCROP_H__ */
/**
* @file NexDualStateButton.cpp
*
* The implementation of class NexDSButton.
*
* @author huang xianming (email:<xianming.huang@itead.cc>)
* @date 2015/11/11
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexDualStateButton.h"
NexDSButton::NexDSButton(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexDSButton::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexDSButton::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexDualStateButton.h
*
* The definition of class NexDSButton.
*
* @author huang xianming (email:<xianming.huang@itead.cc>)
* @date 2015/11/11
*
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXDSBUTTON_H__
#define __NEXDSBUTTON_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexDSButton component.
*
* Commonly, you want to do something after push and pop it. It is recommanded that only
* call @ref NexTouch::attachPop to satisfy your purpose.
*
* @warning Please do not call @ref NexTouch::attachPush on this component, even though you can.
*/
class NexDSButton: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexDSButton(uint8_t pid, uint8_t cid, const char *name);
/**
* Get number attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
bool getValue(uint32_t *number);
/**
* Set number attribute of component.
*
* @param buffer - number buffer.
* @return true if success, false for failure.
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXDSBUTTON_H__ */
/**
* @file NexGauge.cpp
*
* The implementation of class NexGauge.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexGauge.h"
NexGauge::NexGauge(uint8_t pid, uint8_t cid, const char *name)
:NexObject(pid, cid, name)
{
}
bool NexGauge::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexGauge::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexGauge.h
*
* The definition of class NexGauge.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXGAUGE_H__
#define __NEXGAUGE_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexGauge component.
*/
class NexGauge: public NexObject
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexGauge(uint8_t pid, uint8_t cid, const char *name);
/**
* Get the value of gauge.
*
* @param number - an output parameter to save gauge's value.
*
* @retval true - success.
* @retval false - failed.
*/
bool getValue(uint32_t *number);
/**
* Set the value of gauge.
*
* @param number - the value of gauge.
*
* @retval true - success.
* @retval false - failed.
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXGAUGE_H__ */
/**
* @file NexHardware.cpp
*
* The implementation of base API for using Nextion.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/11
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexHardware.h"
#define NEX_RET_CMD_FINISHED (0x01)
#define NEX_RET_EVENT_LAUNCHED (0x88)
#define NEX_RET_EVENT_UPGRADED (0x89)
#define NEX_RET_EVENT_TOUCH_HEAD (0x65)
#define NEX_RET_EVENT_POSITION_HEAD (0x67)
#define NEX_RET_EVENT_SLEEP_POSITION_HEAD (0x68)
#define NEX_RET_CURRENT_PAGE_ID_HEAD (0x66)
#define NEX_RET_STRING_HEAD (0x70)
#define NEX_RET_NUMBER_HEAD (0x71)
#define NEX_RET_VALUE_HEAD (0x72)
#define NEX_RET_INVALID_CMD (0x00)
#define NEX_RET_INVALID_COMPONENT_ID (0x02)
#define NEX_RET_INVALID_PAGE_ID (0x03)
#define NEX_RET_INVALID_PICTURE_ID (0x04)
#define NEX_RET_INVALID_FONT_ID (0x05)
#define NEX_RET_INVALID_BAUD (0x11)
#define NEX_RET_INVALID_VARIABLE (0x1A)
#define NEX_RET_INVALID_OPERATION (0x1B)
/*
* Receive uint32_t data.
*
* @param number - save uint32_t data.
* @param timeout - set timeout time.
*
* @retval true - success.
* @retval false - failed.
*
*/
bool recvRetNumber(uint32_t *number, uint32_t timeout)
{
bool ret = false;
uint8_t temp[8] = {0};
if (!number)
{
goto __return;
}
nexSerial.setTimeout(timeout);
if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
{
goto __return;
}
if (temp[0] == NEX_RET_NUMBER_HEAD
&& temp[5] == 0xFF
&& temp[6] == 0xFF
&& temp[7] == 0xFF
)
{
*number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);
ret = true;
}
__return:
if (ret)
{
dbSerialPrint("recvRetNumber :");
dbSerialPrintln(*number);
}
else
{
dbSerialPrintln("recvRetNumber err");
}
return ret;
}
/*
* Receive string data.
*
* @param buffer - save string data.
* @param len - string buffer length.
* @param timeout - set timeout time.
*
* @return the length of string buffer.
*
*/
uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout)
{
uint16_t ret = 0;
bool str_start_flag = false;
uint8_t cnt_0xff = 0;
String temp = String("");
uint8_t c = 0;
long start;
if (!buffer || len == 0)
{
goto __return;
}
start = millis();
while (millis() - start <= timeout)
{
while (nexSerial.available())
{
c = nexSerial.read();
if (str_start_flag)
{
if (0xFF == c)
{
cnt_0xff++;
if (cnt_0xff >= 3)
{
break;
}
}
else
{
temp += (char)c;
}
}
else if (NEX_RET_STRING_HEAD == c)
{
str_start_flag = true;
}
}
if (cnt_0xff >= 3)
{
break;
}
}
ret = temp.length();
ret = ret > len ? len : ret;
strncpy(buffer, temp.c_str(), ret);
__return:
dbSerialPrint("recvRetString[");
dbSerialPrint(temp.length());
dbSerialPrint(",");
dbSerialPrint(temp);
dbSerialPrintln("]");
return ret;
}
/*
* Send command to Nextion.
*
* @param cmd - the string of command.
*/
void sendCommand(const char* cmd)
{
while (nexSerial.available())
{
nexSerial.read();
}
nexSerial.print(cmd);
nexSerial.write(0xFF);
nexSerial.write(0xFF);
nexSerial.write(0xFF);
}
/*
* Command is executed successfully.
*
* @param timeout - set timeout time.
*
* @retval true - success.
* @retval false - failed.
*
*/
bool recvRetCommandFinished(uint32_t timeout)
{
bool ret = false;
uint8_t temp[4] = {0};
nexSerial.setTimeout(timeout);
if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
{
ret = false;
}
if (temp[0] == NEX_RET_CMD_FINISHED
&& temp[1] == 0xFF
&& temp[2] == 0xFF
&& temp[3] == 0xFF
)
{
ret = true;
}
if (ret)
{
dbSerialPrintln("recvRetCommandFinished ok");
}
else
{
dbSerialPrintln("recvRetCommandFinished err");
}
return ret;
}
bool nexInit(void)
{
bool ret1 = false;
bool ret2 = false;
// Try default baudrate
dbSerialBegin(9600);
nexSerial.begin(9600);
sendCommand("");
sendCommand("bkcmd=1");
ret1 = recvRetCommandFinished();
sendCommand("page 0");
ret2 = recvRetCommandFinished();
// If baudrate is 9600 set to 57600 and reconnect
if (ret1 && ret2) {
sendCommand("baud=57600");
nexSerial.end();
delay(1000);
nexSerial.begin(57600);
return ret1 && ret2;
// Else try to 57600 baudrate
} else {
nexSerial.end();
delay(1000);
nexSerial.begin(57600);
sendCommand("");
sendCommand("bkcmd=1");
ret1 = recvRetCommandFinished();
sendCommand("page 0");
ret2 = recvRetCommandFinished();
return ret1 && ret2;
}
}
void nexLoop(NexTouch *nex_listen_list[])
{
static uint8_t __buffer[20];
uint16_t i;
uint8_t c;
while (nexSerial.available() > 0)
{
delay(10);
c = nexSerial.read();
if (NEX_RET_EVENT_TOUCH_HEAD == c)
{
if (nexSerial.available() >= 6)
{
__buffer[0] = c;
for (i = 1; i < 7; i++)
{
__buffer[i] = nexSerial.read();
}
__buffer[i] = 0x00;
if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6])
{
NexTouch::iterate(nex_listen_list, __buffer[1], __buffer[2], (int32_t)__buffer[3]);
}
}
}
}
}
/**
* Return current page id.
*
* @param pageId - output parameter,to save page id.
*
* @retval true - success.
* @retval false - failed.
*/
bool sendCurrentPageId(uint8_t* pageId)
{
bool ret = false;
uint8_t temp[5] = {0};
if (!pageId)
{
goto __return;
}
sendCommand("sendme");
delay(50);
nexSerial.setTimeout(100);
if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
{
goto __return;
}
if (temp[0] == NEX_RET_CURRENT_PAGE_ID_HEAD
&& temp[2] == 0xFF
&& temp[3] == 0xFF
&& temp[4] == 0xFF
)
{
*pageId = temp[1];
ret = true;
}
__return:
if (ret)
{
dbSerialPrint("recvPageId :");
dbSerialPrintln(*pageId);
}
else
{
dbSerialPrintln("recvPageId err");
}
return ret;
}
/**
* Set current backlight brightness value.
*
* @param dimValue - current backlight brightness value.
*
* @retval true - success.
* @retval false - failed.
*/
bool setCurrentBrightness(uint8_t dimValue)
{
bool ret = false;
char buf[10] = {0};
String cmd;
utoa(dimValue, buf, 10);
cmd += "dim=";
cmd += buf;
sendCommand(cmd.c_str());
delay(10);
if(recvRetCommandFinished())
{
dbSerialPrint("setCurrentBrightness[ ");
dbSerialPrint(dimValue);
dbSerialPrintln("]ok ");
ret = true;
}
else
{
dbSerialPrintln("setCurrentBrightness err ");
}
return ret;
}
/**
* Set default baudrate.
*
* @param defaultBaudrate - default baudrate,it supports 2400,4800,9600,19200,38400,57600,115200.
*
* @retval true - success.
* @retval false - failed.
*/
bool setDefaultBaudrate(uint32_t defaultBaudrate)
{
bool ret = false;
char buf[10] = {0};
String cmd;
utoa(defaultBaudrate, buf, 10);
cmd += "bauds=";
cmd += buf;
sendCommand(cmd.c_str());
delay(10);
if(recvRetCommandFinished())
{
dbSerialPrintln("setDefaultBaudrate ok ");
ret = true;
}
else
{
dbSerialPrintln("setDefaultBaudrate err ");
}
return ret;
}
void sendRefreshAll(void)
{
sendCommand("ref 0");
}
\ No newline at end of file
/**
* @file NexHardware.h
*
* The definition of base API for using Nextion.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/11
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXHARDWARE_H__
#define __NEXHARDWARE_H__
#include <Arduino.h>
#include "NexConfig.h"
#include "NexTouch.h"
/**
* @addtogroup CoreAPI
* @{
*/
/**
* Init Nextion.
*
* @return true if success, false for failure.
*/
bool nexInit(void);
/**
* Listen touch event and calling callbacks attached before.
*
* Supports push and pop at present.
*
* @param nex_listen_list - index to Nextion Components list.
* @return none.
*
* @warning This function must be called repeatedly to response touch events
* from Nextion touch panel. Actually, you should place it in your loop function.
*/
void nexLoop(NexTouch *nex_listen_list[]);
/**
* @}
*/
bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 100);
void sendCommand(const char* cmd);
bool recvRetCommandFinished(uint32_t timeout = 100);
bool sendCurrentPageId(uint8_t* pageId);
bool setCurrentBrightness(uint8_t dimValue);
bool setDefaultBaudrate(uint32_t baudrate);
void sendRefreshAll(void);
#endif /* #ifndef __NEXHARDWARE_H__ */
/**
* @file NexHotspot.cpp
*
* The implementation of class NexHotspot.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexHotspot.h"
NexHotspot::NexHotspot(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
/**
* @file NexHotspot.h
*
* The definition of class NexHotspot.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXHOTSPOT_H__
#define __NEXHOTSPOT_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexHotspot component.
*/
class NexHotspot: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexHotspot(uint8_t pid, uint8_t cid, const char *name);
};
/**
* @}
*/
#endif /* #ifndef __NEXHOTSPOT_H__ */
/**
* @file NexNumber.cpp
*
* The implementation of class NexNumber.
*
* @author huang xianming (email:<xianming.huang@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexNumber.h"
NexNumber::NexNumber(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexNumber::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexNumber::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexNumber.h
*
* The definition of class NexNumber.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXNUMBER_H__
#define __NEXNUMBER_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexNumber component.
*/
class NexNumber: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexNumber(uint8_t pid, uint8_t cid, const char *name);
/**
* Get number attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
bool getValue(uint32_t *number);
/**
* Set number attribute of component.
*
* @param buffer - number buffer.
* @return true if success, false for failure.
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXNUMBER_H__ */
/**
* @file NexObject.cpp
*
* The implementation of class NexObject.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexObject.h"
NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name)
{
this->__pid = pid;
this->__cid = cid;
this->__name = name;
}
uint8_t NexObject::getObjPid(void)
{
return __pid;
}
uint8_t NexObject::getObjCid(void)
{
return __cid;
}
const char* NexObject::getObjName(void)
{
return __name;
}
void NexObject::printObjInfo(void)
{
dbSerialPrint("[");
dbSerialPrint((uint32_t)this);
dbSerialPrint(":");
dbSerialPrint(__pid);
dbSerialPrint(",");
dbSerialPrint(__cid);
dbSerialPrint(",");
if (__name)
{
dbSerialPrint(__name);
}
else
{
dbSerialPrint("(null)");
}
dbSerialPrintln("]");
}
/**
* @file NexObject.h
*
* The definition of class NexObject.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXOBJECT_H__
#define __NEXOBJECT_H__
#include <Arduino.h>
#include "NexConfig.h"
/**
* @addtogroup CoreAPI
* @{
*/
/**
* Root class of all Nextion components.
*
* Provides the essential attributes of a Nextion component and the methods accessing
* them. At least, Page ID(pid), Component ID(pid) and an unique name are needed for
* creating a component in Nexiton library.
*/
class NexObject
{
public: /* methods */
/**
* Constructor.
*
* @param pid - page id.
* @param cid - component id.
* @param name - pointer to an unique name in range of all components.
*/
NexObject(uint8_t pid, uint8_t cid, const char *name);
/**
* Print current object'address, page id, component id and name.
*
* @warning this method does nothing, unless debug message enabled.
*/
void printObjInfo(void);
protected: /* methods */
/*
* Get page id.
*
* @return the id of page.
*/
uint8_t getObjPid(void);
/*
* Get component id.
*
* @return the id of component.
*/
uint8_t getObjCid(void);
/*
* Get component name.
*
* @return the name of component.
*/
const char *getObjName(void);
private: /* data */
uint8_t __pid; /* Page ID */
uint8_t __cid; /* Component ID */
const char *__name; /* An unique name */
};
/**
* @}
*/
#endif /* #ifndef __NEXOBJECT_H__ */
/**
* @file NexPage.cpp
*
* The implementation of class NexPage.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexPage.h"
NexPage::NexPage(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexPage::show(void)
{
uint8_t buffer[4] = {0};
const char *name = getObjName();
if (!name)
{
return false;
}
String cmd = String("page ");
cmd += name;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexPage.h
*
* The definition of class NexPage.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXPAGE_H__
#define __NEXPAGE_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* A special component , which can contain other components such as NexButton,
* NexText and NexWaveform, etc.
*/
class NexPage: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexPage(uint8_t pid, uint8_t cid, const char *name);
/**
* Show itself.
*
* @return true if success, false for faileure.
*/
bool show(void);
};
/**
* @}
*/
#endif /* #ifndef __NEXPAGE_H__ */
/**
* @file NexPicture.cpp
*
* The implementation of class NexPicture.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexPicture.h"
NexPicture::NexPicture(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexPicture::getPic(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".pic";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexPicture::setPic(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".pic=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexPicture.h
*
* The definition of class NexPicture.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXPICTURE_H__
#define __NEXPICTURE_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexPicture component.
*/
class NexPicture: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexPicture(uint8_t pid, uint8_t cid, const char *name);
/**
* Get picture's number.
*
* @param number - an output parameter to save picture number.
*
* @retval true - success.
* @retval false - failed.
*/
bool getPic(uint32_t *number);
/**
* Set picture's number.
*
* @param number -the picture number.
*
* @retval true - success.
* @retval false - failed.
*/
bool setPic(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXPICTURE_H__ */
/**
* @file NexProgressBar.cpp
*
* The implementation of class NexProgressBar.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexProgressBar.h"
NexProgressBar::NexProgressBar(uint8_t pid, uint8_t cid, const char *name)
:NexObject(pid, cid, name)
{
}
bool NexProgressBar::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexProgressBar::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexProgressBar.h
*
* The definition of class NexProgressBar.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXPROGRESSBAR_H__
#define __NEXPROGRESSBAR_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexProgressBar component.
*/
class NexProgressBar: public NexObject
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexProgressBar(uint8_t pid, uint8_t cid, const char *name);
/**
* Get the value of progress bar.
*
* @param number - an output parameter to save the value of porgress bar.
*
* @retval true - success.
* @retval false - failed.
*/
bool getValue(uint32_t *number);
/**
* Set the value of progress bar.
*
* @param number - the value of progress bar.
*
* @retval true - success.
* @retval false - failed.
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXPROGRESSBAR_H__ */
/**
* @file NexSlider.cpp
*
* The implementation of class NexSlider.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexSlider.h"
NexSlider::NexSlider(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
bool NexSlider::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexSlider::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexSlider::setMaxVal(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".maxval=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexSlider::setMinVal(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".minval=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexSlider::setHigVal(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".hig=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexSlider.h
*
* The definition of class NexSlider.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXSLIDER_H__
#define __NEXSLIDER_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexSlider component.
*/
class NexSlider: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexSlider(uint8_t pid, uint8_t cid, const char *name);
/**
* Get the value of slider.
*
* @param number - an output parameter to save the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool getValue(uint32_t *number);
/**
* Set the value of slider.
*
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool setValue(uint32_t number);
bool setMaxVal(uint32_t number);
bool setMinVal(uint32_t number);
bool setHigVal(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXSLIDER_H__ */
/**
* @file NexText.cpp
*
* The implementation of class NexText.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexText.h"
NexText::NexText(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint16_t NexText::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexText::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexText::setColor(uint32_t value)
{
char buf[10] = {0};
String cmd;
utoa(value, buf, 10);
cmd += getObjName();
cmd += ".pco=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexText.h
*
* The definition of class NexText.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXTEXT_H__
#define __NEXTEXT_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexText component.
*/
class NexText: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexText(uint8_t pid, uint8_t cid, const char *name);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint16_t getText(char *buffer, uint16_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
bool setColor(uint32_t value);
};
/**
* @}
*/
#endif /* #ifndef __NEXTEXT_H__ */
/**
* @file NexTimer.cpp
*
* The implementation of class NexTimer.
*
* @author huang xianming (email:<xianming.huang@itead.cc>)
* @date 2015/8/26
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexTimer.h"
NexTimer::NexTimer(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
void NexTimer::attachTimer(NexTouchEventCb timer, void *ptr)
{
NexTouch::attachPop(timer, ptr);
}
void NexTimer::detachTimer(void)
{
NexTouch::detachPop();
}
bool NexTimer::getCycle(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".tim";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexTimer::setCycle(uint32_t number)
{
char buf[10] = {0};
String cmd;
if (number < 50)
{
number = 50;
}
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".tim=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexTimer::enable(void)
{
char buf[10] = {0};
String cmd;
utoa(1, buf, 10);
cmd += getObjName();
cmd += ".en=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexTimer::disable(void)
{
char buf[10] = {0};
String cmd;
utoa(0, buf, 10);
cmd += getObjName();
cmd += ".en=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexTimer.h
*
* The definition of class NexTimer.
*
* @author huang xianming (email:<xianming.huang@itead.cc>)
* @date 2015/8/26
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXTIMER_H__
#define __NEXTIMER_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexTimer component.
*
* Commonly, you want to do something after set timer cycle and enable it,and the cycle value
* must be greater than 50
*
*/
class NexTimer: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexTimer(uint8_t pid, uint8_t cid, const char *name);
/**
* Attach an callback function of timer respond event.
*
* @param timer - callback called with ptr when a timer respond event occurs.
* @param ptr - parameter passed into push[default:NULL].
* @return none.
*
* @note If calling this method multiply, the last call is valid.
*/
void attachTimer(NexTouchEventCb timer, void *ptr = NULL);
/**
* Detach an callback function.
*
* @return none.
*/
void detachTimer(void);
/**
* Get the value of timer cycle val.
*
* @param number - an output parameter to save the value of timer cycle.
*
* @retval true - success.
* @retval false - failed.
*/
bool getCycle(uint32_t *number);
/**
* Set the value of timer cycle val.
*
* @param number - the value of timer cycle.
*
* @retval true - success.
* @retval false - failed.
*
* @warning the cycle value must be greater than 50.
*/
bool setCycle(uint32_t number);
/**
* contorl timer enable.
*
* @retval true - success.
* @retval false - failed.
*/
bool enable(void);
/**
* contorl timer disable.
*
* @retval true - success.
* @retval false - failed.
*/
bool disable(void);
};
/**
* @}
*/
#endif /* #ifndef __NEXTIMER_H__ */
/**
* @file NexTouch.cpp
*
* The implementation of class NexTouch.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexTouch.h"
NexTouch::NexTouch(uint8_t pid, uint8_t cid, const char *name)
:NexObject(pid, cid, name)
{
this->__cb_push = NULL;
this->__cb_pop = NULL;
this->__cbpop_ptr = NULL;
this->__cbpush_ptr = NULL;
}
void NexTouch::attachPush(NexTouchEventCb push, void *ptr)
{
this->__cb_push = push;
this->__cbpush_ptr = ptr;
}
void NexTouch::detachPush(void)
{
this->__cb_push = NULL;
this->__cbpush_ptr = NULL;
}
void NexTouch::attachPop(NexTouchEventCb pop, void *ptr)
{
this->__cb_pop = pop;
this->__cbpop_ptr = ptr;
}
void NexTouch::detachPop(void)
{
this->__cb_pop = NULL;
this->__cbpop_ptr = NULL;
}
void NexTouch::push(void)
{
if (__cb_push)
{
__cb_push(__cbpush_ptr);
}
}
void NexTouch::pop(void)
{
if (__cb_pop)
{
__cb_pop(__cbpop_ptr);
}
}
void NexTouch::iterate(NexTouch **list, uint8_t pid, uint8_t cid, int32_t event)
{
NexTouch *e = NULL;
uint16_t i = 0;
if (NULL == list)
{
return;
}
for(i = 0; (e = list[i]) != NULL; i++)
{
if (e->getObjPid() == pid && e->getObjCid() == cid)
{
e->printObjInfo();
if (NEX_EVENT_PUSH == event)
{
e->push();
}
else if (NEX_EVENT_POP == event)
{
e->pop();
}
break;
}
}
}
/**
* @file NexTouch.h
*
* The definition of class NexTouch.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXTOUCH_H__
#define __NEXTOUCH_H__
#include <Arduino.h>
#include "NexConfig.h"
#include "NexObject.h"
/**
* @addtogroup TouchEvent
* @{
*/
/**
* Push touch event occuring when your finger or pen coming to Nextion touch pannel.
*/
#define NEX_EVENT_PUSH (0x01)
/**
* Pop touch event occuring when your finger or pen leaving from Nextion touch pannel.
*/
#define NEX_EVENT_POP (0x00)
/**
* Type of callback funciton when an touch event occurs.
*
* @param ptr - user pointer for any purpose. Commonly, it is a pointer to a object.
* @return none.
*/
typedef void (*NexTouchEventCb)(void *ptr);
/**
* Father class of the components with touch events.
*
* Derives from NexObject and provides methods allowing user to attach
* (or detach) a callback function called when push(or pop) touch event occurs.
*/
class NexTouch: public NexObject
{
public: /* static methods */
static void iterate(NexTouch **list, uint8_t pid, uint8_t cid, int32_t event);
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexTouch(uint8_t pid, uint8_t cid, const char *name);
/**
* Attach an callback function of push touch event.
*
* @param push - callback called with ptr when a push touch event occurs.
* @param ptr - parameter passed into push[default:NULL].
* @return none.
*
* @note If calling this method multiply, the last call is valid.
*/
void attachPush(NexTouchEventCb push, void *ptr = NULL);
/**
* Detach an callback function.
*
* @return none.
*/
void detachPush(void);
/**
* Attach an callback function of pop touch event.
*
* @param pop - callback called with ptr when a pop touch event occurs.
* @param ptr - parameter passed into pop[default:NULL].
* @return none.
*
* @note If calling this method multiply, the last call is valid.
*/
void attachPop(NexTouchEventCb pop, void *ptr = NULL);
/**
* Detach an callback function.
*
* @return none.
*/
void detachPop(void);
private: /* methods */
void push(void);
void pop(void);
private: /* data */
NexTouchEventCb __cb_push;
void *__cbpush_ptr;
NexTouchEventCb __cb_pop;
void *__cbpop_ptr;
};
/**
* @}
*/
#endif /* #ifndef __NEXTOUCH_H__ */
/**
* @file NexVar.cpp
*
* The implementation of class NexVar.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexVar.h"
NexVar::NexVar(uint8_t pid, uint8_t cid, const char *name)
:NexTouch(pid, cid, name)
{
}
uint16_t NexVar::getText(char *buffer, uint16_t len)
{
String cmd;
cmd += "get ";
cmd += getObjName();
cmd += ".txt";
sendCommand(cmd.c_str());
return recvRetString(buffer,len);
}
bool NexVar::setText(const char *buffer)
{
String cmd;
cmd += getObjName();
cmd += ".txt=\"";
cmd += buffer;
cmd += "\"";
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexVar::getValue(uint32_t *number)
{
String cmd = String("get ");
cmd += getObjName();
cmd += ".val";
sendCommand(cmd.c_str());
return recvRetNumber(number);
}
bool NexVar::setValue(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".val=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
/**
* @file NexVar.h
*
* The definition of class NexVar.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXVAL_H__
#define __NEXVAL_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexVar component.
*/
class NexVar: public NexTouch
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexVar(uint8_t pid, uint8_t cid, const char *name);
/**
* Get text attribute of component.
*
* @param buffer - buffer storing text returned.
* @param len - length of buffer.
* @return The real length of text returned.
*/
uint16_t getText(char *buffer, uint16_t len);
/**
* Set text attribute of component.
*
* @param buffer - text buffer terminated with '\0'.
* @return true if success, false for failure.
*/
bool setText(const char *buffer);
/**
* Get the value of slider.
*
* @param number - an output parameter to save the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool getValue(uint32_t *number);
/**
* Set the value of slider.
*
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool setValue(uint32_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXTEXT_H__ */
/**
* @file NexWaveform.cpp
*
* The implementation of class NexWaveform.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#include "NexWaveform.h"
NexWaveform::NexWaveform(uint8_t pid, uint8_t cid, const char *name)
:NexObject(pid, cid, name)
{
}
bool NexWaveform::addValue(uint8_t ch, uint8_t number)
{
char buf[15] = {0};
if (ch > 3)
{
return false;
}
sprintf(buf, "add %u,%u,%u", getObjCid(), ch, number);
sendCommand(buf);
return true;
}
/**
* @file NexWaveform.h
*
* The definition of class NexWaveform.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXWAVEFORM_H__
#define __NEXWAVEFORM_H__
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
*/
/**
* NexWaveform component.
*/
class NexWaveform: public NexObject
{
public: /* methods */
/**
* @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
*/
NexWaveform(uint8_t pid, uint8_t cid, const char *name);
/**
* Add value to show.
*
* @param ch - channel of waveform(0-3).
* @param number - the value of waveform.
*
* @retval true - success.
* @retval false - failed.
*/
bool addValue(uint8_t ch, uint8_t number);
};
/**
* @}
*/
#endif /* #ifndef __NEXWAVEFORM_H__ */
/**
* @file Nextion.h
*
* The header file including all other header files provided by this library.
*
* Every example sketch should include this file.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/12
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* 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 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXTION_H__
#define __NEXTION_H__
#include "Arduino.h"
#include "NexConfig.h"
#include "NexTouch.h"
#include "NexHardware.h"
#include "NexButton.h"
#include "NexCrop.h"
#include "NexGauge.h"
#include "NexHotspot.h"
#include "NexPage.h"
#include "NexPicture.h"
#include "NexProgressBar.h"
#include "NexSlider.h"
#include "NexText.h"
#include "NexWaveform.h"
#include "NexTimer.h"
#include "NexVar.h"
#endif /* #ifndef __NEXTION_H__ */
......@@ -19,7 +19,7 @@
#if ENABLED(NEXTION_GFX)
#include "nextion_gfx.h"
#include "Nextion_gfx.h"
const int INSIDE = 0; // 0000
const int LEFT = 1; // 0001
......
......@@ -19,7 +19,7 @@
#define NEXTION_GFX_H
#if ENABLED(NEXTION_GFX)
#include <nextion.h>
#include "Nextion.h"
#define VC_AXIS 0
#define VC_MOVE 3
......
......@@ -2,9 +2,9 @@
#if ENABLED(NEXTION)
#include "nextion_lcd.h"
#include "nextion_gfx.h"
#include <Nextion.h>
#include "Nextion_lcd.h"
#include "Nextion_gfx.h"
#include "Nextion.h"
bool NextionON = false;
bool PageInfo = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment