Skip to content

Commit

Permalink
Fix bitfields for Petrainer998DR
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Nov 21, 2024
1 parent 1b60a0b commit aaaff50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/radio/rmt/Petrainer998DREncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std::vector<rmt_data_t> Rmt::Petrainer998DREncoder::GetSequence(uint16_t shocker

// Payload layout: [channel:4][typeVal:4][shockerID:16][intensity:8][typeInvert:4][channelInvert:4] (40 bits)
uint64_t data
= (static_cast<uint64_t>(channel & 0xF) << 36 | static_cast<uint64_t>(typeVal & 0xF) << 32 | static_cast<uint64_t>(shockerId & 0x1FFFF) << 15 | static_cast<uint64_t>(intensity & 0x7F) << 8 | static_cast<uint64_t>(typeInvert & 0xF) << 4 | static_cast<uint64_t>(channelInvert & 0xF));
= (static_cast<uint64_t>(channel & 0xF) << 36 | static_cast<uint64_t>(typeVal & 0xF) << 32 | static_cast<uint64_t>(shockerId & 0xFFFF) << 16 | static_cast<uint64_t>(intensity & 0xFF) << 8 | static_cast<uint64_t>(typeInvert & 0xF) << 4 | static_cast<uint64_t>(channelInvert & 0xF));

std::vector<rmt_data_t> pulses;
pulses.reserve(42);
Expand Down

0 comments on commit aaaff50

Please sign in to comment.