cyoung / stratux

Aviation weather and traffic receiver based on RTL-SDR.
BSD 3-Clause "New" or "Revised" License
1.06k stars 365 forks source link

cageAHRS at full speed does not level. #740

Closed ninelima closed 6 years ago

ninelima commented 6 years ago

Stratux version: v1.4r5 Stratux config: dual SDR, GPS yes (u-blox 7 GNSS), AHRS yes, battery: USB cable to cigarette lighter (ships power). EFB app and version: Kwik EFIS and Kwik DMAP. EFB platform: Android 4.4.2. EFB hardware: Nexus 7 Tablet and Samsung Galaxy S2. Description of your issue: cageAHRS.

I am having some difficulty with implementing cageAHRS. The code seems to level the Stratux AHRS when I single step through it with the debugger, but when run at full speed there seems to be no effect.

Any ideas?

'

//
// Stratux "level" attitude display. Submit a blank POST to this URL.
//
public static void cageAhrs()
{
    Log.d("bugbug ", "cageAhrs");
    return postHttp("http://192.168.10.1/cageAHRS");
}

//
// Stratux sensor calibration. Submit a blank POST to this URL.
//
private String calibrateAhrs()
{
    return postHttp("http://192.168.10.1/calibrateAHRS");
}

private String getHttp(String addr)
{
    return doHttp(addr, "GET");
}

private static String postHttp(String addr)
{
    return doHttp(addr, "POST");
}

private static String doHttp(String addr, String method)
{
    URL url;
    StringBuffer response = new StringBuffer();
    try {
        url = new URL(addr);
    }
    catch (MalformedURLException e) {
        throw new IllegalArgumentException("invalid url");
    }

    HttpURLConnection conn = null;
    try {
        conn = (HttpURLConnection) url.openConnection();
        conn.setDoOutput(false);
        conn.setDoInput(true);
        conn.setUseCaches(false);
        conn.setRequestMethod(method); //"GET"
        conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");

        // handle the response
        int status = conn.getResponseCode();
        if (status != 200) {
            throw new IOException("Post failed with error code " + status);
        }
        else {
            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        if (conn != null) {
            conn.disconnect();
        }
        //Here is your json in string format
        String responseJSON = response.toString();
        return responseJSON;
    }
}

'

ninelima commented 6 years ago

This appears to be an issue with either my development environment and/or the devices. It seems to work fine on another machine/devices.