refactor: migrate MICRO_PIP to fine-grained feature flags

Replace monolithic MICRO_PIP/PIP_MICRO with granular flags:

Feature flags (CMake options + platform auto-detection):
- PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET
- PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL

Embedded optimization flag:
- PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS)
  Controls buffer sizes, time stubs, terminal fallback, init stubs

Platform blocks in CMakeLists.txt:
- Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP)
- FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables SOCKET (no LWIP)
- Android: auto-disables PROCESS, DYNLIB, FFT

Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt.
Builds verified for Linux (547 tests pass) and Pico SDK (100%).
Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
2026-08-11 14:34:59 +03:00
parent 87c53d45a4
commit 4d8b743075
97 changed files with 1555 additions and 914 deletions
+32 -3
View File
@@ -27,7 +27,12 @@
const uint PIBaseTransfer::signature = 0x54424950;
PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
PIBaseTransfer::PIBaseTransfer()
: crc(standardCRC_16())
#ifndef PIP_NO_THREADS
, diag(false)
#endif
{
header.sig = signature;
crc_enabled = true;
header.session_id = 0;
@@ -39,12 +44,14 @@ PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
send_queue = 0;
send_up = 0;
timeout_ = 10.;
#ifndef PIP_NO_THREADS
diag.setDisconnectTimeout(PISystemTime::fromSeconds(timeout_ / 10.));
diag.setName("PIBaseTransfer");
diag.start(20_Hz);
#endif
packets_count = 10;
#ifdef MICRO_PIP
setPacketSize(512);
#ifdef PIP_EMBEDDED
setPacketSize(1024);
#else
setPacketSize(4096);
#endif
@@ -53,7 +60,9 @@ PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
PIBaseTransfer::~PIBaseTransfer() {
#ifndef PIP_NO_THREADS
diag.stopAndWait();
#endif
break_ = true;
}
@@ -85,14 +94,18 @@ void PIBaseTransfer::setPause(bool pause_) {
void PIBaseTransfer::setTimeout(double sec) {
timeout_ = sec;
#ifndef PIP_NO_THREADS
diag.setDisconnectTimeout(PISystemTime::fromSeconds(sec));
#endif
}
void PIBaseTransfer::received(PIByteArray data) {
packet_header_size = sizeof(PacketHeader) + customHeader().size();
if (data.size() < sizeof(PacketHeader)) {
#ifndef PIP_NO_THREADS
diag.received(data.size(), false);
#endif
return;
}
PacketHeader h;
@@ -100,10 +113,14 @@ void PIBaseTransfer::received(PIByteArray data) {
PacketType pt = (PacketType)h.type;
if (!h.check_sig()) {
piCoutObj << "invalid packet signature"_tr("PIBaseTransfer");
#ifndef PIP_NO_THREADS
diag.received(data.size(), false);
#endif
return;
} else
#ifndef PIP_NO_THREADS
diag.received(data.size(), true);
#endif
// piCoutObj << "receive" << h.session_id << h.type << h.id;
switch (pt) {
case pt_Unknown: break;
@@ -244,7 +261,9 @@ void PIBaseTransfer::received(PIByteArray data) {
replies.resize(sr.packets + 1);
replies.fill(pt_Unknown);
pm_string.resize(replies.size(), '-');
#ifndef PIP_NO_THREADS
diag.reset();
#endif
// piCoutObj << "receiveStarted()";
is_receiving = true;
break_ = false;
@@ -291,7 +310,9 @@ bool PIBaseTransfer::send_process() {
mutex_session.lock();
packet_header_size = sizeof(PacketHeader) + customHeader().size();
break_ = false;
#ifndef PIP_NO_THREADS
diag.reset();
#endif
sendStarted();
is_sending = true;
int session_size = session.size();
@@ -339,7 +360,9 @@ bool PIBaseTransfer::send_process() {
}
stm.reset();
ba = build_packet(i);
#ifndef PIP_NO_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
pm_string[i + 1] = '+';
mutex_send.lock();
@@ -392,7 +415,9 @@ bool PIBaseTransfer::send_process() {
continue;
}
ba = build_packet(chk - 1);
#ifndef PIP_NO_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
pm_string[chk] = '+';
mutex_send.lock();
@@ -497,7 +522,9 @@ void PIBaseTransfer::sendReply(PacketType reply) {
header.type = reply;
PIByteArray ba;
ba << header;
#ifndef PIP_NO_THREADS
if (is_sending || is_receiving) diag.sended(ba.size_s());
#endif
sendRequest(ba);
}
@@ -516,7 +543,9 @@ bool PIBaseTransfer::getStartRequest() {
state_string = "send request";
PITimeMeasurer tm;
while (tm.elapsed_s() < timeout_) {
#ifndef PIP_NO_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
if (break_) return false;
// piCoutObj << replies[0];