maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N9 / N950 (https://talk.maemo.org/forumdisplay.php?f=51)
-   -   [MOD] Enable Traffic/Automatic day-night in Drive & Traffic in Maps (https://talk.maemo.org/showthread.php?t=85353)

Arie 2012-07-10 21:41

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Quote:

Originally Posted by Morpog (Post 1235603)
Could you do a second diff patch to add this functionality? I don't feel like adding Aries files, as they seem to be from PR1.2s Drive.

Or at least do a summary what to do.

Thanks!

The files are from PR1.3's Drive.

solstice88 2012-07-10 21:55

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Cool. confirming my previous post. It works and looks great!!

sony123 2012-07-10 22:53

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Thanks guys for confirming that automatic day/night work. I saw the comments and took the non-working status for granted....
Updated first post to include automatic mod as well, will include new patch when it's available.

sony123 2012-07-10 23:38

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Quote:

Originally Posted by Morpog (Post 1235622)
Last missing item would be the ability to touch the "distance left" to switch it to "time left". Symbians drive had that.

And traffic rerouting of course, but I doubt this is hidden in there....

I don't think there are codes for these features. But I think the first one community can implement it.

I took a look at the source code, it should be in components/Dashboard.qml. The speed and distance blocks are wrapped under AssistanceItem {}. We have speed and distance variables available so distance/speed + some decoration to beautify the output and alas we have the minutes left to destination. However, I think in GPS they do something extra to avoid erratic jumping of the value, for example smooth the speed over a certain period. Any idea on how to do the smoothing?

Traffic re-route might be tricky, I haven't looked deeper but I would think we need get info from traffic and routing models to know there is traffic event along the original route. Unless there are some ready-to-use signals to trigger re-route event....

sony123 2012-07-10 23:44

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Quote:

Originally Posted by sony123 (Post 1235697)
I don't think there are codes for these features. But I think the first one community can implement it.

I took a look at the source code, it should be in components/Dashboard.qml. The speed and distance blocks are wrapped under AssistanceItem {}. We have speed and distance variables available so distance/speed + some decoration to beautify the output and alas we have the minutes left to destination. However, I think in GPS they do something extra to avoid erratic jumping of the value, for example smooth the speed over a certain period. Any idea on how to do the smoothing?

Traffic re-route might be tricky, I haven't looked deeper but I would think we need get info from traffic and routing models to know there is traffic event along the original route. Unless there are some ready-to-use signals to trigger re-route event....

Maybe someone with Symbian devices can also try seeing if the Drive app on Symbian is written in QML. If so, then we would have a reference...

myk 2012-07-11 01:22

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
I get
Quote:

-sh: /usr/bin/patch: Operation not permitted
Problem with Aegis? Normal 755 perms.

Am seeing APT problems - related? Aegis will not let me upgrade fennec, and " cannot be authenticated! libgpg-error0 libpcap0.8 libpixman-1-0".

I tried to use the zip file linked above, but no unzip on the N9. So why use zip instead of tar?

jd4200 2012-07-11 02:13

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Patch for day/night mode has been added:
http://talk.maemo.org/showpost.php?p...1&postcount=27

Morpog 2012-07-11 06:56

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Thanks for that!

Morpog 2012-07-11 08:12

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
I applied the patch and switched to auto, but now it's at night mode and it's definately not night atm :)

Any idea?

jimthefly 2012-07-11 08:13

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Same here, only night mode.

thedead1440 2012-07-11 08:14

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
its currently 4pm here and also in night mode after switching to automatic...

godofwar424 2012-07-11 12:08

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Yeah mine stays in Night Mode and its 1:08PM here :s

slarti 2012-07-11 12:11

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Could it measure ambient light, not time?

mbanck 2012-07-11 12:16

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
The calculation of sunrise and sunset seems to be wrong.

If I start drive with "drive-qml -output-level debug" on the console, I get:


Sunset:1.4444082226241228
Sunrise:22.555591777375877
NOW: 14.2

NOW is correct (2PM here), but I am in Munich, so Sunset, Sunrise are way off.

I don't have time to debug this further for now.

Schturman 2012-07-11 12:44

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
i also already added this tweak to N9QT, to the next version..

kb61 2012-07-11 12:56

Re: [PR1.3 MOD] How to enable Traffic in Drive
 
Quote:

Originally Posted by jd4200 (Post 1234481)
Thanks sony123, a real nice find.
Here's an automated method (completely safe and reversable) to take away the tedious work.

Download this shell script, rename it to maps.sh
Download one, or both, of these patches:
traffic patch, rename it to traffic.patch
day patch, rename it to day.patch

Place maps.sh and both/either of the patches into the same directory on the N9 and, as root, cd to where you copied them and run
Code:

sh ./maps.sh
If you are told a patch has already been applied and asked about a reversal, just anser "n" (no) to all the questions.

If you want to restore the original files then, as root, run:
Code:

rm -rf /usr/lib/drive-qml
apt-get install --reinstall nokia-drive-qml


doesnt work for me, it says "line 1: syntax error: unexpected new line"

thedead1440 2012-07-11 14:21

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
did you modify the file after downloading it? it could be you've pressed the enter key on the first line of the file hence the error...this is what is my knowledge...

jd4200 2012-07-11 14:42

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Confirmed that day/night does not seem to be automatically switching; the changes for the patch where taken directly from what Nieldk and Arie discovered, so unless I've made a mistake with the patch, I'll need to wait for either of them to re-confirm it is working for them.

solstice88 2012-07-11 15:33

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by mbanck (Post 1235980)
The calculation of sunrise and sunset seems to be wrong.

If I start drive with "drive-qml -output-level debug" on the console, I get:

The numbers i seem to be getting in TX, US

Sunrise = 7.5236543734
Sunset = 16.4763456265
NOW 10.4

looks to be really close. quite possibly an hr or two off. NOW is about 10am

mbanck 2012-07-11 15:37

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Huh, the sun is setting at 4PM in Texas right now??

solstice88 2012-07-11 15:57

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by mbanck (Post 1236085)
Huh, the sun is setting at 4PM in Texas right now??

actually no sun right now nothing but rain. haha but not quite, its more like 8 pm.

my local weather tells me sunrise: 7.29am & sunset 8.24pm

Quote:

Originally Posted by jd4200 (Post 1236057)
Confirmed that day/night does not seem to be automatically switching; the changes for the patch where taken directly from what Nieldk and Arie discovered, so unless I've made a mistake with the patch, I'll need to wait for either of them to re-confirm it is working for them.

I think i might have caused a little confusion. My drive qml files codes lines has difference of 3 lines from Arie or nieldk probably from when i edit the traffic functions? I left some minor comments for reference. So its probably affecting your patch. Sorry

Arie 2012-07-11 16:10

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Automatic switching works for me. Tested last night and this morning.

jd4200 2012-07-11 16:38

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by Arie (Post 1236110)
Automatic switching works for me. Tested last night and this morning.

If you get chance would you mind posting the changes you've made. It's a bit conufsing for me going through two or so pages of testing :) thanks.

gasilva 2012-07-11 17:07

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
The traffic is available for Costa Rica:confused:

Or I'm wrong:confused:

I'm enable Traffic but the map in Drive don't showme color or indications....

godofwar424 2012-07-11 17:31

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Well using drive-qml -output-level-debug

The app starts in Night mode and the only terminal output is "setBacklightDimming(1)"

Nothing about nightmode pops up and it is set to automatic.

Using Aries files and trying to just outcomment myself.

jd4200 2012-07-11 17:33

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by godofware424
Using Aries files and trying to just outcomment myself.

Same.
I've tried using the files posted earlier, even with this it does not work for me.
I've tried switching from day/night to automatic multiple times, changing the times and reopening the application, but to no avail.

I wondering if it could be a firmware variant specific issue, or something similar.

jflatt 2012-07-11 17:50

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
I'm not getting auto switchover either, but here is how you can use the ALS, it seems to work on startup (note, forum mangled, the QML should be all one line, and the OR statement looks wrapped):
Code:

function isNight() {
    var als;
    als = Qt.createQmlObject('import QtMobility.sensors 1.2; AmbientLightSensor { }', this, null);
    als.start();
    if (als.reading.lightLevel == 1 || als.reading.lightLevel == 2) {
        als.destroy(1000);
        return true;
    }
    als.destroy(1000);
    return false;
}


nieldk 2012-07-11 18:47

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Hmm seems like there is some errors in how sunrise /sunset is calculated. Depending perhaps on timezone and /or something more.
Probably this can be fixed relatively easy. Will have a look at the isNight () function later

Z3tor 2012-07-11 19:10

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Quote:

Originally Posted by Morpog (Post 1235622)
Last missing item would be the ability to touch the "distance left" to switch it to "time left". Symbians drive had that.

And traffic rerouting of course, but I doubt this is hidden in there....

Just wondering if speed cameras could be enabled somehow too..?

godofwar424 2012-07-11 19:34

Re: [MOD] How to enable Traffic in Drive for PR1.2/1.3
 
Quote:

Originally Posted by Z3tor (Post 1236256)
Just wondering if speed cameras could be enabled somehow too..?

Been asked by myself and another earlier on, no point to keep asking the same thing. Just Thank the posts we made and then the more Thanks shows the amount of people who want the feature :D

mbanck 2012-07-12 00:09

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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);


thedead1440 2012-07-12 04:02

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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?

nieldk 2012-07-12 07:41

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by mbanck (Post 1236332)
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

3sigma 2012-07-12 07:43

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
mbanck
Good job, man. It's seems to work.

thedead1440
Edit it manually.

nailwood 2012-07-12 08:51

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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.

MaikEF 2012-07-12 09:29

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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?

jimthefly 2012-07-12 10:20

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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.

MaddogG 2012-07-12 10:28

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by MaikEF (Post 1236478)
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?

Quote:

Originally Posted by jimthefly (Post 1236497)
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)...

godofwar424 2012-07-12 10:51

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
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!

colin.stephane 2012-07-12 11:50

Re: [MOD] How to enable Traffic/Automatic day-night in Drive for PR1.2/1.3
 
Quote:

Originally Posted by nailwood (Post 1236462)
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++


All times are GMT. The time now is 04:57.

vBulletin® Version 3.8.8