Merge pull request #2809 from leptun/PFW-1134-ALTFAN_KILLSWITCH

Pfw 1134
This commit is contained in:
DRracer 2020-08-20 15:42:03 +02:00 committed by GitHub
commit 772844678f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 38 deletions

View File

@ -1,5 +1,5 @@
#include "Dcodes.h" #include "Dcodes.h"
//#include "Marlin.h" #include "Marlin.h"
#include "Configuration.h" #include "Configuration.h"
#include "language.h" #include "language.h"
#include "cmdqueue.h" #include "cmdqueue.h"
@ -226,9 +226,7 @@ void dcode_0()
LOG("D0 - Reset\n"); LOG("D0 - Reset\n");
if (code_seen('B')) //bootloader if (code_seen('B')) //bootloader
{ {
cli(); softReset();
wdt_enable(WDTO_15MS);
while(1);
} }
else //reset else //reset
{ {
@ -252,8 +250,7 @@ void dcode_1()
cli(); cli();
for (int i = 0; i < 8192; i++) for (int i = 0; i < 8192; i++)
eeprom_write_byte((unsigned char*)i, (unsigned char)0xff); eeprom_write_byte((unsigned char*)i, (unsigned char)0xff);
wdt_enable(WDTO_15MS); softReset();
while(1);
} }
/*! /*!
@ -420,8 +417,7 @@ void dcode_5()
boot_dst_addr = (uint32_t)address; boot_dst_addr = (uint32_t)address;
boot_src_addr = (uint32_t)(&data); boot_src_addr = (uint32_t)(&data);
bootapp_print_vars(); bootapp_print_vars();
wdt_enable(WDTO_15MS); softReset();
while(1);
} }
while (count) while (count)
{ {
@ -467,8 +463,7 @@ void dcode_7()
boot_copy_size = (uint16_t)0xc00; boot_copy_size = (uint16_t)0xc00;
boot_src_addr = (uint32_t)0x0003e400; boot_src_addr = (uint32_t)0x0003e400;
boot_dst_addr = (uint32_t)0x0003f400; boot_dst_addr = (uint32_t)0x0003f400;
wdt_enable(WDTO_15MS); softReset();
while(1);
*/ */
} }

View File

@ -512,4 +512,6 @@ void load_filament_final_feed();
void marlin_wait_for_click(); void marlin_wait_for_click();
void raise_z_above(float target, bool plan=true); void raise_z_above(float target, bool plan=true);
extern "C" void softReset();
#endif #endif

View File

@ -648,6 +648,12 @@ void failstats_reset_print()
#endif #endif
} }
void softReset()
{
cli();
wdt_enable(WDTO_15MS);
while(1);
}
#ifdef MESH_BED_LEVELING #ifdef MESH_BED_LEVELING
@ -762,6 +768,7 @@ static void factory_reset(char level)
} }
} }
softReset();
break; break;
@ -3813,9 +3820,7 @@ void process_commands()
#if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a)) #if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a))
boot_app_magic = BOOT_APP_MAGIC; boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags = BOOT_APP_FLG_RUN; boot_app_flags = BOOT_APP_FLG_RUN;
wdt_enable(WDTO_15MS); softReset();
cli();
while(1);
#else //WATCHDOG #else //WATCHDOG
asm volatile("jmp 0x3E000"); asm volatile("jmp 0x3E000");
#endif //WATCHDOG #endif //WATCHDOG
@ -11716,7 +11721,6 @@ void disable_force_z()
#endif // TMC2130 #endif // TMC2130
} }
void enable_force_z() void enable_force_z()
{ {
if(bEnableForce_z) if(bEnableForce_z)

View File

@ -9,6 +9,8 @@
extern FILE _uartout; extern FILE _uartout;
#define uartout (&_uartout) #define uartout (&_uartout)
extern void softReset();
void bootapp_print_vars(void) void bootapp_print_vars(void)
{ {
fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr); fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
@ -39,8 +41,7 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
boot_src_addr = (uint32_t)rptr; boot_src_addr = (uint32_t)rptr;
boot_dst_addr = (uint32_t)fptr; boot_dst_addr = (uint32_t)fptr;
bootapp_print_vars(); bootapp_print_vars();
wdt_enable(WDTO_15MS); softReset();
while(1);
} }
void bootapp_reboot_user0(uint8_t reserved) void bootapp_reboot_user0(uint8_t reserved)
@ -50,6 +51,5 @@ void bootapp_reboot_user0(uint8_t reserved)
boot_app_flags = BOOT_APP_FLG_USER0; boot_app_flags = BOOT_APP_FLG_USER0;
boot_reserved = reserved; boot_reserved = reserved;
bootapp_print_vars(); bootapp_print_vars();
wdt_enable(WDTO_15MS); softReset();
while(1);
} }

