瀏覽代碼

www: börja konfigurera ABC-bussfunktioner; lite www-infrastruktur

Början till sida för att konfigurera ABC-bussfunktioner (till att
börja med: nätverksserver). Lite www-infrastruktur för att förenkla
översättningar.
H. Peter Anvin 2 年之前
父節點
當前提交
dd1fd76fce
共有 13 個文件被更改,包括 195 次插入95 次删除
  1. 2 1
      esp32/max80/config.c
  2. 二進制
      esp32/output/max80.ino.bin
  3. 52 0
      esp32/www/abcbus.html
  4. 8 47
      esp32/www/config.html
  5. 1 0
      esp32/www/head.html
  6. 31 22
      esp32/www/lang/sv
  7. 41 3
      esp32/www/max80.css
  8. 1 1
      esp32/www/max80.js
  9. 21 21
      esp32/www/status.html
  10. 38 0
      esp32/www/tz.js
  11. 0 0
      esp32/www/tzlist
  12. 二進制
      fpga/output/v1.fw
  13. 二進制
      fpga/output/v2.fw

+ 2 - 1
esp32/max80/config.c

@@ -15,7 +15,8 @@ static const struct env_var default_config[] = {
     {"tzname", "Europe/Stockholm"},
     {"hostname", "max80"},
     {"sntp.enabled", "1"},
-    {"sntp.server","time.max80.abc80.org"}
+    {"sntp.server","time.max80.abc80.org"},
+    {"abc.hosttype","auto"}
 };
 
 static int save_config(void);

二進制
esp32/output/max80.ino.bin


+ 52 - 0
esp32/www/abcbus.html

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <link rel="stylesheet" href="max80.css" />
+    <title class="abcbus">MAX80: ABC Bus</title>
+  <script src="max80.js"></script>
+  </head>
+  <body>
+    <x-inc src="head.html"></x-inc>
+    <h1 class="abcbus">ABC Bus</h1>
+    <div class="wip"><p>This section is a work in progress...</p></div>
+    <form id="abcconfig" class="setconfig" action="sys/setconfig" method="post"
+	  onsubmit="uploadform()" data-ref="10" data-ref-url="abcbus.html">
+      <fieldset class="abchost">
+	<legend>Host system</legend>
+	<div class="radio">
+	  <b>Host system type</b>
+	  <div>
+	    <label class="auto">
+	      <input type="radio" name="abc.hosttype" value="auto" />
+	      <span>Autodetect</span>
+	    </label>
+	    <label class="abc80">
+	      <input type="radio" name="abc.hosttype" value="abc80" />
+	      <span>ABC80</span>
+	    </label>
+	    <label class="abc800">
+	      <input type="radio" name="abc.hosttype" value="abc800" />
+	      <span>ABC800</span>
+	    </label>
+	  </div>
+	</div>
+	<p class="help">Autodetection can fail in some type
+	of expansion boxes, possibly depending on jumpering.</p>
+      </fieldset>
+      <fieldset class="pun80">
+	<legend>Network</legend>
+	<label class="serv">
+	  <b>ABC (PUN80) network server</b>
+	  <input type="text" class="host" name="abc.netserv.addr" />
+	  <span class="sep">:</span>
+	  <input type="text" class="port" name="abc.netserv.port" placeholder="4680" />
+	</label>
+	<p class="help">The network server software is integrated
+	  with <a href="http://www.abc80.org/pub/abc80/abc80sim/">abc80sim</a>
+	  version 3.7.0 or later.</p>
+      </fieldset>
+      <button class="submit" type="submit" disabled>Update configuration</button>
+    </form>
+    <script>loadform('abcconfig','sys/getconfig');</script>
+  </body>
+</html>

+ 8 - 47
esp32/www/config.html

@@ -8,16 +8,16 @@
   <body>
     <x-inc src="head.html"></x-inc>
     <h1 class="config">Configuration</h1>
