a lot of thread housekeeping. Switch them off when not needed / disabled.

This commit is contained in:
Thomas Göttgens
2022-12-29 15:45:49 +01:00
parent 1a949b7ca6
commit 41a1dfec79
15 changed files with 102 additions and 59 deletions

View File

@@ -139,6 +139,8 @@ AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP),
DEBUG_MSG(" using %d frames of %d bytes for a total payload length of %d bytes\n", encode_frame_num, encode_codec_size, encode_frame_size);
xTaskCreate(&run_codec2, "codec2_task", 30000, NULL, 5, &codec2HandlerTask);
} else {
setInterval(INT32_MAX);
enabled = false;
DEBUG_MSG("Codec2 disabled (AudioModule %d, Region %s, permitted %d)\n", moduleConfig.audio.codec2_enabled, myRegion->name, myRegion->audioPermitted);
}
}
@@ -259,6 +261,7 @@ int32_t AudioModule::runOnce()
return 100;
} else {
DEBUG_MSG("Audio Module Disabled\n");
enabled = false;
return INT32_MAX;
}

View File

@@ -82,6 +82,7 @@ int32_t RangeTestModule::runOnce()
return (senderHeartbeat);
} else {
enabled = false;
return (INT32_MAX);
// This thread does not need to run as a receiver
}
@@ -94,6 +95,7 @@ int32_t RangeTestModule::runOnce()
}
#endif
enabled = false;
return (INT32_MAX);
}

View File

@@ -52,6 +52,7 @@ int32_t StoreForwardModule::runOnce()
return (this->packetTimeMax);
}
#endif
enabled = false; // Client doesn't need periodical
return (INT32_MAX);
}
@@ -458,6 +459,9 @@ StoreForwardModule::StoreForwardModule()
is_client = true;
DEBUG_MSG("*** Initializing Store & Forward Module in Client mode\n");
}
} else {
setInterval(INT32_MAX);
enabled = false;
}
#endif
}