From 2934993e513a724717ab5b64cc8dfd871ca3878e Mon Sep 17 00:00:00 2001 From: Christophe De Wagter Date: Tue, 17 Dec 2024 13:49:30 +0100 Subject: [PATCH] Compiles for CDW --- sw/logalizer/Makefile | 2 +- sw/logalizer/log2json.cpp | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/sw/logalizer/Makefile b/sw/logalizer/Makefile index bed30cee6a..5537ff4b9b 100644 --- a/sw/logalizer/Makefile +++ b/sw/logalizer/Makefile @@ -82,7 +82,7 @@ LOG2JSON_CFLAGS = -I$(LIBPPRZLINKCPPDIR)/include $(IVY_INC) -std=c++17 -fconcep LOG2JSON_LDFLAGS = -lboost_iostreams -lboost_system -lboost_filesystem -ltinyxml2 $(IVY_LDFLAGS) #$(shell pkg-config --cflags json-c) log2json: log2json.cpp $(LIBPPRZLINKCPPDIR)/lib/libpprzlink++.a @echo CC $@ - $(CXX) $(CFLAGS) $(LOG2JSON_CFLAGS) -o $@ $^ $(LOG2JSON_LDFLAGS) + $(CXX) -g -Wall $(LOG2JSON_CFLAGS) -o $@ $^ $(LOG2JSON_LDFLAGS) # Target for bytecode executable (if ocamlopt is not available) # plot : log_file.cmo gtk_export.cmo export.cmo plot.cmo diff --git a/sw/logalizer/log2json.cpp b/sw/logalizer/log2json.cpp index 4fe3be78d5..aadc5a5517 100644 --- a/sw/logalizer/log2json.cpp +++ b/sw/logalizer/log2json.cpp @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2024-2025 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + #include // for mmap #include // for is_empty #include @@ -42,8 +63,10 @@ void parse_airframe_list(tinyxml2::XMLElement *root) //using List = boost::mpl::list; + /* Generate a pprzlink message */ -pprzlink::Message get_msg(std::string name, pprzlink::MessageDictionary *dict, auto values) +pprzlink::Message get_msg(std::string name, pprzlink::MessageDictionary *dict, + auto values) { pprzlink::MessageDefinition def = dict->getDefinition(name); pprzlink::Message msg(def); @@ -186,13 +209,13 @@ int main(int argc, char *argv[]) // STAB_ATTITUDE message auto stab_attitude = [&](auto & ctx) { - auto timestamp = boost::fusion::at_c<0>(_attr(ctx)); + // auto timestamp = boost::fusion::at_c<0>(_attr(ctx)); auto ac_id = uint8_t(boost::fusion::at_c<1>(_attr(ctx))); auto values = boost::fusion::at_c<2>(_attr(ctx)); auto msg = get_msg("STAB_ATTITUDE", dict, values); msg.setSenderId(ac_id); - std::cout << " - STAB_ATTITUDE: " << timestamp << " " << msg.toString() << "\n"; + // std::cout << " - STAB_ATTITUDE: " << timestamp << " " << msg.toString() << "\n"; }; // AUTOPILOT_VERSION message