diff --git a/html/console.js b/html/console.js
index 355c797..8694a61 100644
--- a/html/console.js
+++ b/html/console.js
@@ -33,3 +33,40 @@ function updateText(resp) {
function retryLoad(repeat) {
fetchText(1000, repeat);
}
+
+//===== Console page
+
+function showRate(rate) {
+ rates.forEach(function(r) {
+ var el = $("#"+r+"-button");
+ el.className = el.className.replace(" button-selected", "");
+ });
+
+ var el = $("#"+rate+"-button");
+ if (el != null) el.className += " button-selected";
+}
+
+function baudButton(baud) {
+ $("#baud-btns").appendChild(m(
+ ' '+baud+''));
+
+ $("#"+baud+"-button").addEventListener("click", function(e) {
+ e.preventDefault();
+ ajaxSpin('POST', "/console/baud?rate="+baud,
+ function(resp) { showNotification("" + baud + " baud set"); showRate(baud); },
+ function(s, st) { showWarning("Error setting baud rate: " + st); }
+ );
+ });
+}
+
+//===== Log page
+
+function showDbgMode(mode) {
+ var btns = $('.dbg-btn');
+ for (var i=0; i < btns.length; i++) {
+ if (btns[i].id === "dbg-"+mode)
+ addClass(btns[i], "button-selected");
+ else
+ removeClass(btns[i], "button-selected");
+ }
+}
diff --git a/html/log.html b/html/log.html
index 717e48c..46ec785 100644
--- a/html/log.html
+++ b/html/log.html
@@ -4,15 +4,17 @@
+
The debug log shows the most recent characters printed by the esp-link software itself to
+ its own debug log.
-
-
- The debug log shows the most recent characters printed by the esp-link software itself to
- its own debug log.
+
+ Refresh
+
+
+ UART debug log:
+ auto
+ off
+ on
@@ -30,6 +32,17 @@
e.preventDefault();
fetchText(100, false);
});
+
+ ["auto", "off", "on"].forEach(function(mode) {
+ bnd($('#dbg-'+mode), "click", function(el) {
+ ajaxJsonSpin('POST', "/log/dbg?mode="+mode,
+ function(data) { showNotification("UART mode " + data.mode); showDbgMode(data.mode); },
+ function(s, st) { showWarning("Error setting UART mode: " + st); }
+ );
+ });
+ });
+
+ ajaxJson('GET', "/log/dbg", function(data) { showDbgMode(data.mode); }, function() {});
});