Polymorphism Phase 2 + remove unused gamma/saturation fields
ProcessorManager: replace all isinstance checks with property-based dispatch via base TargetProcessor (device_id, led_client, get_display_index, update_device, update_calibration). Remove gamma/saturation from ProcessingSettings, ColorCorrection schema, serialization, and migration — these were never used in the processing pipeline and are handled by postprocessing template filters. Delete dead apply_color_correction() function. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,7 @@ router = APIRouter()
|
||||
|
||||
def _settings_to_core(schema: ProcessingSettingsSchema) -> ProcessingSettings:
|
||||
"""Convert schema ProcessingSettings to core ProcessingSettings."""
|
||||
settings = ProcessingSettings(
|
||||
return ProcessingSettings(
|
||||
display_index=schema.display_index,
|
||||
fps=schema.fps,
|
||||
interpolation_mode=schema.interpolation_mode,
|
||||
@@ -72,17 +72,10 @@ def _settings_to_core(schema: ProcessingSettingsSchema) -> ProcessingSettings:
|
||||
standby_interval=schema.standby_interval,
|
||||
state_check_interval=schema.state_check_interval,
|
||||
)
|
||||
if schema.color_correction:
|
||||
settings.gamma = schema.color_correction.gamma
|
||||
settings.saturation = schema.color_correction.saturation
|
||||
# color_correction.brightness maps to settings.brightness
|
||||
settings.brightness = schema.color_correction.brightness
|
||||
return settings
|
||||
|
||||
|
||||
def _settings_to_schema(settings: ProcessingSettings) -> ProcessingSettingsSchema:
|
||||
"""Convert core ProcessingSettings to schema ProcessingSettings."""
|
||||
from wled_controller.api.schemas.picture_targets import ColorCorrection
|
||||
return ProcessingSettingsSchema(
|
||||
display_index=settings.display_index,
|
||||
fps=settings.fps,
|
||||
@@ -91,11 +84,6 @@ def _settings_to_schema(settings: ProcessingSettings) -> ProcessingSettingsSchem
|
||||
smoothing=settings.smoothing,
|
||||
standby_interval=settings.standby_interval,
|
||||
state_check_interval=settings.state_check_interval,
|
||||
color_correction=ColorCorrection(
|
||||
gamma=settings.gamma,
|
||||
saturation=settings.saturation,
|
||||
brightness=settings.brightness,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -432,23 +420,11 @@ async def update_target_settings(
|
||||
fps=settings.fps if 'fps' in sent else existing.fps,
|
||||
interpolation_mode=settings.interpolation_mode if 'interpolation_mode' in sent else existing.interpolation_mode,
|
||||
brightness=settings.brightness if 'brightness' in sent else existing.brightness,
|
||||
gamma=existing.gamma,
|
||||
saturation=existing.saturation,
|
||||
smoothing=settings.smoothing if 'smoothing' in sent else existing.smoothing,
|
||||
standby_interval=settings.standby_interval if 'standby_interval' in sent else existing.standby_interval,
|
||||
state_check_interval=settings.state_check_interval if 'state_check_interval' in sent else existing.state_check_interval,
|
||||
)
|
||||
|
||||
# Apply color_correction fields if explicitly sent
|
||||
if 'color_correction' in sent and settings.color_correction:
|
||||
cc_sent = settings.color_correction.model_fields_set
|
||||
if 'brightness' in cc_sent:
|
||||
new_settings.brightness = settings.color_correction.brightness
|
||||
if 'gamma' in cc_sent:
|
||||
new_settings.gamma = settings.color_correction.gamma
|
||||
if 'saturation' in cc_sent:
|
||||
new_settings.saturation = settings.color_correction.saturation
|
||||
|
||||
# Update in store
|
||||
target_store.update_target(target_id, settings=new_settings)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user