View Issue Details

IDProjectCategoryView StatusLast Update
0038243FPCRTLpublic2020-12-22 06:13
ReporterChristo Crause Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038243: Xtensa [patch] ESP8266 read function is non-blocking
DescriptionWhen trying to wait for user input on the default serial input, read returns immediately. If no character is available in the serial buffer, a #0 is returned. This is because the low level function uart_rx_one_char is apparently non-blocking. One way to fix this is to convert the ReadChar function in esp8266.pp to loop until a non-zero character is returned. This fix has been implemented in the attached patch.

Not sure if this loop should be moved to the console unit to make it more general...
TagsNo tags attached.
Fixed in Revision47832
FPCOldBugId
FPCTarget-
Attached Files

Activities

Christo Crause

2020-12-21 21:05

reporter  

esp8266.patch (512 bytes)   
Index: rtl/freertos/xtensa/esp8266.pp
===================================================================
--- rtl/freertos/xtensa/esp8266.pp	(revision 47785)
+++ rtl/freertos/xtensa/esp8266.pp	(working copy)
@@ -81,7 +81,11 @@
       begin
         ReadChar := true;
         ACh := #0;
-        uart_rx_one_char(@ACh);  // check failure?
+        repeat
+          uart_rx_one_char(@ACh);  // check failure?
+          if ACh = #0 then
+            vTaskDelay(1);
+        until ACh <> #0;
       end;
 
 begin
esp8266.patch (512 bytes)   

Florian

2020-12-21 22:43

administrator   ~0127751

Thanks, applied.

Christo Crause

2020-12-22 06:13

reporter   ~0127755

Thanks Florian.

Issue History

Date Modified Username Field Change
2020-12-21 21:05 Christo Crause New Issue
2020-12-21 21:05 Christo Crause File Added: esp8266.patch
2020-12-21 22:43 Florian Assigned To => Florian
2020-12-21 22:43 Florian Status new => resolved
2020-12-21 22:43 Florian Resolution open => fixed
2020-12-21 22:43 Florian Fixed in Version => 3.3.1
2020-12-21 22:43 Florian Fixed in Revision => 47832
2020-12-21 22:43 Florian FPCTarget => -
2020-12-21 22:43 Florian Note Added: 0127751
2020-12-22 06:13 Christo Crause Status resolved => closed
2020-12-22 06:13 Christo Crause Note Added: 0127755