-    <form id="setconfig" action="sys/setconfig" method="post"
+    <form id="setconfig" class="setconfig" action="sys/setconfig" method="post"
 	  onsubmit="uploadform()" data-ref="10" data-ref-url="status.html">
       <fieldset class="network">
 	<legend>Network</legend>
 	<label class="wifi-ssid">
-	  <span>Network name (SSID):</span>
+	  <b>Network name (SSID)</b>
 	  <input type="text" name="wifi.ssid" />
 	</label>
 	<label class="wifi-psk">
-	  <span>Network password (PSK):</span>
+	  <b>Network password (PSK)</b>
 	  <input class="mono" type="password" autocomplete="off" name="wifi.psk" />
 	  <button type="button" class="show" onclick="showpwd()"><span class="show">Show</span><span class="hide">Hide</span></button>
 	</label>
@@ -25,21 +25,21 @@
       <fieldset class="datetime">
 	<legend>Date and Time</legend>
 	<label class="tz">
-	  <span>Time zone:</span>
+	  <b>Time zone</b>
 	  <select name="tzname" id="tzname" onchange="tzn()">
 	  </select>
 	  <input type="text" name="TZ" oninput="tzt()" />
 	</label>
 	<label class="sntp-enabled">
-	  <span>Synchronize time from network:</span>
+	  <b>Synchronize time from network</b>
 	  <input type="checkbox" name="sntp.enabled" />
 	</label>
 	<label class="sntp-server">
-	  <span>NTP server:</span>
+	  <b>NTP server</b>
 	  <input type="text" name="sntp.server" />
 	</label>
 	<label class="ip4-dhcp-sntp">
-	  <span>Use DHCP-provided NTP server:</span>
+	  <b>Use DHCP-provided NTP server</b>
 	  <input type="checkbox" name="ip4.dhcp.nosntp" value="0" />
 	</label>
       </fieldset>
@@ -47,45 +47,6 @@
       <br />
       <output></output>
     </form>
-    <script>
-      function tzn() {
-	  const tz = event.target.selectedOptions[0].dataset.tz;
-	  if (tz) sib(event.target,'input').value = tz;
-      }
-      function tzt() { sib(event.target,'select').value = ''; }
-
-      fetchconfig('tz.txt')
-          .then(map => {
-	      function cln(z) {
-		  return ('tz/'+z).replaceAll('/','_ ')
-		      .replaceAll(/[^\w ]+/g,'-');
-	      }
-	      var elem = getelem('tzname');
-	      var grp = elem;
-	      map.set('',''); map.set('UTC','UTC0');
-	      var zones = Array.from(map.keys());
-	      zones = zones.filter(v => v && v != 'UTC').sort();
-	      zones.unshift('','UTC');
-	      for (const z of zones) {
-		  const zz = z.match(/^(?:(\S+?)\/)?(\S*)$/,z);
-		  if (!zz) { continue; }
-		  if (zz[1] && zz[1] != grp.label) {
-		      grp = document.createElement('OPTGROUP');
-		      grp.label = zz[1];
-		      grp.className = cln(zz[1]);
-		      elem.append(grp);
-		  } else if (!zz[1]) {
-		      grp = elem;
-		  }
-		  const pz = zz[2].replaceAll('_',' ').replaceAll('/',': ');
-		  var opt = new Option(pz, z);
-		  opt.className = cln(z);
-		  opt.dataset.tz = map.get(z);
-		  grp.append(opt);
-	      }
-	      translate(elem);
-	  })
-          .finally(() => {loadform('setconfig','sys/getconfig');} );
-    </script>
+    <script src="tz.js"></script>
   </body>
 </html>

+ 1 - 0
esp32/www/head.html

@@ -6,6 +6,7 @@
 
 <nav class="navbar" role="navigation">
   <a href="status.html" class="text status">Status</a>
+  <a href="abcbus.html" class="text abcbus">ABC Bus</a>
   <a href="config.html" class="text config">Configuration</a>
   <a href="update.html" class="text update">Update</a>
   <span class="pad"></span>

+ 31 - 22
esp32/www/lang/sv

@@ -1,21 +1,24 @@
 LANG=sv
 body .status=Status
