diff --git a/conf/messages.xml b/conf/messages.xml index 0a70f8f2b8..42c451aba9 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -11,7 +11,7 @@ alive/heartbeat message containing the MD5sum of the aircraft configuration - + diff --git a/sw/ground_segment/tmtc/aircraft.ml b/sw/ground_segment/tmtc/aircraft.ml index 0734e68392..668c219b7f 100644 --- a/sw/ground_segment/tmtc/aircraft.ml +++ b/sw/ground_segment/tmtc/aircraft.ml @@ -141,7 +141,7 @@ type aircraft = { airframe : Xml.xml; mutable pos : Latlong.geographic; mutable unix_time : float; - mutable itow : int32; (* ms *) + mutable itow : int64; (* ms *) mutable roll : float; mutable pitch : float; mutable heading : float; (* rad, CW 0=N *) @@ -201,7 +201,7 @@ let new_aircraft = fun id name fp airframe -> let svsinfo_init = Array.init gps_nb_channels (fun _ -> svinfo_init ()) in { vehicle_type = UnknownVehicleType; id = id; name = name; flight_plan = fp; airframe = airframe; pos = { Latlong.posn_lat = 0.; posn_long = 0. }; - unix_time = 0.; itow = Int32.of_int 0; + unix_time = 0.; itow = Int64.of_int 0; roll = 0.; pitch = 0.; gspeed=0.; airspeed= -1.; course = 0.; heading = 0.; alt=0.; climb=0.; agl = 0.; nav_ref = None; d_hmsl = 0.; ground_alt = 0.; diff --git a/sw/ground_segment/tmtc/aircraft.mli b/sw/ground_segment/tmtc/aircraft.mli index 67a0a0890d..0865f49fa8 100644 --- a/sw/ground_segment/tmtc/aircraft.mli +++ b/sw/ground_segment/tmtc/aircraft.mli @@ -93,7 +93,7 @@ type aircraft = { airframe : Xml.xml; mutable pos : Latlong.geographic; mutable unix_time : float; - mutable itow : int32; + mutable itow : int64; mutable roll : float; mutable pitch : float; mutable heading : float; (* rad *) diff --git a/sw/ground_segment/tmtc/fw_server.ml b/sw/ground_segment/tmtc/fw_server.ml index f9bd8c9b9f..6367f5c19c 100644 --- a/sw/ground_segment/tmtc/fw_server.ml +++ b/sw/ground_segment/tmtc/fw_server.ml @@ -110,7 +110,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> utm_zone = ivalue "utm_zone" } in a.pos <- LL.of_utm WGS84 p; a.unix_time <- LL.unix_time_of_tow (truncate (fvalue "itow" /. 1000.)); - a.itow <- Int32.of_float (fvalue "itow"); + a.itow <- Int64.of_float (fvalue "itow"); a.gspeed <- fvalue "speed" /. 100.; a.course <- norm_course ((Deg>>Rad)(fvalue "course" /. 10.)); if !heading_from_course then @@ -125,7 +125,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> let geo = make_geo_deg (float lat /. 1e7) (float lon /. 1e7) in a.pos <- geo; a.unix_time <- LL.unix_time_of_tow (truncate (fvalue "itow" /. 1000.)); - a.itow <- Int32.of_float (fvalue "itow"); + a.itow <- Int64.of_float (fvalue "itow"); a.gspeed <- fvalue "speed" /. 100.; a.course <- norm_course ((Deg>>Rad)(fvalue "course" /. 10.)); if !heading_from_course then diff --git a/sw/ground_segment/tmtc/rotorcraft_server.ml b/sw/ground_segment/tmtc/rotorcraft_server.ml index 106ea0d83b..fd8a6bd08c 100644 --- a/sw/ground_segment/tmtc/rotorcraft_server.ml +++ b/sw/ground_segment/tmtc/rotorcraft_server.ml @@ -179,7 +179,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> Wind.update ac_name a.gspeed a.course*) | "GPS_INT" -> a.unix_time <- LL.unix_time_of_tow (truncate (fvalue "tow" /. 1000.)); - a.itow <- Int32.of_float (fvalue "tow"); + a.itow <- Int64.of_float (fvalue "tow"); a.gps_Pacc <- ivalue "pacc" | "ROTORCRAFT_STATUS" -> a.vehicle_type <- Rotorcraft; diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml index baa718ede3..98f6275a1e 100644 --- a/sw/ground_segment/tmtc/server.ml +++ b/sw/ground_segment/tmtc/server.ml @@ -311,11 +311,11 @@ let send_telemetry_status = fun a -> [ "ac_id", Pprz.String id; "link_id", Pprz.String link_id; "time_since_last_msg", Pprz.Float (U.gettimeofday () -. a.last_msg_date); (* don't use rx_lost_time from LINK_REPORT so it also works in simulation *) - "rx_bytes", Pprz.Int32 (Int32.of_int link_status.rx_bytes); - "rx_msgs", Pprz.Int32 (Int32.of_int link_status.rx_msgs); + "rx_bytes", Pprz.Int64 (Int64.of_int link_status.rx_bytes); + "rx_msgs", Pprz.Int64 (Int64.of_int link_status.rx_msgs); "rx_bytes_rate", Pprz.Float link_status.rx_bytes_rate; - "tx_msgs", Pprz.Int32 (Int32.of_int link_status.tx_msgs); - "uplink_lost_time", Pprz.Int32 (Int32.of_int datalink_status.uplink_lost_time); + "tx_msgs", Pprz.Int64 (Int64.of_int link_status.tx_msgs); + "uplink_lost_time", Pprz.Int64 (Int64.of_int datalink_status.uplink_lost_time); "uplink_msgs", Pprz.Int datalink_status.uplink_msgs; "downlink_msgs", Pprz.Int datalink_status.downlink_msgs; "downlink_rate", Pprz.Int datalink_status.downlink_rate; @@ -367,7 +367,7 @@ let send_aircraft_msg = fun ac -> "lat", f ((Rad>>Deg)wgs84.posn_lat); "long", f ((Rad>>Deg) wgs84.posn_long); "unix_time", f a.unix_time; - "itow", Pprz.Int32 a.itow; + "itow", Pprz.Int64 a.itow; "speed", f a.gspeed; "airspeed", f a.airspeed; (* negative value is sent if no airspeed available *) "course", f (Geometry_2d.rad2deg a.course); @@ -388,7 +388,7 @@ let send_aircraft_msg = fun ac -> "alt", cm_of_m a.alt; "speed", cm_of_m a.gspeed; "climb", cm_of_m a.climb; - "itow", Pprz.Int32 a.itow] in + "itow", Pprz.Int64 a.itow] in Dl_Pprz.message_send my_id "ACINFO" ac_info; end; @@ -401,8 +401,8 @@ let send_aircraft_msg = fun ac -> let values = ["ac_id", Pprz.String ac; "cur_block", Pprz.Int a.cur_block; "cur_stage", Pprz.Int a.cur_stage; - "stage_time", Pprz.Int32 (Int32.of_int a.stage_time); - "block_time", Pprz.Int32 (Int32.of_int a.block_time); + "stage_time", Pprz.Int64 (Int64.of_int a.stage_time); + "block_time", Pprz.Int64 (Int64.of_int a.block_time); "target_lat", f ((Rad>>Deg)a.desired_pos.posn_lat); "target_long", f ((Rad>>Deg)a.desired_pos.posn_long); "target_alt", Pprz.Float a.desired_altitude; @@ -432,7 +432,7 @@ let send_aircraft_msg = fun ac -> let state_filter_mode = get_indexed_value state_filter_modes a.state_filter_mode and kill_mode = if a.kill_mode then "ON" else "OFF" in let values = ["ac_id", Pprz.String ac; - "flight_time", Pprz.Int32 (Int32.of_int a.flight_time); + "flight_time", Pprz.Int64 (Int64.of_int a.flight_time); "ap_mode", Pprz.String ap_mode; "gaz_mode", Pprz.String gaz_mode; "lat_mode", Pprz.String lat_mode; diff --git a/sw/lib/ocaml/pprz.ml b/sw/lib/ocaml/pprz.ml index 69ff0e4712..fb88581333 100644 --- a/sw/lib/ocaml/pprz.ml +++ b/sw/lib/ocaml/pprz.ml @@ -91,7 +91,7 @@ external sprint_int8 : string -> int -> int -> unit = "c_sprint_int8" let types = [ ("uint8", { format = "%u"; glib_type = "guint8"; inttype = "uint8_t"; size = 1; value=Int 42 }); ("uint16", { format = "%u"; glib_type = "guint16"; inttype = "uint16_t"; size = 2; value=Int 42 }); - ("uint32", { format = "%lu" ; glib_type = "guint32"; inttype = "uint32_t"; size = 4; value=Int 42 }); + ("uint32", { format = "%Lu" ; glib_type = "guint32"; inttype = "uint32_t"; size = 4; value=Int 42 }); (* uint32 should be lu, but doesn't fit into Int32 so Int64 (Lu) is used *) ("uint64", { format = "%Lu" ; glib_type = "guint64"; inttype = "uint64_t"; size = 8; value=Int 42 }); ("int8", { format = "%d"; glib_type = "gint8"; inttype = "int8_t"; size = 1; value= Int 42 }); ("int16", { format = "%d"; glib_type = "gint16"; inttype = "int16_t"; size = 2; value= Int 42 }); @@ -137,7 +137,8 @@ let length_of_fixed_array_type = fun s -> let int_of_string = fun x -> try int_of_string x with - _ -> failwith (sprintf "Pprz.int_of_string: %s" x) + _ -> try int_of_string ("0x"^x) with (* try hex format in case *) + _ -> failwith (sprintf "Pprz.int_of_string: %s" x) let rec value = fun t v -> match t with