ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
magiquest_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
4
5#include <cinttypes>
6
7/* Based on protocol analysis from
8 * https://arduino-irremote.github.io/Arduino-IRremote/ir__MagiQuest_8hpp_source.html
9 */
10
11namespace esphome::remote_base {
12
13// Older decoders read the wand id 5 bits too early, so ids in older configs lack its 5 low bits.
14static constexpr uint8_t MAGIQUEST_LEGACY_WAND_ID_SHIFT = 5;
15
17 uint16_t magnitude;
19
20 // Not symmetric: `this` is the decoded frame and `rhs` the configured match. A configured wand_id of 0 matches
21 // any wand. Magnitude is not compared; it appears to encode the cast type rather than a strength. The legacy
22 // match applies to every configured id, so an id below 2^26 also matches the 32 wands whose full id shifts to it.
23 bool operator==(const MagiQuestData &rhs) const {
24 return rhs.wand_id == 0 || rhs.wand_id == this->wand_id ||
25 rhs.wand_id == (this->wand_id >> MAGIQUEST_LEGACY_WAND_ID_SHIFT);
26 }
27};
28
29class MagiQuestProtocol : public RemoteProtocol<MagiQuestData> {
30 public:
31 void encode(RemoteTransmitData *dst, const MagiQuestData &data);
32 optional<MagiQuestData> decode(RemoteReceiveData src);
33 void dump(const MagiQuestData &data);
34};
35
36DECLARE_REMOTE_PROTOCOL(MagiQuest)
37
38} // namespace esphome::remote_base
optional< MagiQuestData > decode(RemoteReceiveData src)
void dump(const MagiQuestData &data)
void encode(RemoteTransmitData *dst, const MagiQuestData &data)
const void * src
Definition hal.h:68
static void uint32_t
bool operator==(const MagiQuestData &rhs) const