mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 09:58:23 +08:00
[messages] add INFO_MSG and print it to GCS console
Uses a separate string_of_chars function for now to convert the char array from ivy (e.g. |i,n,f,o, ,m,s,g|) to normal string to nicely write to console and messages app. Proper solution would be to write char arrays as normal "quoted string" to the ivy bus.
This commit is contained in:
@@ -164,6 +164,18 @@ let rec string_of_value = function
|
||||
| String s -> s
|
||||
| Array a -> "|"^(String.concat separator (Array.to_list (Array.map string_of_value a)))^"|"
|
||||
|
||||
let rec string_of_chars = function
|
||||
Int x -> string_of_int x
|
||||
| Float x -> string_of_float x
|
||||
| Int32 x -> Int32.to_string x
|
||||
| Int64 x -> Int64.to_string x
|
||||
| Char c -> String.make 1 c
|
||||
| String s -> s
|
||||
| Array a -> let vl = Array.to_list (Array.map string_of_chars a) in
|
||||
match a.(0) with
|
||||
Char x -> String.concat "" vl
|
||||
| _ -> "|"^(String.concat separator vl)^"|"
|
||||
|
||||
|
||||
let magic = fun x -> (Obj.magic x:('a,'b,'c) Pervasives.format)
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ val is_fixed_array_type : string -> bool
|
||||
|
||||
val size_of_field : field -> int
|
||||
val string_of_value : value -> string
|
||||
val string_of_chars : value -> string
|
||||
val formatted_string_of_value : 'a -> value -> string
|
||||
val int_of_value : value -> int (* May raise Invalid_argument *)
|
||||
type type_descr = {
|
||||
|
||||
Reference in New Issue
Block a user