Skip to content

Commit

Permalink
Changes to improve printing performance of the USB connection.
Browse files Browse the repository at this point in the history
- change watchdog timeout to call Marlin's kill mechanism
- show the "kill" message on the lcd display
- change watchdog timeout from ~4.8s to ~9.6s;
- reduce delta_segments_per_second to 240
- minor tweaks
  • Loading branch information
aegean-odyssey committed Nov 25, 2019
1 parent 28d791a commit 224e75f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 31 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ M500 ; save
M104 S[first_layer_temperature] T0
M140 S[first_layer_bed_temperature]
; wait on hot end and bed temps
M109
S[first_layer_temperature] T0
M109 S[first_layer_temperature] T0
M190 S[first_layer_bed_temperature]
; home axes, probe/adjust z-offset, and pause 4s
G28
Expand Down
2 changes: 1 addition & 1 deletion marlin_changes/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@
// Make delta curves from many straight lines (linear interpolation).
// This is a trade-off between visible corners (not enough segments)
// and processor overload (too many expensive sqrt calls).
#define DELTA_SEGMENTS_PER_SECOND 500
#define DELTA_SEGMENTS_PER_SECOND 240

// Convert feedrates to apply to the Effector instead of the Carriages
#define DELTA_FEEDRATE_SCALING
Expand Down
2 changes: 1 addition & 1 deletion marlin_changes/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@
// reset. However, THIS FEATURE IS UNSAFE!, as it will only work if
// interrupts are disabled. And the code could hang in an interrupt
// routine with interrupts disabled.
//#define WATCHDOG_RESET_MANUAL
#define WATCHDOG_RESET_MANUAL
#endif

// @section lcd
Expand Down
10 changes: 5 additions & 5 deletions marlin_changes/HAL_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ void HAL_PCD_MspDeInit(PCD_HandleTypeDef * pcd)

void SysTick_Handler(void)
{
#if ENABLED(USE_WATCHDOG)
#if ENABLED(WATCHDOG_RESET_MANUAL)
faux_watchdog_interrupt();
#endif
#endif
ptimer_isr();
HAL_IncTick();
HAL_SYSTICK_IRQHandler();
Expand All @@ -887,11 +892,6 @@ void TIM6_IRQHandler(void)

void TIM7_IRQHandler(void)
{
#if ENABLED(USE_WATCHDOG)
#if ENABLED(WATCHDOG_RESET_MANUAL)
faux_watchdog_interrupt(void);
#endif
#endif
HAL_temp_timer_isr();
TIM7->SR = 0;
}
Expand Down
7 changes: 4 additions & 3 deletions marlin_changes/HAL_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ int HAL_tim7_init(void);

// IWDT

#define FAUX_TIMEOUT 5859 // ~6.0s (depends on tim7 rate)
#define IWDG_TIMEOUT 1500 // ~4.8s

#define FAUX_TIMEOUT 8000 // 8.0s
#define IWDG_TIMEOUT 3000 // 9.6s
int HAL_iwdg_init(void);
void HAL_iwdg_refresh(void);
void faux_watchdog_interrupt(void);

// SPI1

Expand Down
1 change: 1 addition & 0 deletions marlin_changes/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15649,6 +15649,7 @@ void kill(const char* lcd_msg)
#endif
}
#else
lcd_setalertstatusPGM(lcd_msg);
sei();
debug_wait_on_pushbutton();
cli();
Expand Down
2 changes: 1 addition & 1 deletion marlin_changes/malyanlcd_stm32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ void lcd_setalertstatusPGM(const char * message)
{
char s[MAX_CURLY_COMMAND];

sprintf(s, "{E:%s}", message);
sprintf(s, "{E:%.30s}", message);
malyan_ui_write(s);
}

Expand Down
39 changes: 21 additions & 18 deletions marlin_changes/watchdog_stm32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,40 @@
#include "Marlin.h"
#include "watchdog.h"


#ifndef FAUX_TIMEOUT
#define FAUX_TIMEOUT 5859 // ~6s, depends on temperature isr rate
#define FAUX_TIMEOUT 8000 // 8s
#endif

void watchdog_init(void)
#if ENABLED(WATCHDOG_RESET_MANUAL)
static uint16_t faux_watchdog = 0;

void faux_watchdog_interrupt(void)
{
HAL_iwdg_init();
watchdog_reset();
if (! faux_watchdog) return;
if (faux_watchdog--) return;

SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Watchdog Error");

kill(PSTR("Watchdog Error"));
//while (1);
}

void watchdog_reset(void)
{
#if ENABLED(WATCHDOG_RESET_MANUAL)
faux_watchdog = FAUX_TIMEOUT;
#endif
HAL_iwdg_refresh();
}
#else

#if ENABLED(WATCHDOG_RESET_MANUAL)
static uint16_t faux_watchdog = 0;

void faux_watchdog_interrupt(void)
void watchdog_reset(void)
{
if (! faux_watchdog) return;
if (faux_watchdog--) return;
HAL_iwdg_refresh();
}
#endif

void watchdog_init(void)
{
HAL_iwdg_init();
watchdog_reset();
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Watchdog barked, please turn off the printer.");
kill(PSTR("ERR:Watchdog"));
while (1);
}
#endif

0 comments on commit 224e75f

Please sign in to comment.