View File

@ -359,8 +359,12 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 00h 0 | ^ | LCD backlight mode: __Dim__ | ^ | ^ | ^ | ^ | ^ | 00h 0 | ^ | LCD backlight mode: __Dim__ | ^ | ^
| 0x0D30 3376 | uint16 | EEPROM_BACKLIGHT_TIMEOUT | 01 00 - ff ff | 0a 00h 65535 | LCD backlight timeout: __10__ seconds | LCD menu | D3 Ax0d30 C2 | 0x0D30 3376 | uint16 | EEPROM_BACKLIGHT_TIMEOUT | 01 00 - ff ff | 0a 00h 65535 | LCD backlight timeout: __10__ seconds | LCD menu | D3 Ax0d30 C2
| 0x0D2C 3372 | float | EEPROM_UVLO_LA_K | ??? | ff ff ff ffh | Power panic saved Linear Advanced K value | ??? | D3 Ax0d2c C4 | 0x0D2C 3372 | float | EEPROM_UVLO_LA_K | ??? | ff ff ff ffh | Power panic saved Linear Advanced K value | ??? | D3 Ax0d2c C4
| 0x0D2B 3371 | uint8 | EEPROM_ALTFAN_OVERRIDE | 0-1 | 00h 0 | ALTFAN override | LCD menu | D3 Ax0d2b C1 | 0x0D2B 3371 | uint8 | EEPROM_ALTFAN_OVERRIDE | ffh 255 | ffh 255 | ALTFAN override unknown state | LCD menu | D3 Ax0d2b C1
| 0x0D2A 3370 | uint8 | EEPROM_EXPERIMENTAL_VISIBILITY | 0-1 | 00h 0 | Experimental menu visibility | LCD menu | D3 Ax0d2a C1 | ^ | ^ | ^ | 00h 0 | ^ | ALTFAN override deactivated | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | ALTFAN override activated | ^ | ^
| 0x0D2A 3370 | uint8 | EEPROM_EXPERIMENTAL_VISIBILITY | ffh 255 | ffh 255 | Experimental menu visibility unknown state | LCD menu | D3 Ax0d2a C1
| ^ | ^ | ^ | 00h 0 | ^ | Experimental menu visibility hidden | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | Experimental menu visibility visible | ^ | ^
| Address begin | Bit/Type | Name | Valid values | Default/FactoryReset | Description | Gcode/Function| Debug code | Address begin | Bit/Type | Name | Valid values | Default/FactoryReset | Description | Gcode/Function| Debug code

View File

@ -238,7 +238,7 @@ bool extruder_altfan_detect()
uint8_t overrideVal = eeprom_read_byte((uint8_t *)EEPROM_ALTFAN_OVERRIDE); uint8_t overrideVal = eeprom_read_byte((uint8_t *)EEPROM_ALTFAN_OVERRIDE);
if (overrideVal == EEPROM_EMPTY_VALUE) if (overrideVal == EEPROM_EMPTY_VALUE)
{ {
overrideVal = 0; overrideVal = (calibration_status() == CALIBRATION_STATUS_CALIBRATED) ? 1 : 0;
eeprom_update_byte((uint8_t *)EEPROM_ALTFAN_OVERRIDE, overrideVal); eeprom_update_byte((uint8_t *)EEPROM_ALTFAN_OVERRIDE, overrideVal);
} }
altfanStatus.altfanOverride = overrideVal; altfanStatus.altfanOverride = overrideVal;

View File

