Make space by reducing useless high resolution led gamma tables

This commit is contained in:
Jan-Henrik 2020-07-17 20:22:51 +02:00
parent 29e85cacc8
commit 3084341f68
4 changed files with 510 additions and 1023 deletions

View file

@ -56,7 +56,7 @@ class Leds {
htim1.Init.Prescaler = 1;
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
htim1.Init.Period = 4095; // 12 bit
htim1.Init.Period = 1024; // 12 bit
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_PWM_Init(&htim1);
@ -97,13 +97,13 @@ class Leds {
if(targetColor == LED_COLOR_RED) {
HAL_GPIO_WritePin(kGpioColorPorts[i], kGpioColorPins[i], GPIO_PIN_SET);
intensity = 65535 - lut_led_red_gamma[intensity >> 5];
intensity = 65535 - lut_led_red_gamma[intensity >> 6];
} else if(targetColor == LED_COLOR_GREEN) {
HAL_GPIO_WritePin(kGpioColorPorts[i], kGpioColorPins[i], GPIO_PIN_RESET);
intensity = lut_led_green_gamma[intensity >> 5];
intensity = lut_led_green_gamma[intensity >> 6];
}
__HAL_TIM_SET_COMPARE(&htim1, timer_channel[i], intensity >> 4);
__HAL_TIM_SET_COMPARE(&htim1, timer_channel[i], (intensity >> 6));
}
}

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 2049
#define LUT_LED_RED_GAMMA_SIZE 1024
#define LUT_LED_GREEN_GAMMA 4
#define LUT_LED_GREEN_GAMMA_SIZE 2049
#define LUT_LED_GREEN_GAMMA_SIZE 1024
} // namespace stereo_mix

View file

@ -52,12 +52,13 @@ lookup_tables_u16.append(('right_cos_pan', r_pan))
print(r_pan.size)
# led gamma correction
gamma_green = 2.4
gamma_green = 2.7
gamma_red = 2.8
max_in = 2048
max_in = 1024
max_out = 65535
input_vals = np.linspace(0, max_in, num=max_in + 1)
input_vals = np.linspace(0, max_in, num=max_in)
gamma_correction_red = ((input_vals / max_in) ** gamma_red) * max_out + 0.5
gamma_correction_green = ((input_vals / max_in) ** gamma_green) * max_out + 0.5
lookup_tables_u16.append(('led_red_gamma', np.floor(gamma_correction_red)))
lookup_tables_u16.append(('led_green_gamma', np.floor(gamma_correction_green)))