From 2c9131f19713a97dc741e9edc01067081bf9fbb9 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 20 Nov 2022 20:48:53 -0800 Subject: [PATCH] Cleanup --- src/config.h | 74 +++++++++++++++++++++++------------ src/main.cpp | 6 --- src/modules/special_chars.hpp | 4 ++ src/modules/visualizer.cpp | 6 ++- 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/config.h b/src/config.h index b7d58a0..248f70a 100644 --- a/src/config.h +++ b/src/config.h @@ -1,6 +1,22 @@ #pragma once +/* + General Setup +*/ + +// USB device params +#define HID_VENDOR_ID 0x3297 +#define HID_PRODUCT_ID 0x4976 +#define HID_USAGE 0x61 +#define HID_USAGE_PAGE 0xFF60 + +// USB packet size, in bytes. +// Usually 32, but depends on keyboard. +#define RAW_EPSIZE 32 + +// How many milliseconds to wait between reconnect attempts +#define RECONNECT_SLEEP_MS 500 // Keyboard layers. // These must have the same indices as @@ -29,33 +45,41 @@ enum layer_layout_ids { #define LOOP_SLEEP_MS 20 -//#define DISABLE_SPELL -#define HUNSPELL_AFF_EN "/usr/share/hunspell/en_US.aff" -#define HUNSPELL_DIC_EN "/usr/share/hunspell/en_US.dic" -// USB device params -#define HID_VENDOR_ID 0x3297 -#define HID_PRODUCT_ID 0x4976 -#define HID_USAGE 0x61 -#define HID_USAGE_PAGE 0xFF60 + +/* + Autotype Special Characters +*/ +//#define DISABLE_SPECIAL_CHAR + + + +/* + Spellcheck +*/ +#define DISABLE_SPELL +#ifndef DISABLE_SPELL + #define HUNSPELL_AFF_EN "/usr/share/hunspell/en_US.aff" + #define HUNSPELL_DIC_EN "/usr/share/hunspell/en_US.dic" +#endif + + + +/* + Music Visualizer Animation +*/ #define DISABLE_VISUALIZER +#ifndef DISABLE_VISUALIZER + // How many keys in a column * resolution per key. + // this MUST fit inside a uint8_t (i.e, <= 255). + #define KB_RESOLUTION (5 * 50) -// USB packet size, in bytes. -// Usually 32, but depends on keyboard. -#define RAW_EPSIZE 32 + // How many resolution steps to skip at the top and bottom. + #define BOTTOM_SKIP 100 + #define TOP_SKIP 0 -// How many milliseconds to wait between reconnect attempts -#define RECONNECT_SLEEP_MS 500 - -// How many keys in a column * resolution per key. -// this MUST fit inside a uint8_t (i.e, <= 255). -#define KB_RESOLUTION (5 * 50) - -// How many resolution steps to skip at the top and bottom. -#define BOTTOM_SKIP 100 -#define TOP_SKIP 0 - -// Spectrum visualizer range -#define MIN_HZ 100 -#define MAX_HZ 5000 \ No newline at end of file + // Spectrum visualizer range + #define MIN_HZ 100 + #define MAX_HZ 5000 +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 31cf31c..8faab46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,12 +59,6 @@ // pcm from pulse - -// buffer size for waveform: -// (44100 / fps * 10), make 10 bigger for slower scrolling -// -// Double both buffer sizes if stereo - // HID interface wrapper Ergodox Dox = Ergodox::init( HID_VENDOR_ID, diff --git a/src/modules/special_chars.hpp b/src/modules/special_chars.hpp index 617ddef..1e02197 100644 --- a/src/modules/special_chars.hpp +++ b/src/modules/special_chars.hpp @@ -7,6 +7,10 @@ namespace SpecialChars { const std::string special_chars[] = { + + // These characters are used to type + // symbols on layouts that don't have + // them. "\\`", "~", "'", diff --git a/src/modules/visualizer.cpp b/src/modules/visualizer.cpp index 5907320..48b3920 100644 --- a/src/modules/visualizer.cpp +++ b/src/modules/visualizer.cpp @@ -19,7 +19,11 @@ namespace Visualizer { std::chrono::nanoseconds > last_fifo_sync; - Buffer buf = Buffer( + // buffer size for waveform: + // (44100 / fps * 10), make 10 bigger for slower scrolling + // + // Double both buffer sizes if stereo + Buffer buf = Buffer( "/tmp/mpd.fifo", 44100 / 2, // Keep 500ms of data in buffer fft.compute_buffer_output_size()