mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: commit favorite only once SETMY is fully on air
The favorite was persisted as soon as the long My press was queued. A flush or radio reconfiguration could drop or cut it short and the app kept a favorite the motor never stored. The radio task now reports finished/aborted for every job. Setting a favorite goes through sendSetMy, which commits it on finished and puts the previous one back otherwise. The new favorite is set before the My is sent so the simulation no longer heads for the old one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a45dba37a
commit
352f36e478
2 changed files with 72 additions and 21 deletions
10
src/Somfy.h
10
src/Somfy.h
|
|
@ -224,6 +224,8 @@ struct somfy_tx_job_t {
|
|||
};
|
||||
enum class tx_event_t : uint8_t {
|
||||
started, // The job is going on air.
|
||||
finished, // Every frame of the job went on air.
|
||||
aborted, // The job was cut short by a flush or a radio reconfiguration.
|
||||
dropped // The job was flushed and will never go on air.
|
||||
};
|
||||
// Reported by the radio task for every queued non-repeater job.
|
||||
|
|
@ -331,7 +333,13 @@ class SomfyShade : public SomfyRemote {
|
|||
uint32_t txStopAt = 0;
|
||||
int8_t txStopDir = 0;
|
||||
bool txStopTilt = false;
|
||||
// Command telling the motor to store the favorite. The favorite is only
|
||||
// committed once all of it is on air and restored if it never is.
|
||||
uint32_t txMySeq = 0;
|
||||
float txMyOldPos = -1.0f;
|
||||
float txMyOldTiltPos = -1.0f;
|
||||
bool sendStop(int8_t dir, bool tilt);
|
||||
bool sendSetMy(uint16_t delayMs, float oldPos, float oldTiltPos);
|
||||
void runToLimit(int8_t dir, bool tilt, uint32_t since);
|
||||
public:
|
||||
uint8_t roomId = 0;
|
||||
|
|
@ -545,7 +553,7 @@ class Transceiver {
|
|||
bool _received = false;
|
||||
somfy_frame_t frame;
|
||||
void startTxTask();
|
||||
void transmitJob(somfy_tx_job_t &job);
|
||||
bool transmitJob(somfy_tx_job_t &job);
|
||||
public:
|
||||
transceiver_config_t config;
|
||||
bool printBuffer = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue