Commit Graph

75 Commits

Author SHA1 Message Date
19473db67e bump version in code 2025-07-24 18:38:34 -07:00
dd7217d04e Fix euclidean hit mod v2.0.0beta3 2025-07-24 18:27:24 -07:00
d1c8ee16a4 EXT will reset clocks in MIDI clock mode.
Add reset behavior for EXT clock input when MIDI clock source is selected.

Fixes: https://git.pinkduck.xyz/awonak/libGravity/issues/22
2025-07-24 08:35:05 -07:00
65dde4d62e Reorganization of library structure to better match Arduino spec (#20)
Note, this will also require to you "uninstall and reinstall" the Arduino library due to the library file location changes.

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/20
2025-07-24 15:07:15 +00:00
c7a3277b5f Memory improvements in bootsplash and StateManager 2025-07-24 07:53:41 -07:00
fb44601707 Merge branch 'main' of https://git.pinkduck.xyz/awonak/libGravity 2025-07-23 18:08:10 -07:00
ec34bc3a7b Fix metadata loading issues with Initialization and refactor Factory Reset. (#19)
Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/19
2025-07-23 03:32:16 +00:00
c5bddef66d Show loading bootsplash with firmware name and version (#18)
Bootsplash is displayed before EEPROM erase, which is a slow operation.

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/18
2025-07-22 05:16:32 +00:00
b0accdc83a Fix Initial Transient State (#17)
There was an off-by-one error that was not properly loading transient state from the designated memory slot. Also fixes setting the last saved/loaded slot indicator with metadata.

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/17
2025-07-22 05:12:45 +00:00
1c0fb86bc1 Reverse the order of clock mod options. (#16)
This now matches original Gravity behavior. Also, now when applying CV mod positive voltages increase clock mod instead of reducing it.

Also fix pulse out, which wasn't previously updated when CLOCK_MOD was moved to program mem.

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/16
2025-07-22 00:00:49 +00:00
01f32407f6 bump version v2.0.0beta2 2025-07-20 17:53:03 -07:00
4f04137f67 Add global/hardware settings to metadata EEPROM (#15)
Settings like Encoder Direction and Display Orientation should persist when resetting channel state.

Fixes https://github.com/awonak/alt-gravity/issues/7

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/15
2025-07-21 00:27:32 +00:00
1bf90e1674 Mute channel when shift + play pressed (#14)
Fixes https://github.com/awonak/alt-gravity/issues/2

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/14
2025-07-21 00:01:18 +00:00
5729eef037 Factory Reset (#13)
Fixes https://github.com/awonak/alt-gravity/issues/1

Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/13
2025-07-21 00:00:47 +00:00
385ce85da3 add const for pulse clock mod choices. update git ignore and readme for build command. v2.0.0beta1 2025-07-13 12:00:37 -07:00
60a7a7a349 fix example code 2025-07-04 15:21:03 -07:00
ab71ac9c37 Add copyright license information 2025-07-04 14:05:58 -07:00
f6b4b8a2ad migrate Gravity firmware into a new dedicated firmware directory. 2025-07-04 10:57:22 -07:00
14d1c497b3 Add clock reset behavior to EXT when internally clocked. 2025-07-04 10:54:16 -07:00
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
74d98fed13 add missing midi echo 2025-07-03 09:08:38 -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
6c85b94f21 Refactor handle rotate to make the code more reusable and readable. 2025-06-09 19:54:30 -07:00
dac1bb3007 Big refactor of code for readability and reusability. Mostly focusing on the UI code. 2025-06-08 18:17:19 -07:00
1a13fbff5f Introduce a new demo sketch to visulize the
attenuation and offset constraints of the input
cv.
2025-06-08 11:39:27 -07:00
d9106c6951 refactor calibrate analog demo to use tge u8g2 library. 2025-06-08 11:39:12 -07:00