Commit 1378f8f3 authored by Martin Cífka's avatar Martin Cífka
Browse files

Added "Turn-off WiFi" toggle & RTC sync

parent 20e535aa
Loading
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
#!/bin/sh
set -e

output=$(wpa_cli all_sta 2>/dev/null)
count=$(echo $output | grep -E "^..:..:..:..:..:.." | wc -l)
echo connected devices: $count
echo

SendToRTOS net_ready 0
echo net_ready $?

for i in $(seq $counter); do
    SendToRTOS wifi_connected
    echo wifi_connected $?
done

return 0
+1.02 KiB (9.39 MiB)

File changed.

No diff preview for this file type.

+3 −3
Original line number Diff line number Diff line
@@ -146,15 +146,15 @@
                        </table></td>
                <tbody></table>
                
                <!--<table id="wsFormTable2">
                <table id="wsFormTable2">
                    <tr>
                        <td><label for="checkboxWifiOff">Turn off Wifi when shooting<br> timelapse above 1 minute</label></td>
                        <td><label class="switch">
                        <td style="padding-left: 15px;"><label class="switch">
                            <input id="checkboxWifiOff" type="checkbox" name="wifiOff" disabled><span class="slider"></span>
                            </label>
                        </td>
                    </tr>
                </table>-->
                </table>
                
                <button type="button" id="buttonShoot" onclick="wsFormSubmit();" name="cmd" value="SHOOT" disabled>Shoot!</button>
            </form>
+22 −9
Original line number Diff line number Diff line
@@ -26,6 +26,18 @@ function waitFor(conditionFunction) {
  return new Promise(poll);
}

function getDateTime()
{
    var date = new Date();
    return  date.getFullYear() +'-'+
    ('0' + (date.getMonth()+1)).slice(-2) +'-'+
    ('0' + date.getDate()).slice(-2) +'-'+
    ('0' + date.getHours()).slice(-2) +'-'+
    ('0' + date.getMinutes()).slice(-2) +'-'+
    ('0' + date.getSeconds()).slice(-2) +'-'+
    (date.getDay()+1); //sunday=1, monday=2 ...
}




@@ -152,6 +164,7 @@ function setState(newState)
                //DISCONNECTED -> READY
                case State.DISCONNECTED:
                    notify("Connected!", false, 1000);
                    ws.send('{"cmd":"RTC_SYNC","param":"' + getDateTime() + '"}');
                    break;
                    
                //SHOOTING -> READY
@@ -182,9 +195,9 @@ function setState(newState)

function wsDisconnect()
{
    /*if (document.getElementById("checkboxWifiOff").checked)
    if (document.getElementById("checkboxWifiOff").checked)
        ws.send('{"cmd":"WIFI_OFF"}');
    document.getElementById("checkboxWifiOff").disabled = true;*/
    document.getElementById("checkboxWifiOff").disabled = true;
    
    ws.close(1000, "disconnected by user");
    connected = false;
@@ -223,8 +236,8 @@ function wsFormSubmit()

function turnOffAppClick()
{
    /*if (document.getElementById("checkboxWifiOff").checked)
        ws.send('{"cmd":"WIFI_OFF"}');*/
    if (document.getElementById("checkboxWifiOff").checked)
        ws.send('{"cmd":"WIFI_OFF"}');
    ws.send('{"cmd":"APP_OFF"}');
    wsDisconnect();
}
@@ -295,14 +308,14 @@ function wsFormToJson() {
    {
        json["timelapseCount"] = 0;
        json["timelapseInterval"] = 0;
        //json["wifiOff"] = false;
        json["wifiOff"] = false;
    }
    
    /*else
    else
    {
        if (json["timelapseInterval"] * json["timelapseCount"] < 60)
        if (json["timelapseInterval"] * (json["timelapseCount"]-1) < 60)
            json["wifiOff"] = false;
    }*/
    }
    
    delete json[""]
    return json;
+4 −2
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@ public:
    {
        GetToken = 257,
        DropToken = 258,
        QuerySessionHolder = 1793,

        GetWifiStatus = 1542,
        WifiStart = 1541,
        WifiStop = 1540,

@@ -36,8 +38,8 @@ public:

        GetCameraSettings = 4364,
        GetCameraState = 4362,
        SyncRTC = 6147,
        
        QuerySessionHolder = 1793,

        PowerOff = 6155,
        GetSetAutoPowerOff = 6151,
Loading