From 78708903e83dfa0f9353e8a2083731b158281249 Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 12 Sep 2019 07:16:31 +0300 Subject: [PATCH 1/2] Also update eeprom value --- Firmware/stepper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 5b102f42..e7525157 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1563,7 +1563,10 @@ void EEPROM_read_st(int pos, uint8_t* value, uint8_t size) void st_current_init() //Initialize Digipot Motor Current { uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); - if (SilentMode == 0xff) SilentMode = 0; //set power to High Power (MK2.5) or Normal Power (MK3, unused) + if (SilentMode == 0xff){ //set power to High Power (MK2.5) or Normal Power (MK3, unused) + SilentMode = 0; + eeprom_update_byte((uint8_t*)EEPROM_SILENT, SilentMode); + } SilentModeMenu = SilentMode; #ifdef MOTOR_CURRENT_PWM_XY_PIN pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT); From 444daceca3c5f3e42bf73f1a488bc313535372cf Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 12 Sep 2019 13:39:04 +0300 Subject: [PATCH 2/2] Move define as requested --- Firmware/stepper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index e7525157..710b135e 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1561,14 +1561,14 @@ void EEPROM_read_st(int pos, uint8_t* value, uint8_t size) void st_current_init() //Initialize Digipot Motor Current -{ +{ +#ifdef MOTOR_CURRENT_PWM_XY_PIN uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); if (SilentMode == 0xff){ //set power to High Power (MK2.5) or Normal Power (MK3, unused) - SilentMode = 0; + SilentMode = SILENT_MODE_POWER; eeprom_update_byte((uint8_t*)EEPROM_SILENT, SilentMode); } SilentModeMenu = SilentMode; - #ifdef MOTOR_CURRENT_PWM_XY_PIN pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT); @@ -1590,7 +1590,7 @@ void st_current_init() //Initialize Digipot Motor Current st_current_set(2, motor_current_setting[2]); //Set timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise) TCCR5B = (TCCR5B & ~(_BV(CS50) | _BV(CS51) | _BV(CS52))) | _BV(CS50); - #endif +#endif }