Added support for configurable logging on the ESP32 platform. (#10)

Because the ESP-IDF supports [runtime log level control](https://docs.espressif.com/projects/esp-idf/en/v5.5.2/esp32s3/api-reference/system/log.html#log-level-control), SystemK required some tweak to take full advantage of this.

This PR makes the following changes to SystemK:
- On the ESP32 platform, the highest logging level *compiled in* to the app is now controlable by Kconfig, as "SystemK maximum log level".
- [Protocols.c](272618d49d/Protocols/Protocols.c) was refactored, and the `DEBUG_PACKET_[EN/DE]CODE` #defines were renamed to make it clear that they now only apply to the PSoC platform.
- Some decoding warnings in the Test Protocol were downgraded to debug, since they were a nuisance most of the time.

Co-authored-by: Joe Kearney <joe@clubk.club>
Reviewed-on: #10
This commit is contained in:
Joe Kearney 2026-01-10 22:25:50 +00:00
parent f80cb59828
commit c4350ebd27
5 changed files with 75 additions and 29 deletions

View file

@ -3,7 +3,7 @@
*
* 🛡 <https://ktag.clubk.club> 🃞
*
* Copyright © 2016-2025 Joseph P. Kearney and the KTag developers.
* Copyright © 2016-2026 Joseph P. Kearney and the KTag developers.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
@ -118,12 +118,12 @@ DecodedPacket_T *TEST_MaybeDecodePacket(TimedPulseTrain_T *packet)
if (packet->bitstream[index].duration < (expected_pulse_duration_in_us - TEST_TOLERANCE_IN_us))
{
KLOG_WARN(KLOG_TAG, "Pulse %u is too short! Expected %lu; received %u.", index, expected_pulse_duration_in_us, packet->bitstream[index].duration);
KLOG_DEBUG(KLOG_TAG, "Pulse %u is too short! Expected %lu; received %u.", index, expected_pulse_duration_in_us, packet->bitstream[index].duration);
return NULL;
}
if (packet->bitstream[index].duration > (expected_pulse_duration_in_us + TEST_TOLERANCE_IN_us))
{
KLOG_WARN(KLOG_TAG, "Pulse %u is too long! Expected %lu; received %u.", index, expected_pulse_duration_in_us, packet->bitstream[index].duration);
KLOG_DEBUG(KLOG_TAG, "Pulse %u is too long! Expected %lu; received %u.", index, expected_pulse_duration_in_us, packet->bitstream[index].duration);
return NULL;
}
}