mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-23 01:58:59 +00:00
✨ MAX7219_REINIT_ON_POWERUP (#26163)
This commit is contained in:
parent
983aee5718
commit
ea6a891038
4 changed files with 52 additions and 6 deletions
|
@ -4308,6 +4308,7 @@
|
||||||
// See class CodeProfiler.
|
// See class CodeProfiler.
|
||||||
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
|
//#define MAX7219_DEBUG_MULTISTEPPING 6 // Show multi-stepping 1 to 128 on this LED matrix row.
|
||||||
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
|
//#define MAX7219_DEBUG_SLOWDOWN 6 // Count (mod 16) how many times SLOWDOWN has reduced print speed.
|
||||||
|
//#define MAX7219_REINIT_ON_POWERUP // Re-initialize MAX7129 when power supply turns on
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -72,6 +72,26 @@
|
||||||
uint16_t CodeProfiler::call_count = 0;
|
uint16_t CodeProfiler::call_count = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL
|
||||||
|
static int16_t last_head_cnt = 0xF, last_tail_cnt = 0xF;
|
||||||
|
#else
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_HEAD
|
||||||
|
static int16_t last_head_cnt = 0x1;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_TAIL
|
||||||
|
static int16_t last_tail_cnt = 0x1;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_QUEUE
|
||||||
|
static int16_t last_depth = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PROFILE
|
||||||
|
static uint8_t last_time_fraction = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_MULTISTEPPING
|
||||||
|
static uint8_t last_multistepping = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
Max7219 max7219;
|
Max7219 max7219;
|
||||||
|
|
||||||
uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
|
uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
|
||||||
|
@ -550,6 +570,29 @@ void Max7219::init() {
|
||||||
#if MAX7219_INIT_TEST
|
#if MAX7219_INIT_TEST
|
||||||
start_test_pattern();
|
start_test_pattern();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAX7219_REINIT_ON_POWERUP
|
||||||
|
#if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL
|
||||||
|
last_head_cnt = 0xF;
|
||||||
|
last_tail_cnt = 0xF;
|
||||||
|
#else
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_HEAD
|
||||||
|
last_head_cnt = 0x1;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_TAIL
|
||||||
|
last_tail_cnt = 0x1;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PLANNER_QUEUE
|
||||||
|
last_depth = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_PROFILE
|
||||||
|
last_time_fraction = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef MAX7219_DEBUG_MULTISTEPPING
|
||||||
|
last_multistepping = 0;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -676,8 +719,6 @@ void Max7219::idle_tasks() {
|
||||||
|
|
||||||
#if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL
|
#if defined(MAX7219_DEBUG_PLANNER_HEAD) && defined(MAX7219_DEBUG_PLANNER_TAIL) && MAX7219_DEBUG_PLANNER_HEAD == MAX7219_DEBUG_PLANNER_TAIL
|
||||||
|
|
||||||
static int16_t last_head_cnt = 0xF, last_tail_cnt = 0xF;
|
|
||||||
|
|
||||||
if (last_head_cnt != head || last_tail_cnt != tail) {
|
if (last_head_cnt != head || last_tail_cnt != tail) {
|
||||||
range16(MAX7219_DEBUG_PLANNER_HEAD, last_tail_cnt, tail, last_head_cnt, head, &row_change_mask);
|
range16(MAX7219_DEBUG_PLANNER_HEAD, last_tail_cnt, tail, last_head_cnt, head, &row_change_mask);
|
||||||
last_head_cnt = head;
|
last_head_cnt = head;
|
||||||
|
@ -687,7 +728,6 @@ void Max7219::idle_tasks() {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef MAX7219_DEBUG_PLANNER_HEAD
|
#ifdef MAX7219_DEBUG_PLANNER_HEAD
|
||||||
static int16_t last_head_cnt = 0x1;
|
|
||||||
if (last_head_cnt != head) {
|
if (last_head_cnt != head) {
|
||||||
mark16(MAX7219_DEBUG_PLANNER_HEAD, last_head_cnt, head, &row_change_mask);
|
mark16(MAX7219_DEBUG_PLANNER_HEAD, last_head_cnt, head, &row_change_mask);
|
||||||
last_head_cnt = head;
|
last_head_cnt = head;
|
||||||
|
@ -695,7 +735,6 @@ void Max7219::idle_tasks() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAX7219_DEBUG_PLANNER_TAIL
|
#ifdef MAX7219_DEBUG_PLANNER_TAIL
|
||||||
static int16_t last_tail_cnt = 0x1;
|
|
||||||
if (last_tail_cnt != tail) {
|
if (last_tail_cnt != tail) {
|
||||||
mark16(MAX7219_DEBUG_PLANNER_TAIL, last_tail_cnt, tail, &row_change_mask);
|
mark16(MAX7219_DEBUG_PLANNER_TAIL, last_tail_cnt, tail, &row_change_mask);
|
||||||
last_tail_cnt = tail;
|
last_tail_cnt = tail;
|
||||||
|
@ -714,7 +753,6 @@ void Max7219::idle_tasks() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAX7219_DEBUG_PROFILE
|
#ifdef MAX7219_DEBUG_PROFILE
|
||||||
static uint8_t last_time_fraction = 0;
|
|
||||||
const uint8_t current_time_fraction = (uint16_t(CodeProfiler::get_time_fraction()) * MAX7219_NUMBER_UNITS + 8) / 16;
|
const uint8_t current_time_fraction = (uint16_t(CodeProfiler::get_time_fraction()) * MAX7219_NUMBER_UNITS + 8) / 16;
|
||||||
if (current_time_fraction != last_time_fraction) {
|
if (current_time_fraction != last_time_fraction) {
|
||||||
quantity(MAX7219_DEBUG_PROFILE, last_time_fraction, current_time_fraction, &row_change_mask);
|
quantity(MAX7219_DEBUG_PROFILE, last_time_fraction, current_time_fraction, &row_change_mask);
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
#include "../module/temperature.h"
|
#include "../module/temperature.h"
|
||||||
#include "../MarlinCore.h"
|
#include "../MarlinCore.h"
|
||||||
|
|
||||||
|
#if ENABLED(MAX7219_REINIT_ON_POWERUP)
|
||||||
|
#include "max7219.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PS_OFF_SOUND)
|
#if ENABLED(PS_OFF_SOUND)
|
||||||
#include "../libs/buzzer.h"
|
#include "../libs/buzzer.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,6 +104,9 @@ void Power::power_on() {
|
||||||
safe_delay(PSU_POWERUP_DELAY);
|
safe_delay(PSU_POWERUP_DELAY);
|
||||||
|
|
||||||
restore_stepper_drivers();
|
restore_stepper_drivers();
|
||||||
|
|
||||||
|
TERN_(MAX7219_REINIT_ON_POWERUP, max7219.init());
|
||||||
|
|
||||||
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
|
TERN_(HAS_TRINAMIC_CONFIG, safe_delay(PSU_POWERUP_DELAY));
|
||||||
|
|
||||||
#ifdef PSU_POWERUP_GCODE
|
#ifdef PSU_POWERUP_GCODE
|
||||||
|
|
|
@ -27,7 +27,7 @@ opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \
|
||||||
FWRETRACT ARC_SUPPORT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \
|
FWRETRACT ARC_SUPPORT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \
|
||||||
PSU_CONTROL AUTO_POWER_CONTROL E_DUAL_STEPPER_DRIVERS \
|
PSU_CONTROL AUTO_POWER_CONTROL E_DUAL_STEPPER_DRIVERS \
|
||||||
PIDTEMPBED SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER \
|
PIDTEMPBED SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER \
|
||||||
PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL \
|
PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL MAX7219_REINIT_ON_POWERUP \
|
||||||
EXTENSIBLE_UI
|
EXTENSIBLE_UI
|
||||||
opt_add EXTUI_EXAMPLE
|
opt_add EXTUI_EXAMPLE
|
||||||
exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options." "$3"
|
exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options." "$3"
|
||||||
|
|
Loading…
Reference in a new issue