+body .abcbus=ABC-buss
 body .config=Konfiguration
 body .update=Uppdatera
 title.status=MAX80: Status
+title.abcbus=MAX80: ABC-buss
 title.config=MAX80: Konfiguration
 title.update=MAX80: Uppdatera
 .fw legend=Mjukvara
 .network legend=Nätverk
-.wifi-ssid span=Nätverksnamn (SSID):
-.wifi-psk span=Lösenord (PSK):
+.wifi-ssid b=Nätverksnamn (SSID)
+.wifi-psk b=Lösenord (PSK)
 .datetime legend=Datum och tid
-.tz span=Tidszon:
-.sntp-enabled span=Synkronisera tid från nätet (NTP):
-.sntp-server span=NTP-server:
-.ip4-dhcp-sntp span=Använd NTP-server från DHCP:
-#setconfig .submit=Konfigurera
+.tz b=Tidszon
+.sntp-enabled b=Synkronisera tid från nätet (NTP)
+.sntp-server b=NTP-server
+.ip4-dhcp-sntp b=Använd NTP-server från DHCP
+.setconfig .submit=Konfigurera
 .notyet=(jobbar på det)
+.wip p=Under konstruktion — funktionalitet begränsad
 button .show=Visa
 button .hide=Göm
 .onerr h3=Förslag till felsökning
@@ -26,20 +29,26 @@ button .hide=Göm
 .onerr .console=Se serieport för mer detaljerad status
 .wifi-sta legend=Wifi-klient (normal)
 .wifi-ap legend=Wifi-accesspunkt (backup)
-.hw .ver span=Hårdvaruversion:
-.fw .ver span=Mjukvaruversion:
-.fw .date span=Commitdatum:
-.fw .commit span=Commit-ID:
-.fpgaok span=FPGA aktiv:
-.net-connected span=Ansluten:
-.net-connected-clients span=Anslutna klienter:
-.wifi-ap .net-connected span=Aktiv:
-.net-mac span=MAC-adress:
-.net-ip4 span=IP-adress:
-.net-ip4-mask span=Nätmask:
-.net-ip4-gw span=Router:
-.sntp-sync span=Klockan i synk med NTP:
-.localtime span=Systemklocka:
+.hw .ver b=Hårdvaruversion
+.fw .ver b=Mjukvaruversion
+.fw .date b=Commitdatum
+.fw .commit b=Commit-ID
+.fpgaok b=FPGA aktiv
+.net-connected b=Ansluten
+.net-connected-clients b=Anslutna klienter
+.wifi-ap .net-connected b=Aktiv
+.net-mac b=MAC-adress
+.net-ip4 b=IP-adress
+.net-ip4-mask b=Nätmask
+.net-ip4-gw b=Router
+.sntp-sync b=Klockan i synk med NTP
+.localtime b=Systemklocka
 .refresh legend=Statusuppdatering
-.refresh label span:first-child=Intervall:
+.refresh b=Intervall
 button.fromfile=Uppdatera från fil
+.abchost legend=ABC-system
+.abchost b=Typ av ABC-system
+.abchost label.auto span=Auto
+.abchost .help=Autodetektering kan misslyckas i vissa typer av expansionslådor m.m., möjligen beroende på jumpring.
+.pun80 .serv b=Nätverksserver (PUN80)
+.pun80 .help=Nätverksservern är integrerad i <a href="http://www.abc80.org/pub/abc80sim/">abc80sim</a> version 3.7.0 eller senare.

+ 41 - 3
esp32/www/max80.css

@@ -11,7 +11,7 @@ body {
     background: #e6c185;
     font-family: "arial", "helvetica", "sans-serif";
 }
