Commit 6def4550 authored by Martin Cífka's avatar Martin Cífka
Browse files

Simplified "Turn-off WiFi" logic

parent 7f46f35c
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,4 +8,4 @@ sleep 5
# Enable for ftp (user root, no password):          
# t ipc rpc clnt exec2 'tcpsvd -vE 0.0.0.0 21 ftpd -w &'

t ipc rpc clnt exec2 '/tmp/SD0/miphoto/miphoto-start.sh &'
t ipc rpc clnt exec2 '/tmp/SD0/miphoto/start.sh &'
−1.73 KiB (9.38 MiB)

File changed.

No diff preview for this file type.

+17 −12
Original line number Diff line number Diff line
@@ -19,6 +19,19 @@
            <span class="flex">
                <input type="button" id="buttonConnect"  onclick="buttonConnectClick()" value="Connect">
                <input type="button" id="buttonTurnOffApp" onclick="turnOffAppClick()" value="Release camera" disabled>
                <button type="button" id="buttonWifiOff" onclick="turnWifiOffClick()" value="Wifi" disabled="">
                    <svg version="1.1" class="svgIcon" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" width="31.182px" height="31.182px">
                        <g transform="matrix(1.8627 0 0 1.8627 -69.733 -186.54)">
                        <g transform="translate(-71.93 -10.414)">
                        <path transform="scale(.26458)" d="m515.09 531.45c-14.575-0.0288-29.162 5.538-40.512 16.867-2.8222 2.822-2.8222 7.3127 0 10.135 2.822 2.8222 7.3127 2.8222 10.135 0v-8e-3c16.767-16.737 43.976-16.572 60.576 0v8e-3c2.822 2.8222 7.3127 2.8222 10.135 0 2.8222-2.822 2.8222-7.3128 0-10.135-11.228-11.207-25.759-16.837-40.334-16.867z" stroke-width="0"/>
                        <path transform="scale(.26458)" d="m515.15 491.36c-24.777-0.0499-49.587 9.4278-68.857 28.664-2.8212 2.8219-2.8212 7.3129 0 10.135 2.822 2.8222 7.3128 2.8222 10.135 0 32.749-32.69 84.726-32.358 117.14 0 2.822 2.8222 7.3127 2.8222 10.135 0 2.8195-2.8201 2.816-7.3068 0-10.129-19.067-19.032-43.778-28.62-68.555-28.67z" stroke-width="0"/>
                        <path transform="scale(.26458)" d="m515 451.49c-35.035 0-70.046 13.386-96.938 40.203l-0.0391 0.043-0.0156 8e-3c-2e-3 4e-3 2e-3 6e-3 0 8e-3 -2.817 2.8223-2.8205 7.3008 0 10.121v8e-3c2.822 2.8222 7.3147 2.8222 10.137 0l8e-3 -8e-3 0.82617-0.82813h0.1836c48.172-47.081 124.9-46.878 172.69 0.82813l6e-3 8e-3c2.822 2.8222 7.3068 2.8222 10.129 0v-8e-3c2.8222-2.822 2.8222-7.3069 0-10.129-26.897-26.846-61.936-40.254-96.99-40.254z" stroke-width="0"/>
                        <rect transform="rotate(-45)" x="-15.939" y="203.03" width="5.6127" height="5.6127" ry="2.8063" stroke-width=".18815"/>
                        <path d="m126.21 154.92c-0.44748 0.95962-0.0448 2.063 0.9188 2.5123 0.96364 0.44935 2.0695 0.0494 2.517-0.91018l17.916-38.422c0.44749-0.95963 0.043-2.0638-0.92065-2.5132-0.96365-0.44936-2.0677-0.0486-2.5151 0.91105z" stroke-width="0"/>
                        </g>
                        </g>
                    </svg>
                </button>
                <button type="button" id="buttonPowerOff" onclick="powerOffClick()" value="Power off" disabled>
                    <svg version="1.1" class="svgIcon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="31.182px" height="31.182px" viewBox="0 0 31.182 31.182">
                        <path d="M15.591,16.089c-0.781,0-1.417-0.635-1.417-1.417V3.074c0-0.783,0.636-1.418,1.417-1.418c0.783,0,1.418,0.635,1.418,1.418 v11.598C17.009,15.454,16.374,16.089,15.591,16.089z"/>
