Add image generation (#2)

* Add image generation

* Optimise for minimal memory

* Added a new ui

* Add support for esp
This commit was merged in pull request #2.
This commit is contained in:
2025-07-19 19:11:31 +02:00
committed by GitHub
parent e9d145455e
commit e21601234a
25 changed files with 1188 additions and 31 deletions

View File

@@ -0,0 +1,31 @@
using HomeApi.Models;
using HomeApi.Models.Configuration;
using MediatR;
using Microsoft.Extensions.Options;
namespace HomeApi.Handlers;
public static class Configuration
{
public record Command : IRequest<MicroProcessorConfiguration>;
public class Handler(IOptions<ApiConfiguration> configuration)
: IRequestHandler<Command, MicroProcessorConfiguration>
{
private readonly ApiConfiguration _apiConfiguration = configuration.Value;
public Task<MicroProcessorConfiguration> Handle(Command request, CancellationToken cancellationToken)
{
return Task.FromResult(new MicroProcessorConfiguration
{
InformationBoardImageUrl = _apiConfiguration.EspConfiguration.InformationBoardImageUrl,
UpdateIntervalMinutes = _apiConfiguration.EspConfiguration.UpdateIntervalMinutes,
BlackTextThreshold = _apiConfiguration.EspConfiguration.BlackTextThreshold,
ContrastStrength = _apiConfiguration.EspConfiguration.ContrastStrength,
DitheringStrength = _apiConfiguration.EspConfiguration.DitheringStrength,
EnableDithering = _apiConfiguration.EspConfiguration.EnableDithering,
EnhanceContrast = _apiConfiguration.EspConfiguration.EnhanceContrast
});
}
}
}