-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various bugfixes, timer rollover bugs, encoder, long press freeze bug, encoder issue at higher values #2967
base: master
Are you sure you want to change the base?
Changes from 1 commit
3698c62
2febd02
3cf86f6
ac38771
cb25aef
7a8a54f
bb93ee5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…der bug Solves various timer rollover bugs Solves the encoder not working well bug Solves the long press freeze bug Corrects the UART6 pins on MKS TFT35 V1.0 Enhancements, improved handling of back button and long press button 2 additional serial baud rates Adds several long press functions (jump temp, adjust movement speed, jump to temp from extruder menu)
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ static bool extrusionDuringPause = false; // flag for extrusion during Print -> | |
static bool filamentRunoutAlarm = false; | ||
static float lastEPos = 0; // used only to update stats in infoPrintSummary | ||
|
||
static uint32_t nextUpdateTime = 0; | ||
static uint32_t lastUpdateTime = 0; | ||
static bool sendingWaiting = false; | ||
|
||
PRINT_SUMMARY infoPrintSummary = {.name[0] = '\0', 0, 0, 0, 0, false}; | ||
|
@@ -917,7 +917,7 @@ void loopPrintFromTFT(void) | |
|
||
void printSetNextUpdateTime(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if no more used, remove this function (its name is also wrong now; should be renamed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I left it in for reference, removed now |
||
{ | ||
nextUpdateTime = OS_GetTimeMs() + SEC_TO_MS(infoSettings.m27_refresh_time); | ||
lastUpdateTime = OS_GetTimeMs(); | ||
} | ||
|
||
void printClearSendingWaiting(void) | ||
|
@@ -940,10 +940,11 @@ void loopPrintFromOnboard(void) | |
do | ||
{ // send M27 to query SD print status continuously | ||
|
||
if (OS_GetTimeMs() < nextUpdateTime) // if next check time not yet elapsed, do nothing | ||
if ((OS_GetTimeMs() - lastUpdateTime) < SEC_TO_MS(infoSettings.m27_refresh_time)) // if next check time not yet elapsed, do nothing | ||
break; | ||
|
||
printSetNextUpdateTime(); // extend next check time | ||
//printSetNextUpdateTime(); // extend next check time | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if no more used, remove it |
||
lastUpdateTime = OS_GetTimeMs(); | ||
|
||
// if M27 previously enqueued and not yet sent, do nothing | ||
if (sendingWaiting) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,10 +216,10 @@ void heatSyncUpdateSeconds(const uint8_t seconds) | |
|
||
void heatSetNextUpdateTime(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if no more used, remove it (heat_next_update_time should also be renamed to heat_last_update_time) and use directly OS_GetTimeMs() insstead of calling this function |
||
{ | ||
heat_next_update_time = OS_GetTimeMs() + SEC_TO_MS(heat_update_seconds); | ||
heat_next_update_time = OS_GetTimeMs(); | ||
|
||
if (infoMachineSettings.autoReportTemp) | ||
heat_next_update_time += AUTOREPORT_TIMEOUT; | ||
// if (infoMachineSettings.autoReportTemp) | ||
// heat_next_update_time += AUTOREPORT_TIMEOUT; | ||
} | ||
|
||
void heatClearSendingWaiting(void) | ||
|
@@ -234,10 +234,11 @@ void loopCheckHeater(void) | |
// feature to automatically report the temperatures or (if M155 is supported) check temperature auto-report timeout | ||
// and resend M155 command in case of timeout expired | ||
|
||
if (OS_GetTimeMs() < heat_next_update_time) // if next check time not yet elapsed, do nothing | ||
break; | ||
if ((OS_GetTimeMs() - heat_next_update_time) < (SEC_TO_MS(heat_update_seconds) + (infoMachineSettings.autoReportTemp ? AUTOREPORT_TIMEOUT : 0))) // if next check time not yet elapsed, do nothing | ||
break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong indentation? |
||
|
||
heatSetNextUpdateTime(); // extend next check time | ||
// heatSetNextUpdateTime(); // extend next check time | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if not more used, remove it |
||
heat_next_update_time = OS_GetTimeMs(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as you did for other, rename heat_nect_update_time to heat_last_update_time |
||
|
||
// if M105/M155 previously enqueued and not yet sent or pending command | ||
// (to avoid collision in gcode response processing), do nothing | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ bool Touch_Enc_ReadPen(uint16_t duration) | |
if (XPT2046_Read_Pen()) // if touch screen not pressed | ||
{ | ||
lastTime = OS_GetTimeMs(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not remove the empty line before any |
||
return false; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ uint16_t TS_KeyValue(uint8_t totalRect, const GUI_RECT * menuRect) | |
|
||
for (i = 0; i < totalRect; i++) | ||
{ | ||
if ((x > menuRect[i].x0) && (x < menuRect[i].x1) && (y > menuRect[i].y0) && (y < menuRect[i].y1)) | ||
if ((x >= menuRect[i].x0) && (x <= menuRect[i].x1) && (y >= menuRect[i].y0) && (y <= menuRect[i].y1)) | ||
{ | ||
#ifdef BUZZER_PIN | ||
if (TS_Sound == true) | ||
|
@@ -106,21 +106,21 @@ uint16_t KEY_GetValue(uint8_t totalRect, const GUI_RECT * menuRect) | |
{ | ||
if (firstPress) | ||
{ | ||
key_num = TS_KeyValue(totalRect, menuRect); | ||
key_num = TS_KeyValue(totalRect, menuRect); // store the pressed key number | ||
firstPress = false; | ||
|
||
if (TS_ReDrawIcon) | ||
TS_ReDrawIcon(key_num, 1); | ||
} | ||
} | ||
else | ||
else // not pressed | ||
{ | ||
if (firstPress == false) | ||
if (!firstPress) // not pressed anymore | ||
{ | ||
if (TS_ReDrawIcon) | ||
TS_ReDrawIcon(key_num, 0); | ||
|
||
key_return = key_num; | ||
key_return = key_num; // return stored key number | ||
key_num = IDLE_TOUCH; | ||
firstPress = true; | ||
|
||
|
@@ -163,6 +163,7 @@ static inline uint8_t TS_CalibrationEnsure(uint16_t x, uint16_t y) | |
|
||
if (lcd_x < x + TS_ERR_RANGE && lcd_x > x - TS_ERR_RANGE && lcd_y > y - TS_ERR_RANGE && lcd_y < y + TS_ERR_RANGE) | ||
{ | ||
Buzzer_AddSound(BUZZER_FREQUENCY_HZ, BUZZER_FREQUENCY_DURATION_MS); | ||
GUI_DispStringCenter(LCD_WIDTH / 2, LCD_HEIGHT - 40, (int32_t)LABEL_ADJUST_OK); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty line before this GUI call |
||
Delay_ms(1000); | ||
} | ||
|
@@ -174,6 +175,7 @@ static inline uint8_t TS_CalibrationEnsure(uint16_t x, uint16_t y) | |
GUI_DispStringCenter(LCD_WIDTH / 2, LCD_HEIGHT - 40, (int32_t)LABEL_ADJUST_FAILED); | ||
GUI_DispDec(0, 0, lcd_x, 3, 0); | ||
GUI_DispDec(0, 20, lcd_y, 3, 0); | ||
Buzzer_AddSound(100, 200); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move the buzzer call before the first GUI call and add an empty line before the first GUI call (separate GUI call from non GUI calls, when possible) |
||
Delay_ms(1000); | ||
|
||
return 0; | ||
|
@@ -211,12 +213,13 @@ void TS_Calibrate(void) | |
GUI_DrawPoint(LCD_X[tp_num], LCD_Y[tp_num] - i); | ||
} | ||
|
||
while (TS_IsPressed() == false); | ||
|
||
while (!TS_IsPressed()); | ||
Buzzer_AddSound(BUZZER_FREQUENCY_HZ, BUZZER_FREQUENCY_DURATION_MS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty line before this buzzer call. |
||
|
||
TP_X[tp_num] = XPT2046_Repeated_Compare_AD(CMD_RDX); | ||
TP_Y[tp_num] = XPT2046_Repeated_Compare_AD(CMD_RDY); | ||
|
||
while (TS_IsPressed() != false); | ||
while (TS_IsPressed()); | ||
} | ||
|
||
K = (X1 - X3) * (Y2 - Y3) - (X2 - X3) * (Y1 - Y3); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this entire block is no more needed, remove it all (also the SMART_HOME definition and usage)