mirror of
https://github.com/Derisis13/Shutter.git
synced 2025-12-06 19:32:48 +01:00
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:
16
moving.c
16
moving.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user