Merge pull request #6152 from thinkyhead/rc_cleanup_6150_etc

UBL cleanup, optimization
This commit is contained in:
Scott Lahteine
2017-03-30 17:40:29 -05:00
committed by GitHub
12 changed files with 460 additions and 550 deletions

View File

@ -859,65 +859,45 @@ void kill_screen(const char* lcd_msg) {
static int ubl_encoderPosition = 0;
static void _lcd_mesh_fine_tune(const char* msg) {
// static millis_t next_click = 0; // We are going to accelerate the number speed when the wheel
// // turns fast. But that isn't implemented yet
int16_t last_digit;
int32_t rounded;
defer_return_to_status = true;
if (ubl_encoderDiff) {
if ( ubl_encoderDiff > 0 )
ubl_encoderPosition = 1;
else {
ubl_encoderPosition = -1;
}
ubl_encoderPosition = (ubl_encoderDiff > 0) ? 1 : -1;
ubl_encoderDiff = 0;
// next_click = millis();
mesh_edit_accumulator += ( (float) (ubl_encoderPosition)) * .005 / 2.0 ;
mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0;
mesh_edit_value = mesh_edit_accumulator;
encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
rounded = (int32_t)(mesh_edit_value * 1000.0);
last_digit = rounded % 5L; //10L;
rounded -= last_digit;
mesh_edit_value = float(rounded) / 1000.0;
const int32_t rounded = (int32_t)(mesh_edit_value * 1000.0);
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
}
if (lcdDrawUpdate)
lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value));
}
void _lcd_mesh_edit_NOP() {
defer_return_to_status = true;
}
void _lcd_mesh_edit() {
_lcd_mesh_fine_tune(PSTR("Mesh Editor: "));
defer_return_to_status = true;
}
float lcd_mesh_edit() {
lcd_goto_screen(_lcd_mesh_edit_NOP);
_lcd_mesh_fine_tune(PSTR("Mesh Editor: "));
defer_return_to_status = true;
return mesh_edit_value;
}
void lcd_mesh_edit_setup(float initial) {
mesh_edit_value = mesh_edit_accumulator = initial;
lcd_goto_screen(_lcd_mesh_edit_NOP);
mesh_edit_value = mesh_edit_accumulator = initial;
defer_return_to_status = true;
}
void _lcd_z_offset_edit() {
_lcd_mesh_fine_tune(PSTR("Z-Offset: "));
defer_return_to_status = true;
}
float lcd_z_offset_edit() {