From f1b45d4e7f875d069380defbfd8560cb63ea3ee9 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 7 Dec 2015 15:31:01 -0800 Subject: [PATCH] Reinstate logging of ERT packets. --- firmware/application/app_ert.cpp | 11 ++++++++++- firmware/application/app_ert.hpp | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/firmware/application/app_ert.cpp b/firmware/application/app_ert.cpp index 28d91575..5996c0a0 100644 --- a/firmware/application/app_ert.cpp +++ b/firmware/application/app_ert.cpp @@ -72,6 +72,10 @@ Consumption Packet::consumption() const { return invalid_consumption; } +ManchesterFormatted Packet::symbols_formatted() const { + return format_manchester(decoder_); +} + bool Packet::crc_ok() const { if( type() == ERTPacket::Type::SCM ) { CRC ert_bch { 0x6f63 }; @@ -100,7 +104,12 @@ ERTModel::ERTModel() { log_file.open_for_append("ert.txt"); } -bool ERTModel::on_packet(const ert::Packet&) { +bool ERTModel::on_packet(const ert::Packet& packet) { + if( log_file.is_ready() ) { + const auto formatted = packet.symbols_formatted(); + log_file.write_entry(packet.received_at(), formatted.data + "/" + formatted.errors); + } + return true; } diff --git a/firmware/application/app_ert.hpp b/firmware/application/app_ert.hpp index 756e600f..1e473daa 100644 --- a/firmware/application/app_ert.hpp +++ b/firmware/application/app_ert.hpp @@ -71,6 +71,8 @@ public: ID id() const; Consumption consumption() const; + ManchesterFormatted symbols_formatted() const; + bool crc_ok() const; private: