1
0
Fork 0
mirror of https://github.com/jhbruhn/eurorack.git synced 2025-03-15 11:05:49 +00:00

Make space for settings storage

This commit is contained in:
Jan-Henrik 2020-07-17 20:01:05 +02:00
parent 81f6cd6d96
commit 29e85cacc8
6 changed files with 1016 additions and 2032 deletions

View file

@ -97,10 +97,10 @@ class Leds {
if(targetColor == LED_COLOR_RED) {
HAL_GPIO_WritePin(kGpioColorPorts[i], kGpioColorPins[i], GPIO_PIN_SET);
intensity = 65535 - lut_led_red_gamma[intensity >> 4];
intensity = 65535 - lut_led_red_gamma[intensity >> 5];
} else if(targetColor == LED_COLOR_GREEN) {
HAL_GPIO_WritePin(kGpioColorPorts[i], kGpioColorPins[i], GPIO_PIN_RESET);
intensity = lut_led_green_gamma[intensity >> 4];
intensity = lut_led_green_gamma[intensity >> 5];
}
__HAL_TIM_SET_COMPARE(&htim1, timer_channel[i], intensity >> 4);

View file

@ -108,7 +108,7 @@ class PotController {
inline void ProcessControlRate(uint16_t adc_value)
{
value_ += (adc_value - value_) >> 6;
value_ += (adc_value - value_) >> 5;
CONSTRAIN(value_, 0, 65535);
// approximately this:
// ONE_POLE(value_, adc_value, 0.01f);
@ -150,14 +150,16 @@ class PotController {
: (66 + stored_value_) / (66 + previous_value_);
CONSTRAIN(skew_ratio, 6553, 655350);
stored_value_ += (skew_ratio * delta) >> 11;
stored_value_ += (skew_ratio * delta) >> 12;
CONSTRAIN(stored_value_, 0, 65535);
if (abs(stored_value_ - value_) < 327) {
state_ = POT_STATE_TRACKING;
}
previous_value_ = value_;
*main_parameter_ = stored_value_;
previous_value_ = value_;/*
state_ = POT_STATE_TRACKING;
*main_parameter_ = value_;*/
}
} break;
}

File diff suppressed because it is too large Load diff

View file

@ -58,9 +58,9 @@ extern const uint16_t lut_led_green_gamma[];
#define LUT_RIGHT_COS_PAN 2
#define LUT_RIGHT_COS_PAN_SIZE 4096
#define LUT_LED_RED_GAMMA 3
#define LUT_LED_RED_GAMMA_SIZE 4096
#define LUT_LED_RED_GAMMA_SIZE 2049
#define LUT_LED_GREEN_GAMMA 4
#define LUT_LED_GREEN_GAMMA_SIZE 4096
#define LUT_LED_GREEN_GAMMA_SIZE 2049
} // namespace stereo_mix

View file

@ -54,7 +54,7 @@ print(r_pan.size)
# led gamma correction
gamma_green = 2.4
gamma_red = 2.8
max_in = 4095
max_in = 2048
max_out = 65535
input_vals = np.linspace(0, max_in, num=max_in + 1)
gamma_correction_red = ((input_vals / max_in) ** gamma_red) * max_out + 0.5

View file

@ -15,6 +15,7 @@ void UI::Poll()
for (size_t j = 0; j < kNumChannels * 2; j++)
potControllers[j].Lock(i);
}
if (switches->pressed(Switch(i)) && !ignore_release[i]) {
bool suppress_release_hidden_parameters = false;
for (size_t j = 0; j < kNumChannels * 2; j++) {
@ -26,6 +27,7 @@ void UI::Poll()
ignore_release[i] = true;
}
}
if (switches->released(Switch(i))) {
bool suppress_release_hidden_parameters = false;
for (size_t j = 0; j < kNumChannels * 2; j++) {
@ -82,6 +84,8 @@ void UI::OnSwitchReleased(const Event& e)
for (size_t i = 0; i < kNumChannels; i++) {
last_pan_pot_touch[i] = last_vol_pot_touch[i] = 0;
}
// todo: save state
}
void UI::TaskProcessPotControllers()