Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    [MOD] Enable Traffic/Automatic day-night in Drive & Traffic in Maps

    Reply
    Page 12 of 43 | Prev | 2   10     11   12   13     14   22 | Next | Last
    mbanck | # 111 | 2012-07-12, 00:09 | Report

    So I took a look at http://en.wikipedia.org/wiki/Sunrise_equation and http://users.electromagnetic.net/bu/...unrise-set.php

    The drive-qml approximation for the declination is legit, it is equation 3 from http://solardat.uoregon.edu/SolarRadiationBasics.html

    What seems to be missing is probably a better approximation of the sun transit, i.e. the true sun noon.

    Otherwise, just some signs were apparently wrong in the sunrise/sunset calculation, with that fixed, it works well enough for me.

    This is the patch: http://paste.debian.net/download/178685

    Or inline:

    Code:
    --- /usr/lib/drive-qml/models/MapSettingsModel.qml.orig
    +++ /usr/lib/drive-qml/models/MapSettingsModel.qml
    @@ -135,8 +135,8 @@
             var lat_rad = pos.latitude * (Math.PI/180);
             var declination = (23.4*Math.PI)/180 * Math.sin(2*Math.PI * (284+dayOfTheYear)/365);
             var omega = Math.acos(-Math.tan(declination) * Math.tan(lat_rad));
    -        var sunset = 12 - (1/15) * omega * (180/Math.PI) - pos.longitude/15 + today.getTimezoneOffset()/60;
    -        var sunrise = 24  - sunset; //(1/15) * omega * (180/Math.PI) - pos.longitude/15 + today.getTimezoneOffset()/60;
    +        var sunset = 12 + (1/15) * omega * (180/Math.PI) - pos.longitude/15 - today.getTimezoneOffset()/60;
    +        var sunrise = 12  - (1/15) * omega * (180/Math.PI) - pos.longitude/15 - today.getTimezoneOffset()/60;
     
             console.log("Sunset:" + sunset);
             console.log("Sunrise:" + sunrise);

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 8 Users Say Thank You to mbanck For This Useful Post:
    godofwar424, ibrakalifa, jhwan, kskoda, MaddogG, sony123, thedead1440

     
    thedead1440 | # 112 | 2012-07-12, 04:02 | Report

    my output while patching:
    patching file MapSettingsMode.qml
    Hunk #1 FAILED at 135.
    1 out of 1 hunk FAILED -- saving rejects to file MapSettingsModel.qml.rej

    Could someone help?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nieldk | # 113 | 2012-07-12, 07:41 | Report

    Originally Posted by mbanck View Post
    So I took a look at http://en.wikipedia.org/wiki/Sunrise_equation and http://users.electromagnetic.net/bu/...unrise-set.php

    The drive-qml approximation for the declination is legit, it is equation 3 from http://solardat.uoregon.edu/SolarRadiationBasics.html

    What seems to be missing is probably a better approximation of the sun transit, i.e. the true sun noon.

    Otherwise, just some signs were apparently wrong in the sunrise/sunset calculation, with that fixed, it works well enough for me.

    This is the patch: http://paste.debian.net/download/178685

    Or inline:

    Code:
    --- /usr/lib/drive-qml/models/MapSettingsModel.qml.orig
    +++ /usr/lib/drive-qml/models/MapSettingsModel.qml
    @@ -135,8 +135,8 @@
             var lat_rad = pos.latitude * (Math.PI/180);
             var declination = (23.4*Math.PI)/180 * Math.sin(2*Math.PI * (284+dayOfTheYear)/365);
             var omega = Math.acos(-Math.tan(declination) * Math.tan(lat_rad));
    -        var sunset = 12 - (1/15) * omega * (180/Math.PI) - pos.longitude/15 + today.getTimezoneOffset()/60;
    -        var sunrise = 24  - sunset; //(1/15) * omega * (180/Math.PI) - pos.longitude/15 + today.getTimezoneOffset()/60;
    +        var sunset = 12 + (1/15) * omega * (180/Math.PI) - pos.longitude/15 - today.getTimezoneOffset()/60;
    +        var sunrise = 12  - (1/15) * omega * (180/Math.PI) - pos.longitude/15 - today.getTimezoneOffset()/60;
     
             console.log("Sunset:" + sunset);
             console.log("Sunrise:" + sunrise);
    This works very well.
    Now, what seems to be missing is that it will actually refresh the daylight settings on a scheduled basis, or at least at app start.
    ATM it seems to only change if you enter settings and press auto :0

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to For This Useful Post:
    godofwar424, MaddogG

     
    3sigma | # 114 | 2012-07-12, 07:43 | Report

    mbanck
    Good job, man. It's seems to work.

    thedead1440
    Edit it manually.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to 3sigma For This Useful Post:
    godofwar424, thedead1440

     
    nailwood | # 115 | 2012-07-12, 08:51 | Report

    When you click on the toggle item for the traffic mode in the main settings screen, you can see that the label changes to "Hide traffic" for a fraction of a second before the screen is closed - But when the settings screen is opened again, the label is still set to "Show traffic". So I found out this small UI improvement:

    In assistanceModeSettingsPage.qml, line 207 (inside the block "onBeforeShow:"), you can add the following line:

    buttonModel.updateTraffic();

    This will show the label "Hide traffic" and the corresponding icon if traffic has been activated.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 9 Users Say Thank You to nailwood For This Useful Post:
    colin.stephane, godofwar424, MaddogG, ndingaman, solstice88, sony123, thedead1440, wout.martens

     
    MaikEF | # 116 | 2012-07-12, 09:29 | Report

    i think, the better way to switch day/night is to use the lightsensor... itīs more helpfull in tunnel...
    is there a possibility to realice so?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to MaikEF For This Useful Post:
    jimthefly

     
    jimthefly | # 117 | 2012-07-12, 10:20 | Report

    I would also prefer a solution in help of the light sensor. I think this is a better way to switch between day and night.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    MaddogG | # 118 | 2012-07-12, 10:28 | Report

    Originally Posted by MaikEF View Post
    i think, the better way to switch day/night is to use the lightsensor... itīs more helpfull in tunnel...
    is there a possibility to realice so?
    Originally Posted by jimthefly View Post
    I would also prefer a solution in help of the light sensor. I think this is a better way to switch between day and night.
    See previous page (here)...

    Edit | Forward | Quote | Quick Reply | Thanks

     
    godofwar424 | # 119 | 2012-07-12, 10:51 | Report

    Until we find a way to sort of loop the isNght function so it checks every so often, the Light Sensor won't work efficiently as it will only check the light sensor on start-up and then set the map colours accordingly and then stop checking light sensor.

    We need a way of it to keep checking either light sensor or comparing the current time to the Sunset/Sunrise to make it truly automatic switching.

    Probably what the plugin they were missing was meant to do!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    colin.stephane | # 120 | 2012-07-12, 11:50 | Report

    Originally Posted by nailwood View Post
    When you click on the toggle item for the traffic mode in the main settings screen, you can see that the label changes to "Hide traffic" for a fraction of a second before the screen is closed - But when the settings screen is opened again, the label is still set to "Show traffic". So I found out this small UI improvement:

    In assistanceModeSettingsPage.qml, line 207 (inside the block "onBeforeShow:"), you can add the following line:

    buttonModel.updateTraffic();

    This will show the label "Hide traffic" and the corresponding icon if traffic has been activated.
    Thanks for this perspicuous Fix, I like guys verifying behavior of modifications.

    Now, the button to switch traffic on/off be refreshed properly ...

    Also, I have reread all the thread, but not be able to find how to add the "auto" tick option, there is only the 2 original options "day" & "night" tick options.

    If someone have the modification, feel free to put it here ...

    A++

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 12 of 43 | Prev | 2   10     11   12   13     14   22 | Next | Last
vBulletin® Version 3.8.8
Normal Logout