Use itoa for sprintf int

2.0.x
Scott Lahteine 4 years ago
parent 07cac80fb0
commit 73f6426114

@ -322,7 +322,7 @@ void usb_task_init(void) {
char *sptr;
// Patch in the filament diameter
sprintf_P(diam, PSTR("%d"), (int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000.0));
itoa((int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000), diam, 10);
// And copy it to the proper place, expanding it to unicode
sptr = &diam[0];

@ -119,22 +119,22 @@ void lv_draw_acceleration_settings() {
dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[X_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_X, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_Y, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_ACCE_Z, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.E0_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_E0, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.E1_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_E1, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_UP, true);

@ -92,22 +92,22 @@ void lv_draw_filament_settings() {
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length);
itoa(gCfgItems.filamentchange_load_length, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.InLength, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_IN_LENGTH, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_speed);
itoa(gCfgItems.filamentchange_load_speed, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.InSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SET_IN_SPEED, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_length);
itoa(gCfgItems.filamentchange_unload_length, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.OutLength, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_FILAMENT_SET_OUT_LENGTH, 2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
itoa(gCfgItems.filamentchange_unload_speed, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.OutSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_FILAMENT_SET_OUT_SPEED, 3, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temp);
itoa(gCfgItems.filament_limit_temp, public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true);

@ -77,17 +77,17 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_homing_sensitivity_settings() {
scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);
sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
itoa(TERN(X_SENSORLESS, stepperX.homing_threshold(), 0), public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0));
itoa(TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0), public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_SENSITIVITY_Y, 1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0));
itoa(TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0), public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_SENSITIVITY_Z, 2, public_buf_l);
#if Z2_SENSORLESS
sprintf_P(public_buf_l, PSTR("%d"), TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0));
itoa(TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0), public_buf_l, 10);
lv_screen_menu_item_1_edit(scr, machine_menu.Z2_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_SENSITIVITY_Z2, 3, public_buf_l);
#endif

@ -216,7 +216,7 @@ void lv_draw_ready_print() {
labelFan = lv_label_create(scr, 380, 80, nullptr);
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0));
itoa(thermalManager.degHotend(0), buf, 10);
lv_label_set_text(labelExt1, buf);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
@ -224,7 +224,7 @@ void lv_draw_ready_print() {
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#if HAS_MULTI_EXTRUDER
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1));
itoa(thermalManager.degHotend(1), buf, 10);
lv_label_set_text(labelExt2, buf);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
@ -233,7 +233,7 @@ void lv_draw_ready_print() {
#endif
#if HAS_HEATED_BED
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed());
itoa(thermalManager.degBed(), buf, 10);
lv_label_set_text(labelBed, buf);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());

@ -107,27 +107,27 @@ void lv_draw_tramming_pos_settings() {
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);
if (!uiCfg.para_ui_page) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[0].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[0].y);
itoa(gCfgItems.trammingPos[0].x, public_buf_l, 10);
itoa(gCfgItems.trammingPos[0].y, buf2, 10);
lv_screen_menu_item_2_edit(scr, leveling_menu.position1, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y1, 0, buf2, ID_MANUAL_POS_X1, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[1].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[1].y);
itoa(gCfgItems.trammingPos[1].x, public_buf_l, 10);
itoa(gCfgItems.trammingPos[1].y, buf2, 10);
lv_screen_menu_item_2_edit(scr, leveling_menu.position2, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MANUAL_POS_Y2, 1, buf2, ID_MANUAL_POS_X2, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[2].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[2].y);
itoa(gCfgItems.trammingPos[2].x, public_buf_l, 10);
itoa(gCfgItems.trammingPos[2].y, buf2, 10);
lv_screen_menu_item_2_edit(scr, leveling_menu.position3, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_MANUAL_POS_Y3, 2, buf2, ID_MANUAL_POS_X3, public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[3].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[3].y);
itoa(gCfgItems.trammingPos[3].x, public_buf_l, 10);
itoa(gCfgItems.trammingPos[3].y, buf2, 10);
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_MANUAL_POS_Y4, 3, buf2, ID_MANUAL_POS_X4, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_DOWN, true);
}
else {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[4].x);
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[4].y);
itoa(gCfgItems.trammingPos[4].x, public_buf_l, 10);
itoa(gCfgItems.trammingPos[4].y, buf2, 10);
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y5, 0, buf2, ID_MANUAL_POS_X5, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_UP, true);

Loading…
Cancel
Save