-.mono, pre, output, tt, code {
+.mono, pre, output, tt, code, samp {
     font-family: "source code pro", "monospace";
 }
 div.title {
@@ -81,17 +81,35 @@ form fieldset legend {
     padding: 0.25em;
     background: #af9365;
 }
-form label {
+fieldset > div, fieldset > label {
     margin: 0;
     padding: 0.5ch;
     display: flex;
 }
-form label span:first-child {
+fieldset > p {
+    font-style: italic;
+    font-size: 90%;
+    margin: 0 0 0 33ch;
+    padding: 0.5em 0.5ch;
+}
+fieldset b {
+    /* Abusing <b> as a kind of superlabel tag */
     width: 30ch;
+    font-weight: normal;
+}
+fieldset b::after {
+    content: ":";
+}
+fieldset span.sep {
+    padding: 0 0.5ch;
 }
 input[type='text'], input[type='password'] {
     flex: 1;
 }
+input.port {
+    flex: 0.2;
+    width: 8ch;
+}
 .tz select {
     padding: 0;
     margin: 0 0 0 1px;
@@ -155,3 +173,23 @@ output {
     border: 0;
     opacity: 1;
 }
+.wip {
+    width: 80%;
+    margin: 2em auto;
+    border: 10px solid #e00000;
+    padding: 10px 50px;
+    font-weight: 600;
+    font-style: italic;
+    text-align: center;
+    font-size: 110%;
+    min-height: 80px;
+    background-color: #f0c000;
+    background-image: url("wip.png");
+    background-repeat: no-repeat;
+    background-position: 20px 50%;
+    display: flex;
+    align-items: center;
+}
+.wip p {
+    flex: 1;
+}

+ 1 - 1
esp32/www/max80.js

@@ -75,7 +75,7 @@ function initform(form,map,ro = false) {
 	    if (e.type == 'checkbox') {
 		e.checked = cfgbool(val) == cfgbool(e.value);
 	    } else if (e.type == 'radio') {
-		e.checked = (val == e.name);
+		e.checked = (val == e.value);
 	    } else {
 		e.value = val;
 	    }

+ 21 - 21
esp32/www/status.html

@@ -30,102 +30,102 @@
       <fieldset class="hw">
 	<legend>MAX80</legend>
 	<label class="ver">
-	  <span>Hardware version:</span>
+	  <b>Hardware version</b>
 	  <input type="text" name="max80.hw.ver" />
 	</label>
 	<label class="fpgaok">
-	  <span>FPGA online:</span>
+	  <b>FPGA online</b>
 	  <input type="checkbox" name="max80.fpga" />
 	</label>
       </fieldset>
       <fieldset class="fw">
 	<legend>Firmware</legend>
 	<label class="ver">
-	  <span>Firmware version:</span>
+	  <b>Firmware version</b>
 	  <input type="text" name="COMMIT_VERSION" />
 	</label>
 	<label class="date">
-	  <span>Firmware commit date:</span>
+	  <b>Firmware commit date</b>
 	  <input type="text" name="COMMIT_DATE" />
 	</label>
 	<label class="commit">
-	  <span>Firmware commit ID:</span>
+	  <b>Firmware commit ID</b>
 	  <input type="text" name="COMMIT_ID" />
 	</label>
       </fieldset>
       <fieldset class="wifi-sta">
 	<legend>Wifi Client</legend>
 	<label class="net-connected">
-	  <span>Connected:</span>
+	  <b>Connected</b>
 	  <input type="checkbox" name="net.sta.conn" />
 	</label>
 	<label class="wifi-ssid">
-	  <span>Network name (SSID):</span>
+	  <b>Network name (SSID)</b>
 	  <input type="text" name="net.sta.ssid" />
 	</label>
 	<label class="net-mac">
-	  <span>MAC address:</span>
+	  <b>MAC address</b>
 	  <input type="text" name="net.sta.mac" />
 	</label>
 	<label class="net-ip4">
-	  <span>IP address:</span>
+	  <b>IP address</b>
 	  <input type="text" name="net.sta.ip4" />
 	</label>
 	<label class="net-ip4-mask">
-	  <span>Netmask:</span>
+	  <b>Netmask</b>
 	  <input type="text" name="net.sta.ip4.mask" />
 	</label>
 	<label class="net-ip4-gw">
-	  <span>Gateway:</span>
+	  <b>Gateway</b>
 	  <input type="text" name="net.sta.ip4.gw" />
 	</label>
       </fieldset>
       <fieldset class="wifi-ap">
 	<legend>Wifi Access Point</legend>
 	<label class="net-connected">
-	  <span>Active:</span>
+	  <b>Active</b>
 	  <input type="checkbox" name="net.ap.conn" />
 	</label>
 	<label class="wifi-ssid">
-	  <span>Network name (SSID):</span>
+	  <b>Network name (SSID)</b>
 	  <input type="text" name="net.ap.ssid" />
 	</label>
 	<label class="net-mac">
-	  <span>MAC address:</span>
+	  <b>MAC address</b>
 	  <input type="text" name="net.ap.mac" />
 	</label>
 	<label class="net-ip4">
-	  <span>IP address:</span>
+	  <b>IP address</b>
 	  <input type="text" name="net.ap.ip4" />
 	</label>
 	<label class="net-ip4-mask">
-	  <span>Netmask:</span>
+	  <b>Netmask</b>
 	  <input type="text" name="net.ap.ip4.mask" />
 	</label>
 	<label class="net-connected-clients">
-	  <span>Connected clients:</span>
+	  <b>Connected clients</b>
 	  <input type="text" name="net.ap.clients" />
 	</label>
       </fieldset>
       <fieldset class="datetime">
 	<legend>Date and Time</legend>
 	<label class="localtime">
-	  <span>Current date and time:</span>
+	  <b>Current date and time</b>
 	  <input type="text" name="localtime" />
 	</label>
 	<label class="sntp-server">
-	  <span>NTP server:</span>
+	  <b>NTP server</b>
 	  <input type="text" name="net.sntp.server" />
 	</label>
 	<label class="sntp-sync">
-	  <span>Time synchronized:</span>
+	  <b>Time synchronized</b>
 	  <input type="checkbox" name="net.sntp.sync" />
 	</label>
       </fieldset>
       <fieldset class="refresh">
 	<legend>Status refresh</legend>
 	<label class="refresh">
-	  <span>Refresh interval:</span>
+	  <b>Refresh interval</b>
 	  <input class="noro" id="refresh_time" type="number"
 		 name="http.status.refresh" value="10" step="1" min="2"
 		 onchange="ref_status(true)" />&nbsp;s

+ 38 - 0
esp32/www/tz.js

@@ -0,0 +1,38 @@
+function tzn() {
+    const tz = event.target.selectedOptions[0].dataset.tz;
+    if (tz) sib(event.target,'input').value = tz;
+}
+function tzt() { sib(event.target,'select').value = ''; }
+
+fetchconfig('tzlist')
+    .then(map => {
+	function cln(z) {
+	    return ('tz/'+z).replaceAll('/','_ ')
+		.replaceAll(/[^\w ]+/g,'-');
+	}
+	var elem = getelem('tzname');
+	var grp = elem;
+	map.set('',''); map.set('UTC','UTC0');
+	var zones = Array.from(map.keys());
+	zones = zones.filter(v => v && v != 'UTC').sort();
+	zones.unshift('','UTC');
+	for (const z of zones) {
+	    const zz = z.match(/^(?:(\S+?)\/)?(\S*)$/,z);
+	    if (!zz) { continue; }
+	    if (zz[1] && zz[1] != grp.label) {
+		grp = document.createElement('OPTGROUP');
+		grp.label = zz[1];
+		grp.className = cln(zz[1]);
+		elem.append(grp);
+	    } else if (!zz[1]) {
+		grp = elem;
+	    }
+	    const pz = zz[2].replaceAll('_',' ').replaceAll('/',': ');
+	    var opt = new Option(pz, z);
+	    opt.className = cln(z);
+	    opt.dataset.tz = map.get(z);
+	    grp.append(opt);
+	}
+	translate(elem);
+    })
+    .finally(() => {loadform('setconfig','sys/getconfig');} );

+ 0 - 0
esp32/www/tz.txt → esp32/www/tzlist


二進制
fpga/output/v1.fw


二進制
fpga/output/v2.fw