Display all the antenna information on the front page (#1028)

This commit is contained in:
Tim Wilkinson 2023-12-17 21:33:27 -08:00 committed by GitHub
parent cc5c7cafd0
commit 7e9137417e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 4 deletions

View File

@ -1537,7 +1537,7 @@ if wifi_enable == "1" then
if not changeh then
html.print("<tr><td align=left>Azimuth</td><td>-</td>")
else
html.print("<tr><td align=left>Azimuth</td><td><input type=text name=azimuth size=10 value='" .. azimuth .. "' title='azimuth (degrees)' /></td>")
html.print("<tr><td align=left>Azimuth</td><td><input type=text name=azimuth size=10 value='" .. azimuth .. "' title='azimuth (degrees)' /> &deg;</td>")
end
if not changea then
html.print("<td align=left>Antenna " .. antenna .. "</td>")
@ -1552,9 +1552,9 @@ if wifi_enable == "1" then
if not changeh then
html.print("</tr><tr><td align=left>Elevation</td><td>-</td>")
else
html.print("</tr><tr><td align=left>Elevation</td><td><input type=text name=elevation size=10 value='" .. elevation .. "' title='elevation above ground level (degrees)' /></td>")
html.print("</tr><tr><td align=left>Elevation</td><td><input type=text name=elevation size=10 value='" .. elevation .. "' title='elevation above ground level (degrees)' /> &deg;</td>")
end
html.print("<td align=left>Height <input type=text name=height size=10 value='" .. height .. "' title='height above ground level (feet)' /></tr>")
html.print("<td align=left>Height <input type=text name=height size=10 value='" .. height .. "' title='height above ground level (meters)' /> m</tr>")
end
html.print("<tr><td colspan=4><div id='map' style='height: 200px; display: none;'></div></td></tr><tr><td colspan=4><hr /></td></tr>")
html.print("<tr><td>Timezone </td><td><select name=time_zone_name tabindex=10>")

View File

@ -452,6 +452,18 @@ if tonumber(azimuth) then
else
azimuth = nil
end
local elevation = cursor:get("aredn", "@location[0]", "elevation")
if tonumber(elevation) then
elevation = elevation .. "&deg;"
else
elevation = nil
end
local height = cursor:get("aredn", "@location[0]", "height")
if tonumber(height) then
height = height .. "m"
else
height = nil
end
local antenna
if not wifi_disabled then
antenna = aredn.hardware.get_current_antenna(wifi_iface)
@ -459,7 +471,18 @@ if not wifi_disabled then
antenna = antenna.description
end
end
col2[#col2 + 1] = "<th align=right><nobr>firmware version:</nobr><br><nobr>model:</nobr>" .. (antenna and "<br><nobr>antenna:</nobr>" or "") .. (azimuth and "<br><nobr>azimuth:</nobr>" or "") .. "</th><td>" .. read_all("/etc/mesh-release") .. "<br>" .. (aredn.hardware.get_radio() or { name = "unknown" }).name .. "<br>" .. (antenna and antenna .. "<br>" or "") .. (azimuth or "") .. "</td>"
col2[#col2 + 1] = "<th align=right><nobr>firmware version:</nobr><br><nobr>model:</nobr><br>" ..
(antenna and "<br><nobr>antenna:</nobr>" or "") ..
(azimuth and "<br><nobr>azimuth:</nobr>" or "") ..
(elevation and "<br><nobr>elevation:</nobr>" or "") ..
(height and "<br><nobr>height:</nobr>" or "") ..
"</th><td>" ..
read_all("/etc/mesh-release") .. "<br>" .. (aredn.hardware.get_radio() or { name = "unknown" }).name .. "<br><br>" ..
(antenna and antenna .. "<br>" or "") ..
(azimuth and azimuth .. "<br>" or "") ..
(elevation and elevation .. "<br>" or "") ..
(height or "") ..
"</td>"
local sysinfo = nixio.sysinfo()
local uptime = string.format("%d:%02d", math.floor(sysinfo.uptime / 3600) % 24, math.floor(sysinfo.uptime / 60) % 60)