@ -2098,9 +2098,6 @@ static void lcd_preheat_menu()
//! @endcode //! @endcode
//! //!
//! //!
//! | Experimental | c=18
//!
//!
//! If DEBUG_BUILD is defined //! If DEBUG_BUILD is defined
//! //!
//! @code{.unparsed} //! @code{.unparsed}
@ -2111,12 +2108,11 @@ static void lcd_preheat_menu()
static void lcd_support_menu() static void lcd_support_menu()
{ {
typedef struct typedef struct
{ // 23bytes total { // 22bytes total
int8_t status; // 1byte int8_t status; // 1byte
bool is_flash_air; // 1byte bool is_flash_air; // 1byte
uint8_t ip[4]; // 4bytes uint8_t ip[4]; // 4bytes
char ip_str[3*4+3+1]; // 16bytes char ip_str[3*4+3+1]; // 16bytes
uint8_t experimental_menu_visibility; // 1byte
} _menu_data_t; } _menu_data_t;
static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data"); static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data");
_menu_data_t* _md = (_menu_data_t*)&(menu_data[0]); _menu_data_t* _md = (_menu_data_t*)&(menu_data[0]);
@ -2131,13 +2127,6 @@ static void lcd_support_menu()
_md->ip[0], _md->ip[1], _md->ip[0], _md->ip[1],
_md->ip[2], _md->ip[3]); _md->ip[2], _md->ip[3]);
_md->experimental_menu_visibility = eeprom_read_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY);
if (_md->experimental_menu_visibility == EEPROM_EMPTY_VALUE)
{
_md->experimental_menu_visibility = 0;
eeprom_update_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY, _md->experimental_menu_visibility);
}
} else if (_md->is_flash_air && } else if (_md->is_flash_air &&
_md->ip[0] == 0 && _md->ip[1] == 0 && _md->ip[0] == 0 && _md->ip[1] == 0 &&
_md->ip[2] == 0 && _md->ip[3] == 0 && _md->ip[2] == 0 && _md->ip[3] == 0 &&
@ -2222,11 +2211,6 @@ static void lcd_support_menu()
MENU_ITEM_SUBMENU_P(_i("Voltages"), lcd_menu_voltages);////MSG_MENU_VOLTAGES c=18 r=1 MENU_ITEM_SUBMENU_P(_i("Voltages"), lcd_menu_voltages);////MSG_MENU_VOLTAGES c=18 r=1
#endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN #endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN
if (_md->experimental_menu_visibility)
{
MENU_ITEM_SUBMENU_P(PSTR("Experimental"), lcd_experimental_menu);////MSG_MENU_EXPERIMENTAL c=18
}
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
MENU_ITEM_SUBMENU_P(PSTR("Debug"), lcd_menu_debug);////c=18 r=1 MENU_ITEM_SUBMENU_P(PSTR("Debug"), lcd_menu_debug);////c=18 r=1
@ -5730,6 +5714,25 @@ static void sheets_menu()
void lcd_hw_setup_menu(void) // can not be "static" void lcd_hw_setup_menu(void) // can not be "static"
{ {
typedef struct
{// 2bytes total
int8_t status;
uint8_t experimental_menu_visibility;
} _menu_data_t;
static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data");
_menu_data_t* _md = (_menu_data_t*)&(menu_data[0]);
if (_md->status == 0 || lcd_draw_update)
{
_md->experimental_menu_visibility = eeprom_read_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY);
if (_md->experimental_menu_visibility == EEPROM_EMPTY_VALUE)
{
_md->experimental_menu_visibility = 0;
eeprom_update_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY, _md->experimental_menu_visibility);
}
}
MENU_BEGIN(); MENU_BEGIN();
MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch
@ -5743,6 +5746,12 @@ void lcd_hw_setup_menu(void) // can not be "static"
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu //! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
if(!mmu_enabled) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor); if(!mmu_enabled) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG
if (_md->experimental_menu_visibility)
{
MENU_ITEM_SUBMENU_P(PSTR("Experimental"), lcd_experimental_menu);////MSG_MENU_EXPERIMENTAL c=18
}
MENU_END(); MENU_END();
} }