Dont transmit animation control commands for non-animated images
This commit is contained in:
parent
0b9b207513
commit
eec4c6b802
@ -248,6 +248,7 @@ func transmit_image(imgd *image_data) {
|
|||||||
}
|
}
|
||||||
frame_control_cmd := graphics.GraphicsCommand{}
|
frame_control_cmd := graphics.GraphicsCommand{}
|
||||||
frame_control_cmd.SetAction(graphics.GRT_action_animate).SetImageNumber(imgd.image_number)
|
frame_control_cmd.SetAction(graphics.GRT_action_animate).SetImageNumber(imgd.image_number)
|
||||||
|
is_animated := len(imgd.frames) > 1
|
||||||
|
|
||||||
for frame_num, frame := range imgd.frames {
|
for frame_num, frame := range imgd.frames {
|
||||||
err := f(imgd, frame_num, frame)
|
err := f(imgd, frame_num, frame)
|
||||||
@ -255,26 +256,28 @@ func transmit_image(imgd *image_data) {
|
|||||||
print_error("\rFailed to transmit %s with error: %v", imgd.source_name, err)
|
print_error("\rFailed to transmit %s with error: %v", imgd.source_name, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch frame_num {
|
if is_animated {
|
||||||
case 0:
|
switch frame_num {
|
||||||
// set gap for the first frame and number of loops for the animation
|
case 0:
|
||||||
c := frame_control_cmd
|
// set gap for the first frame and number of loops for the animation
|
||||||
c.SetTargetFrame(uint64(frame.number))
|
c := frame_control_cmd
|
||||||
c.SetGap(int32(frame.delay_ms))
|
c.SetTargetFrame(uint64(frame.number))
|
||||||
switch {
|
c.SetGap(int32(frame.delay_ms))
|
||||||
case opts.Loop < 0:
|
switch {
|
||||||
c.SetNumberOfLoops(1)
|
case opts.Loop < 0:
|
||||||
case opts.Loop > 0:
|
c.SetNumberOfLoops(1)
|
||||||
c.SetNumberOfLoops(uint64(opts.Loop) + 1)
|
case opts.Loop > 0:
|
||||||
|
c.SetNumberOfLoops(uint64(opts.Loop) + 1)
|
||||||
|
}
|
||||||
|
c.WriteWithPayloadToLoop(lp, nil)
|
||||||
|
case 1:
|
||||||
|
c := frame_control_cmd
|
||||||
|
c.SetAnimationControl(2) // set animation to loading mode
|
||||||
|
c.WriteWithPayloadToLoop(lp, nil)
|
||||||
}
|
}
|
||||||
c.WriteWithPayloadToLoop(lp, nil)
|
|
||||||
case 1:
|
|
||||||
c := frame_control_cmd
|
|
||||||
c.SetAnimationControl(2) // set animation to loading mode
|
|
||||||
c.WriteWithPayloadToLoop(lp, nil)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(imgd.frames) > 1 {
|
if is_animated {
|
||||||
c := frame_control_cmd
|
c := frame_control_cmd
|
||||||
c.SetAnimationControl(3) // set animation to normal mode
|
c.SetAnimationControl(3) // set animation to normal mode
|
||||||
c.WriteWithPayloadToLoop(lp, nil)
|
c.WriteWithPayloadToLoop(lp, nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user