Move ExtUI subfolders up a level (#21820)
This commit is contained in:
committed by
Scott Lahteine
parent
0b3420a012
commit
d3e902af76
125
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Normal file
125
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* lcd/extui/anycubic_i3mega/anycubic_extui.cpp
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(ANYCUBIC_LCD_I3MEGA)
|
||||
|
||||
#include "anycubic_i3mega_lcd.h"
|
||||
#include "../ui_api.h"
|
||||
|
||||
#include <Arduino.h> // for the ::tone() call
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
void onStartup() { AnycubicTFT.OnSetup(); }
|
||||
void onIdle() { AnycubicTFT.OnCommandScan(); }
|
||||
void onPrinterKilled(PGM_P const error, PGM_P const component) { AnycubicTFT.OnKillTFT(); }
|
||||
void onMediaInserted() { AnycubicTFT.OnSDCardStateChange(true); }
|
||||
void onMediaError() { AnycubicTFT.OnSDCardError(); }
|
||||
void onMediaRemoved() { AnycubicTFT.OnSDCardStateChange(false); }
|
||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||
#if ENABLED(SPEAKER)
|
||||
::tone(BEEPER_PIN, frequency, duration);
|
||||
#endif
|
||||
}
|
||||
void onPrintTimerStarted() { AnycubicTFT.OnPrintTimerStarted(); }
|
||||
void onPrintTimerPaused() { AnycubicTFT.OnPrintTimerPaused(); }
|
||||
void onPrintTimerStopped() { AnycubicTFT.OnPrintTimerStopped(); }
|
||||
void onFilamentRunout(const extruder_t extruder) { AnycubicTFT.OnFilamentRunout(); }
|
||||
void onUserConfirmRequired(const char * const msg) { AnycubicTFT.OnUserConfirmRequired(msg); }
|
||||
void onStatusChanged(const char * const msg) {}
|
||||
|
||||
void onHomingStart() {}
|
||||
void onHomingComplete() {}
|
||||
void onPrintFinished() {}
|
||||
|
||||
void onFactoryReset() {}
|
||||
|
||||
void onStoreSettings(char *buff) {
|
||||
// Called when saving to EEPROM (i.e. M500). If the ExtUI needs
|
||||
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
||||
// into buff.
|
||||
|
||||
// Example:
|
||||
// static_assert(sizeof(myDataStruct) <= eeprom_data_size);
|
||||
// memcpy(buff, &myDataStruct, sizeof(myDataStruct));
|
||||
}
|
||||
|
||||
void onLoadSettings(const char *buff) {
|
||||
// Called while loading settings from EEPROM. If the ExtUI
|
||||
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
||||
// from buff
|
||||
|
||||
// Example:
|
||||
// static_assert(sizeof(myDataStruct) <= eeprom_data_size);
|
||||
// memcpy(&myDataStruct, buff, sizeof(myDataStruct));
|
||||
}
|
||||
|
||||
void onPostprocessSettings() {
|
||||
// Called after loading or resetting stored settings
|
||||
}
|
||||
|
||||
void onConfigurationStoreWritten(bool success) {
|
||||
// Called after the entire EEPROM has been written,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
void onConfigurationStoreRead(bool success) {
|
||||
// Called after the entire EEPROM has been read,
|
||||
// whether successful or not.
|
||||
}
|
||||
|
||||
#if HAS_MESH
|
||||
|
||||
void onMeshLevelingStart() {}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
|
||||
// Called when any mesh points are updated
|
||||
}
|
||||
|
||||
void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {
|
||||
// Called when any mesh points are updated
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
void onPidTuning(const result_t rst) {
|
||||
// Called for temperature PID tuning result
|
||||
}
|
||||
#endif
|
||||
|
||||
void onSteppersDisabled() {}
|
||||
void onSteppersEnabled() {}
|
||||
}
|
||||
|
||||
#endif // ANYCUBIC_LCD_I3MEGA
|
1025
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp
Normal file
1025
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp
Normal file
File diff suppressed because it is too large
Load Diff
95
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h
Normal file
95
Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* anycubic_i3mega_lcd.h --- Support for Anycubic i3 Mega TFT
|
||||
* Created by Christian Hopp on 09.12.17.
|
||||
* Improved by David Ramiro
|
||||
* Converted to ExtUI by John BouAntoun 21 June 2020
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../../sd/SdFatConfig.h" // for the FILENAME_LENGTH macro
|
||||
|
||||
#define TFTBUFSIZE 4
|
||||
#define TFT_MAX_CMD_SIZE 96
|
||||
|
||||
enum AnycubicMediaPrintState {
|
||||
AMPRINTSTATE_NOT_PRINTING,
|
||||
AMPRINTSTATE_PRINTING,
|
||||
AMPRINTSTATE_PAUSE_REQUESTED,
|
||||
AMPRINTSTATE_PAUSED,
|
||||
AMPRINTSTATE_STOP_REQUESTED
|
||||
};
|
||||
|
||||
enum AnycubicMediaPauseState {
|
||||
AMPAUSESTATE_NOT_PAUSED,
|
||||
AMPAUSESTATE_PARKING,
|
||||
AMPAUSESTATE_PARKED,
|
||||
AMPAUSESTATE_FILAMENT_OUT,
|
||||
AMPAUSESTATE_FIAMENT_PRUGING,
|
||||
AMPAUSESTATE_HEATER_TIMEOUT,
|
||||
AMPAUSESTATE_REHEATING,
|
||||
AMPAUSESTATE_REHEAT_FINISHED
|
||||
};
|
||||
|
||||
class AnycubicTFTClass {
|
||||
public:
|
||||
AnycubicTFTClass();
|
||||
static void OnSetup();
|
||||
static void OnCommandScan();
|
||||
static void OnKillTFT();
|
||||
static void OnSDCardStateChange(bool);
|
||||
static void OnSDCardError();
|
||||
static void OnFilamentRunout();
|
||||
static void OnUserConfirmRequired(const char *);
|
||||
static void OnPrintTimerStarted();
|
||||
static void OnPrintTimerPaused();
|
||||
static void OnPrintTimerStopped();
|
||||
|
||||
private:
|
||||
static char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
||||
static int TFTbuflen, TFTbufindr, TFTbufindw;
|
||||
static char serial3_char;
|
||||
static int serial3_count;
|
||||
static char *TFTstrchr_pointer;
|
||||
static uint8_t SpecialMenu;
|
||||
static AnycubicMediaPrintState mediaPrintingState;
|
||||
static AnycubicMediaPauseState mediaPauseState;
|
||||
|
||||
static float CodeValue();
|
||||
static bool CodeSeen(char);
|
||||
static bool IsNozzleHomed();
|
||||
static void RenderCurrentFileList();
|
||||
static void RenderSpecialMenu(uint16_t);
|
||||
static void RenderCurrentFolder(uint16_t);
|
||||
static void GetCommandFromTFT();
|
||||
static void CheckSDCardChange();
|
||||
static void CheckPauseState();
|
||||
static void CheckPrintCompletion();
|
||||
static void HandleSpecialMenu();
|
||||
static void DoSDCardStateCheck();
|
||||
static void DoFilamentRunoutCheck();
|
||||
static void StartPrint();
|
||||
static void PausePrint();
|
||||
static void ResumePrint();
|
||||
static void StopPrint();
|
||||
|
||||
static char SelectedDirectory[30];
|
||||
static char SelectedFile[FILENAME_LENGTH];
|
||||
};
|
||||
|
||||
extern AnycubicTFTClass AnycubicTFT;
|
||||
extern const char G28_STR[];
|
Reference in New Issue
Block a user