@@ -123,8 +136,10 @@
                            </tr><tr>
                                <td><label for="timelapseIntervalSelect">Interval:</label></td>
                                <td><select id="timelapseIntervalSelect" name="timelapseInterval" disabled>
                                    <option value="5">5 s</option>
                                    <option value="10">10 s</option>
                                    <option value="30">30 s</option>
                                    <option value="20">20 s</option>
                                    <option value="30" selected="selected">30 s</option>
                                    <option value="60">1 min</option>
                                    <option value="120">2 min</option>
                                    <option value="180">3 min</option>
@@ -140,22 +155,12 @@
                                
                            </tr><tr>
                                <td><label for="timelapseCount">Count:</label></td>
                                <td><input type="number" value="2" min="2" id="timelapseCount" name="timelapseCount" disabled></td>
                                <td><input type="number" value="4" min="2" id="timelapseCount" name="timelapseCount" disabled></td>
                                
                            </tr>
                        </table></td>
                <tbody></table>
                
                <table id="wsFormTable2">
                    <tr>
                        <td><label for="checkboxWifiOff">Turn off Wi-Fi when shooting<br> timelapse above 1 minute</label></td>
                        <td style="padding-left: 15px;"><label class="switch">
                            <input id="checkboxWifiOff" type="checkbox" name="wifiOff" disabled><span class="slider"></span>
                            </label>
                        </td>
                    </tr>
                </table>
                
                <button type="button" id="buttonShoot" onclick="wsFormSubmit();" name="cmd" value="SHOOT" disabled>Shoot!</button>
            </form>
            
+11 −12
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ function setState(newState)
        {
            document.getElementById("buttonConnect").value = "Connect";
            document.getElementById("buttonShoot").innerHTML = "Shoot!";
            document.getElementById("buttonWifiOff").disabled = true;
            disabled = true;
            
            switch(currentState)
@@ -136,6 +137,7 @@ function setState(newState)
        {
            document.getElementById("buttonConnect").value = "Disconnect";
            document.getElementById("buttonShoot").innerHTML = "Stop shooting!";
            document.getElementById("buttonWifiOff").disabled = false;
            disabled = true;
            
            switch(currentState)
@@ -157,6 +159,7 @@ function setState(newState)
        {
            document.getElementById("buttonConnect").value = "Disconnect";
            document.getElementById("buttonShoot").innerHTML = "Shoot!";
            document.getElementById("buttonWifiOff").disabled = false;
            disabled = false;
            
            switch(currentState)
@@ -187,6 +190,7 @@ function setState(newState)
    document.getElementById("buttonTurnOffApp").disabled = disabled;
    document.getElementById("buttonPowerOff").disabled = disabled;
    

    if (newState === State.SHOOTING)
        document.getElementById("buttonShoot").disabled = false;

@@ -195,9 +199,6 @@ function setState(newState)

function wsDisconnect()
{
    if (document.getElementById("checkboxWifiOff").checked)
        ws.send('{"cmd":"WIFI_OFF"}');
    document.getElementById("checkboxWifiOff").disabled = true;
    
    ws.close(1000, "disconnected by user");
    connected = false;
@@ -234,10 +235,15 @@ function wsFormSubmit()
    }
}

function turnOffAppClick()

function turnWifiOffClick()
{
    if (document.getElementById("checkboxWifiOff").checked)
    ws.send('{"cmd":"WIFI_OFF"}');
    setState(State.DISCONNECTED);
}

function turnOffAppClick()
{
    ws.send('{"cmd":"APP_OFF"}');
    wsDisconnect();
}
@@ -310,13 +316,6 @@ function wsFormToJson() {
    {
        json["timelapseCount"] = 0;
        json["timelapseInterval"] = 0;
        json["wifiOff"] = false;
    }
    
    else
    {
        if (json["timelapseInterval"] * (json["timelapseCount"]-1) < 60)
            json["wifiOff"] = false;
    }
    
    delete json[""]
Loading