- Fix DisableMMU button on FW incompat
5823c14 - Implement eeprom var, fix reset
This commit is contained in:
parent
204b43dce4
commit
73c486cc2f
|
|
@ -1044,7 +1044,10 @@ void setup()
|
|||
{
|
||||
timer2_init(); // enables functional millis
|
||||
|
||||
MMU2::mmu2.Start();
|
||||
if (eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED))
|
||||
{
|
||||
MMU2::mmu2.Start();
|
||||
}
|
||||
|
||||
ultralcd_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| ^ | ^ | ^ | 04h 4 | ^ | bad_pullup_temp_isr | ^ | ^
|
||||
| ^ | ^ | ^ | 05h 5 | ^ | bad_pullup_step_isr | ^ | ^
|
||||
| 0x0D03 3321 | uint8_t | EEPROM_FW_CRASH_FLAG | 01h 1 | ff/00 | Last FW crash reason (dump_crash_reason) | D21/D22 | D3 Ax0d03 C1
|
||||
| 0x0D03 3320 | uint8_t | EEPROM_FSENSOR_JAM_DETECTION | 01h 1 | ff/01 | fsensor pat9125 jam detection feature | LCD menu | D3 Ax0d02 C1
|
||||
| 0x0D02 3320 | uint8_t | EEPROM_FSENSOR_JAM_DETECTION | 01h 1 | ff/01 | fsensor pat9125 jam detection feature | LCD menu | D3 Ax0d02 C1
|
||||
| 0x0D01 3319 | uint8_t | EEPROM_MMU_ENABLED | 01h 1 | ff/01 | MMU enabled | LCD menu | D3 Ax0d01 C1
|
||||
|
||||
| Address begin | Bit/Type | Name | Valid values | Default/FactoryReset | Description | Gcode/Function| Debug code
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
||||
|
|
@ -559,8 +560,9 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
|||
#define EEPROM_TEMP_MODEL_E (EEPROM_TEMP_MODEL_W-4) // float
|
||||
|
||||
#define EEPROM_FSENSOR_JAM_DETECTION (EEPROM_TEMP_MODEL_E-1) // uint8_t
|
||||
#define EEPROM_MMU_ENABLED (EEPROM_FSENSOR_JAM_DETECTION-1) // uint8_t
|
||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||
#define EEPROM_LAST_ITEM EEPROM_FSENSOR_JAM_DETECTION
|
||||
#define EEPROM_LAST_ITEM EEPROM_MMU_ENABLED
|
||||
// !!!!!
|
||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||
// !!!!!
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void MMU2::Start() {
|
|||
|
||||
mmu2Serial.begin(MMU_BAUD);
|
||||
|
||||
// PowerOn(); we cannot do that on MK3, but at least reset the MMU
|
||||
PowerOn(); // I repurposed this to serve as our EEPROM disable toggle.
|
||||
Reset(ResetForm::ResetPin);
|
||||
|
||||
mmu2Serial.flush(); // make sure the UART buffer is clear before starting communication
|
||||
|
|
@ -117,7 +117,7 @@ void MMU2::Start() {
|
|||
|
||||
void MMU2::Stop() {
|
||||
StopKeepPowered();
|
||||
PowerOff();
|
||||
PowerOff(); // This also disables the MMU in the EEPROM.
|
||||
}
|
||||
|
||||
void MMU2::StopKeepPowered(){
|
||||
|
|
@ -146,6 +146,8 @@ void MMU2::TriggerResetPin(){
|
|||
void MMU2::PowerCycle(){
|
||||
// cut the power to the MMU and after a while restore it
|
||||
// Sadly, MK3/S/+ cannot do this
|
||||
// NOTE: the below will toggle the EEPROM var. Should we
|
||||
// assert this function is never called in the MK3 FW? Do we even care?
|
||||
PowerOff();
|
||||
delay_keep_alive(1000);
|
||||
PowerOn();
|
||||
|
|
@ -511,6 +513,10 @@ void MMU2::CheckUserInput(){
|
|||
break;
|
||||
case RestartMMU:
|
||||
Reset(ResetPin); // we cannot do power cycle on the MK3
|
||||
// ... but mmu2_power.cpp knows this and triggers a soft-reset instead.
|
||||
break;
|
||||
case DisableMMU:
|
||||
Stop(); // Poweroff handles updating the EEPROM shutoff.
|
||||
break;
|
||||
case StopPrint:
|
||||
// @@TODO not sure if we shall handle this high level operation at this spot
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ enum Buttons : uint8_t {
|
|||
// performed on the printer's side
|
||||
RestartMMU,
|
||||
StopPrint,
|
||||
DisableMMU,
|
||||
|
||||
NoButton = 0xff // shall be kept last
|
||||
};
|
||||
|
|
|
|||
|
|
@ -247,7 +247,14 @@ Buttons ButtonPressed(uint16_t ec) {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ERR_SYSTEM_FW_UPDATE_NEEDED:
|
||||
switch (buttonSelectedOperation) {
|
||||
case ButtonOperations::RestartMMU: // "Restart MMU"
|
||||
return DisableMMU;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ERR_SYSTEM_FILAMENT_ALREADY_LOADED:
|
||||
switch (buttonSelectedOperation) {
|
||||
case ButtonOperations::Unload: // "Unload"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,36 @@
|
|||
#include "pins.h"
|
||||
#include "fastio.h"
|
||||
#include <util/delay.h>
|
||||
#include "mmu2.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
namespace MMU2 {
|
||||
|
||||
// sadly, on MK3 we cannot do this on HW
|
||||
void power_on() { }
|
||||
// sadly, on MK3 we cannot do actual power cycle on HW...
|
||||
// so we just block the MMU via EEPROM var instead.
|
||||
void power_on()
|
||||
{
|
||||
if (!eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED))
|
||||
{
|
||||
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
|
||||
}
|
||||
}
|
||||
|
||||
void power_off() { }
|
||||
void power_off()
|
||||
{
|
||||
if (eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED))
|
||||
{
|
||||
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
|
||||
}
|
||||
}
|
||||
|
||||
void reset() {
|
||||
#ifdef MMU_HWRESET // HW - pulse reset pin
|
||||
WRITE(MMU_RST_PIN, 0);
|
||||
_delay_us(100);
|
||||
WRITE(MMU_RST_PIN, 1);
|
||||
#else
|
||||
MMU2::Reset(MMU2::Software);
|
||||
#endif
|
||||
// otherwise HW reset is not available
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4347,6 +4347,25 @@ while(0)
|
|||
#define SETTINGS_CUTTER
|
||||
#endif //MMU_HAS_CUTTER
|
||||
|
||||
static void mmu_enable_switch()
|
||||
{
|
||||
uint8_t current_state = eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED);
|
||||
// EEPROM update is handled by the stop and start functions.
|
||||
if (current_state)
|
||||
{
|
||||
MMU2::mmu2.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
MMU2::mmu2.Start();
|
||||
}
|
||||
}
|
||||
|
||||
static void mmu_reset()
|
||||
{
|
||||
MMU2::mmu2.Reset(MMU2::MMU2::ResetForm::Software);
|
||||
}
|
||||
|
||||
#ifdef TMC2130
|
||||
#define SETTINGS_SILENT_MODE \
|
||||
do\
|
||||
|
|
@ -4796,6 +4815,13 @@ static void lcd_settings_menu()
|
|||
|
||||
SETTINGS_CUTTER;
|
||||
|
||||
MENU_ITEM_TOGGLE_P(PSTR("MMU"), eeprom_read_byte((uint8_t *)EEPROM_MMU_ENABLED) ? _T(MSG_ON) : _T(MSG_OFF), mmu_enable_switch);
|
||||
|
||||
if (MMU2::mmu2.Enabled())
|
||||
{
|
||||
MENU_ITEM_FUNCTION_P(PSTR("Reset MMU"), mmu_reset);
|
||||
}
|
||||
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check);
|
||||
|
||||
SETTINGS_SILENT_MODE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue