diff options
author | OLFDB <olf@eisenzelt.de> | 2021-03-05 05:17:01 +0100 |
---|---|---|
committer | OLFDB <olf@eisenzelt.de> | 2021-03-05 05:17:01 +0100 |
commit | 0f150a640e4afec7a021e51315775d463d94112f (patch) | |
tree | 61db55a8144fbe3080221bdc7adc01461baaacc8 | |
parent | 0c8b35b210ffaa27d883699e2e191f7768b100b6 (diff) | |
download | navit-0f150a640e4afec7a021e51315775d463d94112f.tar.gz |
Using tracking->tunnel
-rw-r--r-- | navit/navit.c | 38 | ||||
-rw-r--r-- | navit/track.c | 60 | ||||
-rw-r--r-- | navit/track.h | 60 | ||||
-rw-r--r-- | navit/vehicle/gpsd/vehicle_gpsd.c | 8 |
4 files changed, 86 insertions, 80 deletions
diff --git a/navit/navit.c b/navit/navit.c index 52ee513aa..99c64ea17 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -3494,6 +3494,27 @@ void navit_layout_switch(struct navit *n) { if (n->auto_switch == FALSE) return; + if (n->tracking->tunnel) { + // We are in a tunnel and if we have a nightlayout -> switch to nightlayout + if (l->nightname) { + navit_set_layout_by_name(n, l->nightname); + dbg(lvl_debug, "tunnel -> nightlayout"); + return; + } else { + // We are already in nightmode, no matter of the sun + return; + } + } else { + if (l->dayname) { + navit_set_layout_by_name(n, l->dayname); + dbg(lvl_debug, "tunnel end -> daylayout"); + return; + } else { + // We are already in nightmode, no matter of the sun + return; + } + } + if (currTs-(n->prevTs)<60) { //We've have to wait a little return; @@ -3511,23 +3532,6 @@ void navit_layout_switch(struct navit *n) { return; } - if (streetflags != NULL) { - - dbg(lvl_debug, "streetflags: %i", *streetflags); - - if (*streetflags & AF_UNDERGROUND) { - // We are in a tunnel and if we have a nightlayout -> switch to nightlayout - if (l->nightname) { - navit_set_layout_by_name(n, l->nightname); - dbg(lvl_debug, "tunnel nightlayout"); - return; - } else { - // We are already in nightmode, no matter of the sun - return; - } - } - } - //We calculate sunrise anyway, cause it is needed both for day and for night if (__sunriset__(year,month,day,geo_attr.u.coord_geo->lng,geo_attr.u.coord_geo->lat,-5,1,&trise,&tset)!=0) { dbg(lvl_debug,"near the pole sun never rises/sets, so we should never switch profiles"); diff --git a/navit/track.c b/navit/track.c index 70b89c6fc..fafefef22 100644 --- a/navit/track.c +++ b/navit/track.c @@ -61,66 +61,6 @@ struct cdf_speed { time_t time; }; -/** - * @brief Contains data for the CDF - * - * This structure holds all data needed by the - * cumulative displacement filter. - */ -struct cdf_data { - int extrapolating; - int available; - int first_pos; - int poscount; - int hist_size; - struct cdf_speed *speed_hist; - struct pcoord *pos_hist; - int *dir_hist; - double last_dist; - struct pcoord last_out; - int last_dir; -}; - -struct tracking { - NAVIT_OBJECT - struct callback_list *callback_list; - struct mapset *ms; - struct route *rt; - struct map *map; - struct vehicle *vehicle; - struct vehicleprofile *vehicleprofile; - struct coord last_updated; - struct tracking_line *lines; - struct tracking_line *curr_line; - int pos; - struct coord curr[2], curr_in, curr_out; - int curr_angle; - struct coord last[2], last_in, last_out; - struct cdf_data cdf; - struct attr *attr; - int valid; - int time; - double direction, direction_matched; - double speed; - int coord_geo_valid; - struct coord_geo coord_geo; - enum projection pro; - int street_direction; - int no_gps; - int tunnel; - int angle_pref; - int connected_pref; - int nostop_pref; - int offroad_limit_pref; - int route_pref; - int overspeed_pref; - int overspeed_percent_pref; - int tunnel_extrapolation; -}; - - - - static void tracking_init_cdf(struct cdf_data *cdf, int hist_size) { cdf->extrapolating = 0; cdf->available = 0; diff --git a/navit/track.h b/navit/track.h index 928ef4b00..fd214b7c6 100644 --- a/navit/track.h +++ b/navit/track.h @@ -20,9 +20,69 @@ #ifndef NAVIT_TRACK_H #define NAVIT_TRACK_H #include <time.h> +#include "xmlconfig.h" +#include "coord.h" #ifdef __cplusplus extern "C" { #endif + +/** + * @brief Contains data for the CDF + * + * This structure holds all data needed by the + * cumulative displacement filter. + */ +struct cdf_data { + int extrapolating; + int available; + int first_pos; + int poscount; + int hist_size; + struct cdf_speed *speed_hist; + struct pcoord *pos_hist; + int *dir_hist; + double last_dist; + struct pcoord last_out; + int last_dir; +}; + +struct tracking { + NAVIT_OBJECT + struct callback_list *callback_list; + struct mapset *ms; + struct route *rt; + struct map *map; + struct vehicle *vehicle; + struct vehicleprofile *vehicleprofile; + struct coord last_updated; + struct tracking_line *lines; + struct tracking_line *curr_line; + int pos; + struct coord curr[2], curr_in, curr_out; + int curr_angle; + struct coord last[2], last_in, last_out; + struct cdf_data cdf; + struct attr *attr; + int valid; + int time; + double direction, direction_matched; + double speed; + int coord_geo_valid; + struct coord_geo coord_geo; + enum projection pro; + int street_direction; + int no_gps; + int tunnel; + int angle_pref; + int connected_pref; + int nostop_pref; + int offroad_limit_pref; + int route_pref; + int overspeed_pref; + int overspeed_percent_pref; + int tunnel_extrapolation; +}; + /* prototypes */ enum attr_type; enum projection; diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index f7324d24c..01810bf5c 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -25,6 +25,7 @@ #include <gpsbt.h> #include <errno.h> #endif +#include "config.h" #include "debug.h" #include "callback.h" #include "plugin.h" @@ -207,9 +208,10 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, data->set &= ~LATLON_SET; } // If data->fix.speed is NAN, then the drawing gets jumpy. - if (! isnan(data->fix.speed) && priv->fix_type > 0) { - callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); - } + //if (! isnan(data->fix.speed) && priv->fix_type > 0) { + + callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); + dbg(lvl_info,"speed ok"); } |