initial version

This commit is contained in:
PavelSindler 2017-09-15 18:04:19 +02:00
parent f584a84b24
commit 9e1a61cebc
6 changed files with 69 additions and 11 deletions

View File

@ -5964,14 +5964,52 @@ 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};
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) if(code_seen(axis_codes[i]))
{ {
destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*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

@ -63,6 +63,11 @@ const char * const MSG_AUTO_HOME_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_AUTO_HOME_DE MSG_AUTO_HOME_DE
}; };
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

@ -38,6 +38,8 @@ extern const char* const MSG_AUTHOR_LANG_TABLE[1];
#define MSG_AUTHOR LANG_TABLE_SELECT_EXPLICIT(MSG_AUTHOR_LANG_TABLE, 0) #define MSG_AUTHOR LANG_TABLE_SELECT_EXPLICIT(MSG_AUTHOR_LANG_TABLE, 0)
extern const char* const MSG_AUTO_HOME_LANG_TABLE[LANG_NUM]; extern const char* const MSG_AUTO_HOME_LANG_TABLE[LANG_NUM];
#define MSG_AUTO_HOME LANG_TABLE_SELECT(MSG_AUTO_HOME_LANG_TABLE) #define MSG_AUTO_HOME LANG_TABLE_SELECT(MSG_AUTO_HOME_LANG_TABLE)
extern const char* const MSG_AUTO_MODE_ON_LANG_TABLE[1];
#define MSG_AUTO_MODE_ON LANG_TABLE_SELECT_EXPLICIT(MSG_AUTO_MODE_ON_LANG_TABLE, 0)
extern const char* const MSG_A_RETRACT_LANG_TABLE[1]; extern const char* const MSG_A_RETRACT_LANG_TABLE[1];
#define MSG_A_RETRACT LANG_TABLE_SELECT_EXPLICIT(MSG_A_RETRACT_LANG_TABLE, 0) #define MSG_A_RETRACT LANG_TABLE_SELECT_EXPLICIT(MSG_A_RETRACT_LANG_TABLE, 0)
extern const char* const MSG_BABYSTEPPING_X_LANG_TABLE[1]; extern const char* const MSG_BABYSTEPPING_X_LANG_TABLE[1];

View File

@ -103,6 +103,7 @@
#define MSG_SILENT_MODE_ON "Mode [silent]" #define MSG_SILENT_MODE_ON "Mode [silent]"
#define MSG_SILENT_MODE_OFF "Mode [high power]" #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

@ -2754,7 +2754,12 @@ static void lcd_sort_type_set() {
#endif //SDCARD_SORT_ALPHA #endif //SDCARD_SORT_ALPHA
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);
digipot_init(); digipot_init();
lcd_goto_menu(lcd_settings_menu, 7); lcd_goto_menu(lcd_settings_menu, 7);
@ -3157,11 +3162,14 @@ static void lcd_settings_menu()
{ {
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
} }
if ((SilentModeMenu == 0) || (farm_mode) ) { if (!farm_mode) { //dont show in menu if we are in farm mode
MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); switch (SilentModeMenu) {
} else { case 0: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); 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;
}
} }
if (!isPrintPaused && !homing_flag) if (!isPrintPaused && !homing_flag)
@ -4530,10 +4538,13 @@ 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
if (SilentModeMenu == 0) { if (!farm_mode) { //dont show in menu if we are in farm mode
MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set_tune); switch (SilentModeMenu) {
} else { case 0: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set_tune); 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;
}
} }
END_MENU(); END_MENU();
} }

View File

@ -105,6 +105,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;