Version 1.4.3

Bugfix: in function set_ch the address of channel was incremented instead of the value of it
Bugfix: in function get_timing integers were read to byte sized fields causing memory corruption
Updated and renamed moving_debug.c & moving_debug.h
This commit is contained in:
2021-08-30 20:33:19 +02:00
parent 0833762006
commit da56a0eb10
7 changed files with 63 additions and 39 deletions

View File

@@ -7,19 +7,19 @@
#include <stdlib.h>
#include <unistd.h> //project is to be compiled to openwrt
void set_ch (shutter *r, byte *ch)
void set_ch (shutter *r, byte *channel)
{
while (*ch != r->ch)
while (*channel != r->ch)
{
if (*ch > r->ch)
if (*channel > r->ch)
{
press_button (prev);
*ch--;
(*channel)--;
}
else if (*ch < r->ch)
else if (*channel < r->ch)
{
press_button (next);
*ch++;
(*channel)++;
}
}
}
@@ -40,16 +40,16 @@ void reset ()
//doing positive logic as button GPIOs are 0 on startup
void press_button (buttons b)
{
char *fname = calloc (29, 1);
char *fname = calloc (29, sizeof (char ));
sprintf (fname, "/sys/class/gpio/gpio%d/value", b);
FILE *gpio = fopen (fname, "w");
usleep (200000);
fprintf (gpio, "0");
fclose (gpio);
gpio = fopen (fname, "w");
usleep (200000);
fprintf (gpio, "1");
fclose (gpio);
usleep (200000);
}
void lower (shutter *r)