<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I looked at the log for this tools/idf_monitor.py:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">commit 797340f7f82c29c15c8f59a39856bacbd0a74d53</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Author: Roland Dobai <<a href="mailto:dobai.roland@gmail.com" class="">dobai.roland@gmail.com</a>></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Date: Mon Jun 18 12:49:04 2018 +0200</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> idf_monitor: Fix console performance</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> <a href="https://github.com/espressif/esp-idf/commit/51e42d8e925a20011bb7105da8cc3194d6940a6f" class="">https://github.com/espressif/esp-idf/commit/51e42d8e925a20011bb7105da8cc3194d6940a6f</a></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> introduced filtering options which handles the last (unterminated) line</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> with a delay. This introduced poor performance for console applications</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> when the user interacts with the ESP32 device in the same line because</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> there is an artificial delay for each key-press.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> <a href="https://github.com/espressif/esp-idf/commit/bb152030a0057c5a9a048782f917c4fa9d7b770e" class="">https://github.com/espressif/esp-idf/commit/bb152030a0057c5a9a048782f917c4fa9d7b770e</a></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> decreased the delay but there are still delays for each key-presses.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> The current fix makes only one delay per line instead of each</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> key-presses. When an unterminated line is detected then no more</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> "delayed" print is used for the given line.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> Fixes <a href="https://github.com/espressif/esp-idf/issues/2054" class="">https://github.com/espressif/esp-idf/issues/2054</a></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">commit bb152030a0057c5a9a048782f917c4fa9d7b770e</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Author: Roland Dobai <<a href="mailto:dobai.roland@gmail.com" class="">dobai.roland@gmail.com</a>></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">Date: Wed Jun 13 07:48:52 2018 +0200</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> Fix the console performance issue</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> The IDF monitor waits for one second before printing the last</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> unterminated line. This is necessary for the correct filtering.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> However, this causes poor performance, for example, in the case of the</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> system/console example.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> This fix reduces the waiting time which improves the response time of</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> the console example and doesn't seem to influence the monitor filter.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> Closes <a href="https://github.com/espressif/esp-idf/issues/2054" class="">https://github.com/espressif/esp-idf/issues/2054</a></span></font></div></div></blockquote><div class=""><div><br class=""></div><div>Then tried rolling back to the Jun 13th commit (<span style="font-family: "Andale Mono"; font-size: 14px;" class="">bb152030a0057c5a9a048782f917c4fa9d7b770e</span>), and that solved the problem for me.</div><div><br class=""></div><div>Issue is the Jun 18th commit (<span style="font-family: "Andale Mono"; font-size: 14px;" class="">797340f7f82c29c15c8f59a39856bacbd0a74d53</span>), which is:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">--- a/tools/idf_monitor.py</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">+++ b/tools/idf_monitor.py</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">@@ -393,8 +393,8 @@ class Monitor(object):</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> # default we don't touch it and just wait for the arrival of the rest</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> # of the line. But after some time when we didn't received it we need</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> # to make a decision.</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">- if self._last_line_part != b"":</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">- if self._force_line_print or (finalize_line and self._line_matcher.match(self._last_line_part)):</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">+ if finalize_line and self._last_line_part != b"":</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">+ if self._line_matcher.match(self._last_line_part):</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> self._force_line_print = True;</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> if self._output_enabled:</span></font></div><div><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""> self.console.write_bytes(self._last_line_part)</span></font></div></div></div></blockquote><div class=""><div><br class=""></div><div>(that is a reverse patch, so ‘-‘ is new, and ‘+’ is old).</div><div><br class=""></div><div>It is simple for us to reverse this in our branch, but we’re out of sync with upstream from then onwards.</div><div><br class=""></div><div>Regards, Mark.</div><div><br class=""></div><div><blockquote type="cite" class=""><div class="">On 10 Jul 2018, at 10:01 AM, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Maybe timing related? They’ve messed with things to try to avoid the ‘wait for end of line’ delay.<br class=""><br class="">Regards, Mark.<br class=""><br class=""><blockquote type="cite" class="">On 10 Jul 2018, at 9:30 AM, Stephen Casner <<a href="mailto:casner@acm.org" class="">casner@acm.org</a>> wrote:<br class=""><br class="">I don't see “Password:” overwriting “OVMS>” but I see "Secure mode"<br class="">overwriting "Password:". Since "Secure mode" is a printf, not a<br class="">write, I would expect \n to be massaged into \r\n somewhere along the<br class="">path. It can't be expected that all output strings get \r\n instead<br class="">of \n. So I have to retract my assertion of having fixed the problem.<br class=""><br class=""> -- Steve<br class=""><br class="">On Tue, 10 Jul 2018, Mark Webb-Johnson wrote:<br class=""><br class=""><blockquote type="cite" class=""><br class="">Still not working for me. I get:<br class=""><br class="">“Password:” overwriting “OVMS>” when I type “enable”.<br class="">First line of output overwrites command prompt whenever I type a command.<br class="">Pressing ENTER at “OVMS#” prompt seemingly does nothing.<br class=""><br class="">Looking through the code, we send \n, not \r\n, in multiple places (for example in ovms_command.cpp enableInsert() function that handles password entry. A ‘find in project’ for \n shows 11,350 results! Simple_monitor works just fine.<br class=""><br class="">Regards, Mark.<br class=""><br class=""><blockquote type="cite" class="">On 10 Jul 2018, at 4:35 AM, Stephen Casner <<a href="mailto:casner@acm.org" class="">casner@acm.org</a>> wrote:<br class=""><br class="">This problem of no newline is related to the somewhat tricky way I<br class="">implemented alert output being written above the current command input<br class="">line. I truncate the newline from the last or only line of an alert<br class="">message so that when it is followed by microrl putting out a new<br class="">prompt, which is preceded by a newline, we don't get a blank line.<br class=""><br class="">I've just committed a fix. The problem was that the terminal monitor<br class="">discards a newline that does not follow carriage return, and microrl's<br class="">terminal_newline() function was written to output the same string to<br class="">go to the next line as it takes for input to indicate the end of a<br class="">command. We need the input end-of-line to be just a newline<br class="">character, so that is all that terminal_newline() put out before the<br class="">prompt. My fix was to change terminal_newline() to output the<br class="">explicit string "\r\n" rather than the macro ENDL.<br class=""><br class=""> -- Steve<br class="">_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.openvehicles.com" class="">OvmsDev@lists.openvehicles.com</a><br class="">http://lists.openvehicles.com/mailman/listinfo/ovmsdev<br class=""></blockquote></blockquote>_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.openvehicles.com" class="">OvmsDev@lists.openvehicles.com</a><br class="">http://lists.openvehicles.com/mailman/listinfo/ovmsdev<br class=""></blockquote><br class="">_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.openvehicles.com" class="">OvmsDev@lists.openvehicles.com</a><br class="">http://lists.openvehicles.com/mailman/listinfo/ovmsdev<br class=""></div></div></blockquote></div><br class=""></div></body></html>