Adapt playback layout and fonts for displays and add contrast fading
This commit is contained in:
9 files changed
+104
-28
No files matched your search
+26
-3
@@ -87,6 +87,13 @@ func (c *Controller) configureDisplay(log *logrus.Entry, settings *config.Displa
|
||||
} else if err = c.ctx.display.Refresh(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
userSettings := c.ctx.Settings()
|
||||
c.ctx.contrast = userSettings.Display.Contrast
|
||||
if err = c.ctx.display.SetContrast(userSettings.Display.Contrast); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.WithField("display", c.ctx.display).Debug("setup display done")
|
||||
return
|
||||
}
|
||||
@@ -181,6 +188,8 @@ func (c *Controller) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (c *Controller) onFrame(now time.Time) {
|
||||
log := logrus.WithField("component", "controller")
|
||||
|
||||
var refresh bool
|
||||
for _, layout := range c.ctx.layouts {
|
||||
for _, widget := range layout.Widgets() {
|
||||
@@ -195,7 +204,7 @@ func (c *Controller) onFrame(now time.Time) {
|
||||
if refresh {
|
||||
logrus.Trace("display refresh required")
|
||||
if err := c.ctx.display.Refresh(); err != nil {
|
||||
logrus.WithError(err).Warn("display refresh failed")
|
||||
log.WithError(err).Warn("display refresh failed")
|
||||
}
|
||||
|
||||
if c.recorder != nil {
|
||||
@@ -205,12 +214,26 @@ func (c *Controller) onFrame(now time.Time) {
|
||||
go c.recorderSave()
|
||||
}
|
||||
} else if now.After(c.recorderStart) {
|
||||
logrus.Info("recorder starting")
|
||||
log.Info("recorder starting")
|
||||
c.recorder = new(gif.GIF)
|
||||
}
|
||||
|
||||
} else {
|
||||
logrus.Trace("display refresh skipped, widgets not changed")
|
||||
log.Trace("display refresh skipped, widgets not changed")
|
||||
}
|
||||
|
||||
if c.ctx.contrast < c.ctx.contrastTarget {
|
||||
c.ctx.contrast++
|
||||
log.Debugf("increasing contrast %d to reach %d", c.ctx.contrast, c.ctx.contrastTarget)
|
||||
if err := c.ctx.display.SetContrast(c.ctx.contrast); err != nil {
|
||||
log.WithError(err).Warn("can't set display contrast")
|
||||
}
|
||||
} else if c.ctx.contrast > c.ctx.contrastTarget {
|
||||
c.ctx.contrast--
|
||||
log.Debugf("decreasing contrast %d to reach %d", c.ctx.contrast, c.ctx.contrastTarget)
|
||||
if err := c.ctx.display.SetContrast(c.ctx.contrast); err != nil {
|
||||
log.WithError(err).Warn("can't set display contrast")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user