Commit Graph

26 Commits

Author SHA1 Message Date
b8cdd97261 Merge branch 'main' of https://git.pinkduck.xyz/adam/libGravity 2025-07-04 10:44:08 -07:00
ae726313a0 use shift button to change channel when held + rotate. 2025-07-04 10:44:03 -07:00
14aad8285d Introduce Save/Load banks for storing different preset settings. (#11)
This also includes a lot of minor fixes.

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/11
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-07-04 17:33:57 +00:00
d2228af55f bug fix: must have curly braces when declaring new variables inside CASE statement. 2025-07-04 08:22:25 -07:00
d21c0a810f Add more clock mult/div options and improve documentation to make it easier to modify the list. 2025-07-03 09:12:15 -07:00
17a9212fc4 pre-calculate clock pulse mods to improve ISR performance 2025-07-03 08:45:53 -07:00
db50132c28 update comments and minor fixes. 2025-07-03 07:57:18 -07:00
7ce8bb661d refactor cv mod to allow both cv mods configurable per channel. Fix euclidean sum mod. update large font. 2025-07-02 14:16:15 -07:00
a640723be8 minor memory improvements 2025-07-01 21:31:20 -07:00
dd1228be00 Vendorize uClock (#10)
Add copy of uClock to the repo including memory optimization changes.

Also add user config setting for changing Pulse Out resolution.

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/10
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-07-02 02:45:39 +00:00
edddfd5879 Optimize euclidean pattern by changing from an array of ints to a bitmask. 2025-07-01 12:23:50 -07:00
ceb01bf03f Introduce basic Euclidean Rhythm (#9)
Each channel can define a euclidean rhythm by setting a number of steps (up to 16) and a number of hits to evenly distribute within those steps. CV Mod is available, however the cv mod acts as an override instead of a sum mix like the other parameters.

Refactor `applyCvMod()` so it is only called if cv mod is active for that channel. Now the setter methods will update the final output value if cv mod is not active.

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/9
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-30 17:23:56 +00:00
6d0a9f9f7f additional refactoring, small memory reduction. 2025-06-28 09:46:50 -07:00
d56355a94b refactor encoder. no need for Dir enum. 2025-06-28 09:45:50 -07:00
6fa5674909 Display memory usage reduction (#8)
Convert all string references from const char* to String/F() to store values in flash instead of ram.

Memory usage from `main`:

```
Sketch uses 27878 bytes (90%) of program storage space. Maximum is 30720 bytes.
Global variables use 1755 bytes (85%) of dynamic memory, leaving 293 bytes for local variables. Maximum is 2048 bytes.
```

Memory usage after these changes:
```
Sketch uses 28054 bytes (91%) of program storage space. Maximum is 30720 bytes.
Global variables use 1445 bytes (70%) of dynamic memory, leaving 603 bytes for local variables. Maximum is 2048 bytes.
```

This provides a dynamic memory savings of 310 bytes!

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/8
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-22 18:44:01 +00:00
973c13b8ef Add per-channel Swing configuration (#7)
Select swing amount from a percentage range of the beat starting a 50% (unchanged) to a max swing amount of 95% (about 1/32nd note before end of period). Swing percentage shows an indicator marker when the percentage lines up with a quantized note on the grid.

This is probably going to be the last feature because it is pushing up against the limits of available dynamic memory.

Out of scope changes:
- selecting parameters / values no longer wraps
- reduce dynamic memory used in processClockTick
- various readability formatting

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/7
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-22 18:38:51 +00:00
c8e42c7448 use appropriate string width method. 2025-06-21 15:45:11 -07:00
54999d6525 Separate display into its own file. 2025-06-17 20:40:51 -07:00
966f5b767b code cleanup for consistency 2025-06-17 07:27:22 -07:00
6c75a85929 fixed type mismatch in default state version. 2025-06-17 06:59:55 -07:00
8a9bf121dc remove unused fields 2025-06-15 21:18:35 -07:00
d12764313b Introduce StateManager to persist state between power cycles (#6)
- add reset state menu option to return all settings back to default values.
- add reverse encoder menu option and save state
- make saving to EEPROM safer by wrapping put calls with noInterrupts()
- improve save state behavior by using a mutex flag and update check with debounce in main loop
- refactor gravity.h global const definitions to be static and more readable.
- improve usage of EncoderDir in ISR with pointer to instance and static isr() method.
- reduce u8g2 memory usage by using single page buffer

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/6
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-16 02:47:25 +00:00
07ed4b3d9a Update Font (#5)
Reduce the amount of program memory used by switching to original firmware's optimized fonts.

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/5
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-14 21:52:18 +00:00
9bacf43f15 Add per-channel CV Input mod configuration (#4)
Each channel can enable CV 1 or CV 2 as an input source for modulation, which can be applied to any of the user-editable parameters. When editing the parameter, cv mod is not applied in the UI so the user can easily see the base value for editing. When not editing, the UI will display the current cv modded value in the UI for the modded parameter.

I had originally intended to provide configuration for attenuating and offsetting the cv input per channel, but that introduced a significant amount of memory needed to store several new ints per channel. I may return to add this feature later, but given it's something that can easily be done with other modules between the modulation source and Gravity cv input, I am deprioritizing this feature.

Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/4
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
2025-06-14 21:26:33 +00:00
70b9b28032 minor formatting 2025-06-09 22:36:58 -07:00
8aa47b73fd Add new official Gravity firmware code. Split out the output channel behavior and struct into a new class. 2025-06-09 22:33:16 -07:00