Fixed a stupid bug

master
Mark 2022-07-21 18:07:24 -07:00
parent cbea2cd663
commit 665f0b6dae
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 7 additions and 1 deletions

View File

@ -114,9 +114,15 @@ int main(int argc, char *argv[]) {
while (1) { while (1) {
memset(hid_buf, 0, sizeof(uint8_t) * Dox.packet_size);
if (Dox.is_connected()) { if (Dox.is_connected()) {
if (std::chrono::steady_clock::now() > t + std::chrono::milliseconds(30)) { if (std::chrono::steady_clock::now() > t + std::chrono::milliseconds(30)) {
if (Dox.get_animation_mode() == 0x02) { if (Dox.get_animation_mode() == 0x02) {
// Animation data type
hid_buf[1] = CMD_ANIM_DATA_fft;
if (std::chrono::steady_clock::now() > last_fifo_sync + std::chrono::seconds(10)) { if (std::chrono::steady_clock::now() > last_fifo_sync + std::chrono::seconds(10)) {
mpd_run_disable_output(conn, 1); mpd_run_disable_output(conn, 1);
mpd_run_enable_output(conn, 1); mpd_run_enable_output(conn, 1);
@ -136,7 +142,7 @@ int main(int argc, char *argv[]) {
h = h>KB_RESOLUTION ? KB_RESOLUTION : h; h = h>KB_RESOLUTION ? KB_RESOLUTION : h;
h = h<0 ? 0 : h; h = h<0 ? 0 : h;
hid_buf[i] = h; hid_buf[i + 1] = h;
} }
Dox.write(CMD_ANIM_DATA, hid_buf, Dox.packet_size); Dox.write(CMD_ANIM_DATA, hid_buf, Dox.packet_size);
} }