correct selector pins, cava out, test mode

This commit is contained in:
Tropicananass 2021-08-01 09:44:05 +01:00
parent e53bbd085b
commit c16cc57ccd
6 changed files with 19 additions and 10 deletions

View File

@ -9,7 +9,7 @@ BIN := bin/pixled
SOURCES := $(shell find $(SRC) -type f -name "*.c") SOURCES := $(shell find $(SRC) -type f -name "*.c")
OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES)) OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
.PHONY: all clean debug .PHONY: all clean install
all: $(BIN) all: $(BIN)
@ -30,5 +30,9 @@ $(BIN): $(OBJECTS) .libs/log.la
if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
$(CC) -o $@ $^ $(LDFLAGS) $(CC) -o $@ $^ $(LDFLAGS)
install:
$(shell install --backup bin/pixled /usr/local/bin/)
clean: clean:
rm -rf $(OBJ) .libs libs/*/obj rm -rf $(OBJ) .libs libs/*/obj

View File

@ -3,7 +3,7 @@ Description=pixled
After=network.target After=network.target
[Service] [Service]
ExecStart=/home/pi/LedBars/RpiLedBars/bin/service_pixled -n 60 ExecStart=pixled -n 180 -d 1
Restart=always Restart=always
User=root User=root
Group=root Group=root

View File

@ -26,4 +26,7 @@ sudo apt install libfftw3-dev libasound2-dev libtool automake
./autogen.sh ./autogen.sh
./configure ./configure
make make
sudo make install sudo make install
# Access point
grep "Access point conf" $(find /etc -type f)

View File

@ -20,7 +20,7 @@
**************************************************************************************************/ **************************************************************************************************/
unsigned const selectorPinNumber = 4; unsigned const selectorPinNumber = 4;
/* TODO use GPIO function from ../gpio/gipo.h (same pin number) */ /* TODO use GPIO function from ../gpio/gipo.h (same pin number) */
int selectorPins[4] = {5, 6, 26, 27}; int selectorPins[4] = {26, 27, 6, 5};
char modeStr[] = "0 | 0 | 0 | 0 \n"; char modeStr[] = "0 | 0 | 0 | 0 \n";
/*************************************************************************************************** /***************************************************************************************************

View File

@ -107,10 +107,12 @@ int main(int argc, char const *argv[]) {
clock_gettime(CLOCK_MONOTONIC, &loopStart); clock_gettime(CLOCK_MONOTONIC, &loopStart);
if (IsTestMode) { if (IsTestMode) {
if (mainLoopCycle % 300 < 150) { if (mainLoopCycle % (180 * 3) < 180) {
mode = 2; mode = 0;
} else { } else if (mainLoopCycle % (180 * 3) < 180 * 2) {
mode = 1; mode = 1;
} else {
mode = 2;
} }
} else { } else {
mode = selector_get_position(); mode = selector_get_position();

View File

@ -186,7 +186,7 @@ static int start_cava_process() {
if (cavaPid == 0) { if (cavaPid == 0) {
/* Child process*/ /* Child process*/
int fdLogOut; // int fdLogOut;
char *args[] = {"cava", "-p", "/home/pi/LedBars/RpiLedBars/cava_config", NULL}; char *args[] = {"cava", "-p", "/home/pi/LedBars/RpiLedBars/cava_config", NULL};
/* Close reading end of the pipe */ /* Close reading end of the pipe */
@ -197,9 +197,9 @@ static int start_cava_process() {
close(fdCavaPipe[1]); close(fdCavaPipe[1]);
/* Open / create a log file for cava */ /* Open / create a log file for cava */
fdLogOut = open("/dev/null", O_WRONLY, NULL); // fdLogOut = open("/dev/null", O_WRONLY, NULL);
/* Dup file in place of stderr */ /* Dup file in place of stderr */
dup2(fdLogOut, STDERR_FILENO); // dup2(fdLogOut, STDERR_FILENO);
execvp(args[0], args); execvp(args[0], args);
log_error("Cava execvp failure or return: %s", strerror(errno)); log_error("Cava execvp failure or return: %s", strerror(errno));