initial version

This commit is contained in:
PavelSindler 2017-09-15 18:04:19 +02:00
parent 3bdaa70ba1
commit ca3ba55ca7
5 changed files with 64 additions and 20 deletions

View File

@ -6438,6 +6438,43 @@ void ClearToSend()
SERIAL_PROTOCOLLNRPGM(MSG_OK); SERIAL_PROTOCOLLNRPGM(MSG_OK);
} }
update_currents() {
float current_high[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
float current_low[3] = DEFAULT_PWM_MOTOR_CURRENT;
float tmp_motor[3];
SERIAL_ECHOLNPGM("Currents updated: ");
if (destination[Z_AXIS] < Z_SILENT) {
SERIAL_ECHOLNPGM("LOW");
for (uint8_t i = 0; i < 3; i++) {
digipot_current(i, current_low[i]);
MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": ");
MYSERIAL.println(current_low[i]);
}
}
else if (destination[Z_AXIS] > Z_HIGH_POWER) {
SERIAL_ECHOLNPGM("HIGH");
for (uint8_t i = 0; i < 3; i++) {
digipot_current(i, current_high[i]);
MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": ");
MYSERIAL.println(current_high[i]);
}
}
else {
for (uint8_t i = 0; i < 3; i++) {
float q = current_low[i] - Z_SILENT*((current_high[i] - current_low[i]) / (Z_HIGH_POWER - Z_SILENT));
tmp_motor[i] = ((current_high[i] - current_low[i]) / (Z_HIGH_POWER - Z_SILENT))*destination[Z_AXIS] + q;
digipot_current(i, tmp_motor[i]);
MYSERIAL.print(int(i));
SERIAL_ECHOPGM(": ");
MYSERIAL.println(tmp_motor[i]);
}
}
}
void get_coordinates() void get_coordinates()
{ {
bool seen[4]={false,false,false,false}; bool seen[4]={false,false,false,false};
@ -6459,6 +6496,7 @@ void get_coordinates()
if (relative) if (relative)
destination[i] += current_position[i]; destination[i] += current_position[i];
seen[i]=true; seen[i]=true;
if (i == Z_AXIS && SilentModeMenu == 2) update_currents();
} }
else destination[i] = current_position[i]; //Are these else lines really needed? else destination[i] = current_position[i]; //Are these else lines really needed?
} }

View File

@ -60,6 +60,11 @@ const char * const MSG_AUTO_HOME_LANG_TABLE[1] PROGMEM = {
MSG_AUTO_HOME_EN MSG_AUTO_HOME_EN
}; };
const char MSG_AUTO_MODE_ON_EN[] PROGMEM = "Mode [auto power]";
const char * const MSG_AUTO_MODE_ON_LANG_TABLE[1] PROGMEM = {
MSG_AUTO_MODE_ON_EN
};
const char MSG_A_RETRACT_EN[] PROGMEM = "A-retract"; const char MSG_A_RETRACT_EN[] PROGMEM = "A-retract";
const char * const MSG_A_RETRACT_LANG_TABLE[1] PROGMEM = { const char * const MSG_A_RETRACT_LANG_TABLE[1] PROGMEM = {
MSG_A_RETRACT_EN MSG_A_RETRACT_EN

View File

@ -102,8 +102,9 @@
#define(length=20) MSG_CHANGING_FILAMENT "Changing filament!" #define(length=20) MSG_CHANGING_FILAMENT "Changing filament!"
#define MSG_SILENT_MODE_ON "Mode [Stealth]" #define MSG_SILENT_MODE_ON "Mode [silent]"
#define MSG_SILENT_MODE_OFF "Mode [Normal]" #define MSG_SILENT_MODE_OFF "Mode [high power]"
#define MSG_AUTO_MODE_ON "Mode [auto power]"
#define(length=20) MSG_REBOOT "Reboot the printer" #define(length=20) MSG_REBOOT "Reboot the printer"
#define(length=20) MSG_TAKE_EFFECT " for take effect" #define(length=20) MSG_TAKE_EFFECT " for take effect"

View File

@ -3412,7 +3412,12 @@ static void lcd_fsensor_fail()
static void lcd_silent_mode_set() { static void lcd_silent_mode_set() {
SilentModeMenu = !SilentModeMenu; switch (SilentModeMenu) {
case 0: SilentModeMenu = 1; break;
case 1: SilentModeMenu = 2; break;
case 2: SilentModeMenu = 0; break;
default: SilentModeMenu = 0; break;
}
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
#ifdef TMC2130 #ifdef TMC2130
// Wait until the planner queue is drained and the stepper routine achieves // Wait until the planner queue is drained and the stepper routine achieves
@ -3891,6 +3896,13 @@ static void lcd_settings_menu()
{ {
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
} }
if (!farm_mode) { //dont show in menu if we are in farm mode
switch (SilentModeMenu) {
case 0: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
case 1: MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); break;
case 2: MENU_ITEM(function, MSG_AUTO_MODE_ON, lcd_silent_mode_set); break;
default: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
}
#ifdef PAT9125 #ifdef PAT9125
#ifndef DEBUG_DISABLE_FSENSORCHECK #ifndef DEBUG_DISABLE_FSENSORCHECK
@ -3951,6 +3963,7 @@ static void lcd_settings_menu()
MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set); MENU_ITEM(function, MSG_SECOND_SERIAL_ON, lcd_second_serial_set);
} }
if (!isPrintPaused && !homing_flag) if (!isPrintPaused && !homing_flag)
{ {
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);
@ -5281,24 +5294,10 @@ static void lcd_tune_menu()
MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_colorprint_change);//7 MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_colorprint_change);//7
#endif #endif
#ifdef PAT9125 if (SilentModeMenu == 0) {
#ifndef DEBUG_DISABLE_FSENSORCHECK MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set_tune);
if (FSensorStateMenu == 0) {
MENU_ITEM(function, MSG_FSENSOR_OFF, lcd_fsensor_state_set);
} else { } else {
MENU_ITEM(function, MSG_FSENSOR_ON, lcd_fsensor_state_set); MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set_tune);
}
#endif //DEBUG_DISABLE_FSENSORCHECK
#endif //PAT9125
#ifdef TMC2130
if (SilentModeMenu == 0) MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set);
else MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set);
if (SilentModeMenu == 0)
{
if (CrashDetectMenu == 0) MENU_ITEM(function, MSG_CRASHDETECT_OFF, lcd_crash_mode_set);
else MENU_ITEM(function, MSG_CRASHDETECT_ON, lcd_crash_mode_set);
} }
else MENU_ITEM(submenu, MSG_CRASHDETECT_NA, lcd_crash_mode_info); else MENU_ITEM(submenu, MSG_CRASHDETECT_NA, lcd_crash_mode_info);
#endif //TMC2130 #endif //TMC2130

View File

@ -118,6 +118,7 @@ void lcd_mylang();
extern int farm_no; extern int farm_no;
extern int farm_timer; extern int farm_timer;
extern int farm_status; extern int farm_status;
extern int8_t SilentModeMenu;
#ifdef SNMM #ifdef SNMM
extern uint8_t snmm_extruder; extern uint8_t snmm_extruder;