2019-06-21 11:47:23 +02:00
|
|
|
/*********************
|
|
|
|
* extui_example.cpp *
|
|
|
|
*********************/
|
2018-10-08 22:44:05 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* 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/>. *
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-06-21 11:47:23 +02:00
|
|
|
#include "../inc/MarlinConfigPre.h"
|
2018-10-08 22:44:05 +02:00
|
|
|
|
2019-05-04 06:53:15 +02:00
|
|
|
#if BOTH(EXTUI_EXAMPLE, EXTENSIBLE_UI)
|
2018-10-08 22:44:05 +02:00
|
|
|
|
2020-03-13 22:29:29 +01:00
|
|
|
#include "extui/ui_api.h"
|
2018-10-08 22:44:05 +02:00
|
|
|
|
|
|
|
// To implement a new UI, complete the functions below and
|
|
|
|
// read or update Marlin's state using the methods in the
|
2018-11-14 20:13:51 +01:00
|
|
|
// ExtUI methods in "../ui_api.h"
|
2018-10-16 23:58:29 +02:00
|
|
|
//
|
|
|
|
// Although it may be possible to access other state
|
|
|
|
// variables from Marlin, using the API here possibly
|
|
|
|
// helps ensure future compatibility.
|
2018-10-08 22:44:05 +02:00
|
|
|
|
2018-11-14 20:13:51 +01:00
|
|
|
namespace ExtUI {
|
2018-10-16 23:58:29 +02:00
|
|
|
void onStartup() {
|
|
|
|
/* Initialize the display module here. The following
|
|
|
|
* routines are available for access to the GPIO pins:
|
|
|
|
*
|
|
|
|
* SET_OUTPUT(pin)
|
|
|
|
* SET_INPUT_PULLUP(pin)
|
|
|
|
* SET_INPUT(pin)
|
|
|
|
* WRITE(pin,value)
|
|
|
|
* READ(pin)
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
void onIdle() {}
|
2019-10-10 02:46:10 +02:00
|
|
|
void onPrinterKilled(PGM_P const error, PGM_P const component) {}
|
2018-10-24 23:36:11 +02:00
|
|
|
void onMediaInserted() {};
|
|
|
|
void onMediaError() {};
|
|
|
|
void onMediaRemoved() {};
|
2018-10-08 22:44:05 +02:00
|
|
|
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
|
|
|
|
void onPrintTimerStarted() {}
|
|
|
|
void onPrintTimerPaused() {}
|
|
|
|
void onPrintTimerStopped() {}
|
2019-07-17 10:05:23 +02:00
|
|
|
void onFilamentRunout(const extruder_t extruder) {}
|
2019-03-09 21:13:50 +01:00
|
|
|
void onUserConfirmRequired(const char * const msg) {}
|
2018-11-18 05:21:44 +01:00
|
|
|
void onStatusChanged(const char * const msg) {}
|
2018-10-08 22:44:05 +02:00
|
|
|
void onFactoryReset() {}
|
2019-05-04 06:53:15 +02:00
|
|
|
|
|
|
|
void onStoreSettings(char *buff) {
|
2020-01-03 00:59:06 +01:00
|
|
|
// Called when saving to EEPROM (i.e. M500). If the ExtUI needs
|
2019-05-04 06:53:15 +02:00
|
|
|
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
|
|
|
// into buff.
|
|
|
|
|
|
|
|
// Example:
|
|
|
|
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
|
|
|
|
// memcpy(buff, &myDataStruct, sizeof(myDataStruct));
|
|
|
|
}
|
|
|
|
|
|
|
|
void onLoadSettings(const char *buff) {
|
2020-01-03 00:59:06 +01:00
|
|
|
// Called while loading settings from EEPROM. If the ExtUI
|
2019-05-04 06:53:15 +02:00
|
|
|
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
|
|
|
// from buff
|
|
|
|
|
|
|
|
// Example:
|
|
|
|
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
|
|
|
|
// memcpy(&myDataStruct, buff, sizeof(myDataStruct));
|
|
|
|
}
|
|
|
|
|
|
|
|
void onConfigurationStoreWritten(bool success) {
|
2020-01-03 00:59:06 +01:00
|
|
|
// Called after the entire EEPROM has been written,
|
2019-05-04 06:53:15 +02:00
|
|
|
// whether successful or not.
|
|
|
|
}
|
|
|
|
|
|
|
|
void onConfigurationStoreRead(bool success) {
|
2020-01-03 00:59:06 +01:00
|
|
|
// Called after the entire EEPROM has been read,
|
2019-05-04 06:53:15 +02:00
|
|
|
// whether successful or not.
|
|
|
|
}
|
2019-10-07 22:39:52 +02:00
|
|
|
|
2020-05-02 23:13:14 +02:00
|
|
|
#if HAS_MESH
|
|
|
|
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
|
|
|
|
// Called when any mesh points are updated
|
|
|
|
}
|
2020-01-04 04:00:44 +01:00
|
|
|
|
2020-05-02 23:13:14 +02:00
|
|
|
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
|
|
|
|
// Called to indicate a special condition
|
|
|
|
}
|
|
|
|
#endif
|
2020-04-02 21:24:55 +02:00
|
|
|
|
2020-01-04 04:00:44 +01:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
2020-03-31 21:22:04 +02:00
|
|
|
void onPowerLossResume() {
|
2020-01-04 04:00:44 +01:00
|
|
|
// Called on resume from power-loss
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_PID_HEATING
|
2020-03-31 21:22:04 +02:00
|
|
|
void onPidTuning(const result_t rst) {
|
2020-01-04 04:00:44 +01:00
|
|
|
// Called for temperature PID tuning result
|
|
|
|
}
|
|
|
|
#endif
|
2018-10-08 22:44:05 +02:00
|
|
|
}
|
|
|
|
|
2019-05-04 06:53:15 +02:00
|
|
|
#endif // EXTUI_EXAMPLE && EXTENSIBLE_UI
|