Updated recorder to only send every 2nd frame, to clear the window when selecting a new effect, doubled the resizing factor and re-enabled gifsicle.

This commit is contained in:
Fabian Schlenz 2019-09-25 06:09:00 +02:00
parent 571ae26c25
commit 792354e371
4 changed files with 11 additions and 5 deletions

View File

@ -14,6 +14,7 @@ private:
size_t _buffer_len;
char* _buffer;
uint16_t _msgid;
boolean _skip_next_frame = false;
public:
Recorder();
void loop();

View File

@ -2,6 +2,7 @@
#include "my_fastled.h"
#include "functions.h"
#include "effects.h"
#include "Window.h"
#include <WiFiUdp.h>
#ifdef RECORDER_ENABLE
@ -37,6 +38,7 @@ Recorder::Recorder() {
} else if (*(char*)data == 'E') {
String effect = String(((char*)(data+1)));
LOGln("Recorder * Setting effect %s", effect.c_str());
Window::getFullWindow()->clear();
change_current_effect(effect);
}
}, NULL);
@ -47,6 +49,8 @@ Recorder::Recorder() {
void Recorder::loop() {
if (_client && _client_port) {
_skip_next_frame = !_skip_next_frame;
if (_skip_next_frame == false) return;
_buffer[0] = _msgid >> 8;
_buffer[1] = _msgid & 0xFF;
for (uint8_t y=0; y<LED_HEIGHT; y++) for(uint8_t x=0; x<LED_WIDTH; x++) {

View File

@ -15,7 +15,8 @@ for effect in $EFFECTS; do
echo " + ./recorder.rb $IP /tmp/effect.gif $effect"
./recorder.rb $IP /tmp/effect.gif $effect
echo
#echo " + gifsicle /tmp/effect.gif -o ../../docs/effects/$effect.gif"
#gifsicle /tmp/effect.gif -o ../../docs/effects/$effect.gif
mv /tmp/effect.gif ../../docs/effects/$effect.gif
echo " + gifsicle /tmp/effect.gif -O -o ../../docs/effects/$effect.gif"
gifsicle /tmp/effect.gif -O -o ../../docs/effects/$effect.gif
#mv /tmp/effect.gif ../../docs/effects/$effect.gif
#ffmpeg -i /tmp/effect.gif -y -c vp9 -b:v 0 -crf 41 ../../docs/effects/$effect.webm
done

View File

@ -10,7 +10,7 @@ PORT = 2122
FILE = ARGV[1] or raise "No filename given"
EFFECT = ARGV[2]
FRAMES = 125
FACTOR = 1
FACTOR = 2
delay = 50
puts "Connecting to #{IP}:#{PORT}..."
@ -59,7 +59,6 @@ while gif.length < FRAMES do
last_id = id
img = Image.new(dim_x, dim_y)
img.delay = 1
gc = Draw.new
#next
@ -81,6 +80,7 @@ s.close
puts
puts "Generating gif..."
gif.ticks_per_second = 100
gif.delay = 4
gif.write(FILE)
puts
puts