diff --git a/.gitignore b/.gitignore index e156017..41cc7c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ docs -.vscode \ No newline at end of file +.vscode +.DS_Store \ No newline at end of file diff --git a/examples/Gravity/channel.h b/examples/Gravity/channel.h index 67eb362..0c8b21e 100644 --- a/examples/Gravity/channel.h +++ b/examples/Gravity/channel.h @@ -47,7 +47,7 @@ class Channel { void setCvSource(CvSource source) { cv_source = source; } void setCvDestination(CvDestination dest) { cv_destination = dest; } - // Getters (Get the BASE value for the UI) + // Getters (Get the BASE value for editing or cv modded value for display) int getProbability(bool withCvMod = false) const { return withCvMod ? cvmod_probability : base_probability; } int getDutyCycle(bool withCvMod = false) const { return withCvMod ? cvmod_duty_cycle : base_duty_cycle; } @@ -63,7 +63,7 @@ class Channel { /** * @brief Processes a clock tick and determines if the output should be high or low. * @param tick The current clock tick count. - * @param output The output object (or a reference to its state) to be modified. + * @param output The output object to be modified. */ void processClockTick(uint32_t tick, DigitalOutput& output) { // Use pre-calculated final values @@ -121,33 +121,24 @@ class Channel { } private: - /** - * @brief Recalculates pulse values based on current channel settings. - * Should be called whenever mod, duty cycle, or offset changes. - */ - void updatePulses() { - const uint32_t mod_pulses = clock_mod_pulses[cvmod_clock_mod_index]; - duty_cycle_pulses = max((long)((mod_pulses * (100L - cvmod_duty_cycle)) / 100L), 1L); - offset_pulses = (long)((mod_pulses * (100L - cvmod_offset)) / 100L); - } - // User-settable "base" values. byte base_clock_mod_index = 7; byte base_probability = 100; byte base_duty_cycle = 50; byte base_offset = 0; + // Base value with cv mod applied. + volatile byte cvmod_clock_mod_index; + volatile byte cvmod_probability; + volatile byte cvmod_duty_cycle; + volatile byte cvmod_offset; + int duty_cycle_pulses; int offset_pulses; // CV configuration CvSource cv_source = CV_NONE; CvDestination cv_destination = CV_DEST_NONE; - - volatile byte cvmod_clock_mod_index; - volatile byte cvmod_probability; - volatile byte cvmod_duty_cycle; - volatile byte cvmod_offset; }; #endif // CHANNEL_H \ No newline at end of file diff --git a/peripherials.h b/peripherials.h index 1864462..8f5b68d 100644 --- a/peripherials.h +++ b/peripherials.h @@ -19,7 +19,7 @@ // Peripheral input pins #define ENCODER_PIN1 17 // A3 #define ENCODER_PIN2 4 -#define ENCODER_SW_PIN 14 +#define ENCODER_SW_PIN 14 // A0 // Clock and CV Inputs #define EXT_PIN 2