mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
refactor: drop unused radio API
Transceiver::flushTx() had no caller; suspendTx() is the only flush. RadioScheduler::hasRoom() was only ever asked about a normal job, so it no longer takes a priority flag. The tests check the reserved stop slots through submit() instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0b7c57a9ab
commit
29d642b6f4
5 changed files with 12 additions and 22 deletions
|
|
@ -43,8 +43,8 @@ uint32_t RadioScheduler::submit(somfy_tx_job_t &job, bool priority, uint16_t del
|
|||
this->count++;
|
||||
return job.seq;
|
||||
}
|
||||
bool RadioScheduler::hasRoom(bool priority) const {
|
||||
return !this->suspendMask && admits(TX_JOB_QUEUE_SIZE - this->count, priority) && this->outcomesFit();
|
||||
bool RadioScheduler::hasRoom() const {
|
||||
return !this->suspendMask && admits(TX_JOB_QUEUE_SIZE - this->count, false) && this->outcomesFit();
|
||||
}
|
||||
bool RadioScheduler::outcomesFit() const {
|
||||
// Each job not yet ended reports at most two outcomes: started, then how it
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ class RadioScheduler {
|
|||
// delayMs after it was queued and after the job ahead of it ended, and holds
|
||||
// up the jobs queued behind it.
|
||||
uint32_t submit(somfy_tx_job_t &job, bool priority, uint16_t delayMs, uint32_t now);
|
||||
// Whether a job would be taken right now.
|
||||
bool hasRoom(bool priority) const;
|
||||
// Whether a normal (not priority) job would be taken right now.
|
||||
bool hasRoom() const;
|
||||
// For the radio task: takes the job to send next. False when there is
|
||||
// none due, waitMs then says how long until there is (RADIO_WAIT_FOREVER
|
||||
// when nothing waits). A job taken goes on air through start() and
|
||||
|
|
|
|||
|
|
@ -4660,15 +4660,7 @@ bool Transceiver::txHasRoom() {
|
|||
// Without a radio task submitTx() fails straight away so there is no point waiting.
|
||||
if(!txTaskHandle) return true;
|
||||
TxQueueLock lock;
|
||||
return this->sched.hasRoom(false);
|
||||
}
|
||||
void Transceiver::flushTx() {
|
||||
{
|
||||
TxQueueLock lock;
|
||||
this->sched.flush(millis());
|
||||
}
|
||||
// Stop waiting on a delayed job that is gone.
|
||||
if(txTaskHandle) xTaskNotifyGive(txTaskHandle);
|
||||
return this->sched.hasRoom();
|
||||
}
|
||||
void Transceiver::suspendTx(uint8_t reason) {
|
||||
{
|
||||
|
|
@ -4742,7 +4734,7 @@ void Transceiver::txTask(void *arg) {
|
|||
haveJob = trans->sched.next(millis(), job, waitMs);
|
||||
}
|
||||
if(haveJob) trans->runJob(job);
|
||||
// submitTx() and flushTx() wake us for a new job or a flush.
|
||||
// submitTx() and suspendTx() wake us for a new job or a flush.
|
||||
else ulTaskNotifyTake(pdTRUE, waitMs == RADIO_WAIT_FOREVER ? portMAX_DELAY : pdMS_TO_TICKS(waitMs) + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -462,7 +462,6 @@ class Transceiver {
|
|||
// Hands a job to the radio task, see RadioScheduler::submit(). Returns its
|
||||
// ticket, 0 when the radio can't take it. Safe from any task.
|
||||
uint32_t submitTx(somfy_tx_job_t &job, bool priority = false, uint16_t delayMs = 0);
|
||||
void flushTx();
|
||||
void suspendTx(uint8_t reason);
|
||||
void resumeTx(uint8_t reason);
|
||||
bool txSuspended();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue