2018-11-16 03:32:01 -06:00
|
|
|
/*
|
|
|
|
AnycubicTFT.h --- Support for Anycubic i3 Mega TFT
|
|
|
|
Created by Christian Hopp on 09.12.17.
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
This library 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
|
|
|
|
Lesser General Public License for more details.
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef AnycubicTFT_h
|
|
|
|
#define AnycubicTFT_h
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "MarlinConfig.h"
|
|
|
|
|
|
|
|
char *itostr2(const uint8_t &x);
|
|
|
|
|
|
|
|
#ifndef ULTRA_LCD
|
|
|
|
char *itostr3(const int);
|
|
|
|
char *ftostr32(const float &);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TFTBUFSIZE 4
|
|
|
|
#define TFT_MAX_CMD_SIZE 96
|
|
|
|
#define MSG_MY_VERSION "V116"
|
|
|
|
|
|
|
|
#define ANYCUBIC_TFT_STATE_IDLE 0
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDPRINT 1
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDPAUSE 2
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDPAUSE_REQ 3
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDPAUSE_OOF 4
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDSTOP_REQ 5
|
|
|
|
#define ANYCUBIC_TFT_STATE_SDOUTAGE 99
|
|
|
|
|
|
|
|
|
|
|
|
class AnycubicTFTClass {
|
|
|
|
public:
|
|
|
|
AnycubicTFTClass();
|
|
|
|
void Setup();
|
|
|
|
void CommandScan();
|
|
|
|
void BedHeatingStart();
|
|
|
|
void BedHeatingDone();
|
|
|
|
void HeatingDone();
|
|
|
|
void HeatingStart();
|
|
|
|
void FilamentRunout();
|
|
|
|
void KillTFT();
|
2019-02-18 12:34:59 -06:00
|
|
|
char TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
|
|
|
bool PausedByRunout=false;
|
|
|
|
bool PausedByFilamentChange=false;
|
2019-03-08 09:30:56 -06:00
|
|
|
bool PausedByNozzleTimeout=false;
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
private:
|
|
|
|
char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
|
|
|
int TFTbuflen=0;
|
|
|
|
int TFTbufindr = 0;
|
|
|
|
int TFTbufindw = 0;
|
|
|
|
char serial3_char;
|
|
|
|
int serial3_count = 0;
|
|
|
|
char *TFTstrchr_pointer;
|
|
|
|
char FlagResumFromOutage=0;
|
|
|
|
uint16_t filenumber=0;
|
|
|
|
unsigned long starttime=0;
|
|
|
|
unsigned long stoptime=0;
|
|
|
|
uint8_t tmp_extruder=0;
|
|
|
|
char LastSDstatus=0;
|
|
|
|
uint16_t HeaterCheckCount=0;
|
2019-03-12 10:23:29 -05:00
|
|
|
bool IsParked = false;
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
struct OutageDataStruct {
|
|
|
|
char OutageDataVersion;
|
|
|
|
char OutageFlag;
|
|
|
|
float last_position[XYZE];
|
|
|
|
float last_bed_temp;
|
|
|
|
float last_hotend_temp;
|
|
|
|
long lastSDposition;
|
|
|
|
} OutageData;
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
void WriteOutageEEPromData();
|
|
|
|
void ReadOutageEEPromData();
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
float CodeValue();
|
|
|
|
bool CodeSeen(char);
|
|
|
|
void Ls();
|
|
|
|
void StartPrint();
|
|
|
|
void PausePrint();
|
|
|
|
void StopPrint();
|
|
|
|
void StateHandler();
|
|
|
|
void GetCommandFromTFT();
|
|
|
|
void CheckSDCardChange();
|
|
|
|
void CheckHeaterError();
|
|
|
|
void HandleSpecialMenu();
|
2019-02-15 15:58:42 -06:00
|
|
|
void FilamentChangePause();
|
|
|
|
void FilamentChangeResume();
|
2019-03-08 09:30:56 -06:00
|
|
|
void ReheatNozzle();
|
2019-03-12 10:23:29 -05:00
|
|
|
void ParkAfterStop();
|
2019-02-15 15:58:42 -06:00
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
char SelectedDirectory[30];
|
|
|
|
uint8_t SpecialMenu=false;
|
|
|
|
|
|
|
|
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
|
|
|
|
char FilamentTestStatus=false;
|
|
|
|
char FilamentTestLastStatus=false;
|
2019-03-08 09:05:54 -06:00
|
|
|
bool FilamentSetMillis=true;
|
|
|
|
|
2018-11-16 03:32:01 -06:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
extern AnycubicTFTClass AnycubicTFT;
|
|
|
|
|
|
|
|
#endif /* AnycubicTFT_h */
|