MKFirmware / MK4duo

MK4duo Firmware Printers 3D for Arduino and Arduino due
http://www.marlinkimbra.it
GNU General Public License v3.0
206 stars 117 forks source link

MK4duo Timer lib suspected to be a problem #800

Closed Sage1978 closed 4 years ago

Sage1978 commented 4 years ago

Issue description

lcd timeout to status time is inaccurate

define LCD_TIMEOUT_TO_STATUS 3000

After booting, enter the setting menu, and then wait for the timeout, and then wait for the timeout after entering the menu. After recording each time-out time, there will be several times of relatively short time.

After hard debugging, the problem was found, it may be the problem of the arduino compiler

//original // if (ms <= ms + period_ms) { // if ((now> = ms + period_ms) || (now <ms)) expired = true;    BUG 16bit> = 32bit ?????? //} // else if ((now> = ms + period_ms) && (now <ms)) expired = true;

// Fixed if (ms <= (T) (ms + period_ms)) {      if ((now> = (T) (ms + period_ms)) || (now <ms)) expired = true; } else if ((now> = (T) (ms + period_ms)) && (now <ms)) expired = true;

Firmware version

MK4duo's versions: V4.4.0 Arduino versions: 1.8.12 Arduino SAM BoardS V1.6.12