From 4dd689ba9a6b3859f63ee5a74a2103f1f69af588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 26 Jun 2022 14:11:02 +0000 Subject: [PATCH] Fix PFW-1357 (#35) lcd_encoder_diff would be set to 0 if lcd_update_enable(true) is called outside ReportErrorHookMonitor This would put enc_dif out of sync with lcd_encoder_diff and could cause false rotation triggering --- Firmware/mmu2_reporting.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 5290ec966..4622703b2 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -100,7 +100,14 @@ extern void ReportErrorHookSensorLineRender() static uint8_t ReportErrorHookMonitor(uint8_t ei) { uint8_t ret = 0; bool two_choices = false; - static int8_t enc_dif = 0; + static int8_t enc_dif = lcd_encoder_diff; + + if (lcd_encoder_diff == 0) + { + // lcd_update_enable(true) was called outside ReportErrorHookMonitor + // It will set lcd_encoder_diff to 0, sync enc_dif + enc_dif = 0; + } // Read and determine what operations should be shown on the menu const uint8_t button_operation = PrusaErrorButtons(ei);