mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-23 23:38:02 +00:00
Move packet timestamping into baseband.
Now reads the RTC peripheral at the end of each received packet. TODO: Improve resolution to milliseconds or better. TODO: Work back from end of packet to compute timestamp for beginning of packet. TODO: Reuse ChibiOS RTC code, which isn't used now because ChibiOS on M0 core is responsible for RTC configuration, and including ChibiOS RTC API on M4 will also try to initialize/manage the peripheral.
This commit is contained in:
@@ -120,9 +120,7 @@ void AISView::on_show() {
|
||||
message_map.register_handler(Message::ID::AISPacket,
|
||||
[this](Message* const p) {
|
||||
const auto message = static_cast<const AISPacketMessage*>(p);
|
||||
rtc::RTC datetime;
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
const ais::Packet packet { datetime, message->packet };
|
||||
const ais::Packet packet { message->packet };
|
||||
if( this->model.on_packet(packet) ) {
|
||||
this->on_packet(packet);
|
||||
}
|
||||
|
@@ -26,9 +26,6 @@ using namespace portapack;
|
||||
|
||||
#include "manchester.hpp"
|
||||
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
|
||||
#include "crc.hpp"
|
||||
#include "string_format.hpp"
|
||||
|
||||
@@ -61,9 +58,7 @@ void ERTView::on_show() {
|
||||
message_map.register_handler(Message::ID::ERTPacket,
|
||||
[this](Message* const p) {
|
||||
const auto message = static_cast<const ERTPacketMessage*>(p);
|
||||
rtc::RTC datetime;
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
const ert::Packet packet { datetime, message->type, message->packet };
|
||||
const ert::Packet packet { message->type, message->packet };
|
||||
if( this->model.on_packet(packet) ) {
|
||||
this->on_packet(packet);
|
||||
}
|
||||
|
@@ -26,9 +26,6 @@ using namespace portapack;
|
||||
|
||||
#include "string_format.hpp"
|
||||
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
|
||||
TPMSModel::TPMSModel() {
|
||||
receiver_model.set_baseband_configuration({
|
||||
.mode = 5,
|
||||
@@ -41,9 +38,6 @@ TPMSModel::TPMSModel() {
|
||||
}
|
||||
|
||||
ManchesterFormatted TPMSModel::on_packet(const TPMSPacketMessage& message) {
|
||||
rtc::RTC received_at;
|
||||
rtcGetTime(&RTCD1, &received_at);
|
||||
|
||||
const ManchesterDecoder decoder(message.packet, 1);
|
||||
const auto hex_formatted = format_manchester(decoder);
|
||||
|
||||
@@ -53,7 +47,7 @@ ManchesterFormatted TPMSModel::on_packet(const TPMSPacketMessage& message) {
|
||||
const auto tuning_frequency_str = to_string_dec_uint(tuning_frequency, 10);
|
||||
|
||||
std::string entry = tuning_frequency_str + " FSK 38.4 19.2 " + hex_formatted.data + "/" + hex_formatted.errors;
|
||||
log_file.write_entry(received_at, entry);
|
||||
log_file.write_entry(message.packet.timestamp(), entry);
|
||||
}
|
||||
|
||||
return hex_formatted;
|
||||
|
Reference in New Issue
Block a user