correct selector pins, cava out, test mode
This commit is contained in:
parent
e53bbd085b
commit
c16cc57ccd
@ -9,7 +9,7 @@ BIN := bin/pixled
|
||||
SOURCES := $(shell find $(SRC) -type f -name "*.c")
|
||||
OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
|
||||
|
||||
.PHONY: all clean debug
|
||||
.PHONY: all clean install
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
@ -30,5 +30,9 @@ $(BIN): $(OBJECTS) .libs/log.la
|
||||
if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
install:
|
||||
$(shell install --backup bin/pixled /usr/local/bin/)
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJ) .libs libs/*/obj
|
@ -3,7 +3,7 @@ Description=pixled
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/pi/LedBars/RpiLedBars/bin/service_pixled -n 60
|
||||
ExecStart=pixled -n 180 -d 1
|
||||
Restart=always
|
||||
User=root
|
||||
Group=root
|
||||
|
@ -27,3 +27,6 @@ sudo apt install libfftw3-dev libasound2-dev libtool automake
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
# Access point
|
||||
grep "Access point conf" $(find /etc -type f)
|
@ -20,7 +20,7 @@
|
||||
**************************************************************************************************/
|
||||
unsigned const selectorPinNumber = 4;
|
||||
/* 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";
|
||||
|
||||
/***************************************************************************************************
|
||||
|
@ -107,10 +107,12 @@ int main(int argc, char const *argv[]) {
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &loopStart);
|
||||
if (IsTestMode) {
|
||||
if (mainLoopCycle % 300 < 150) {
|
||||
mode = 2;
|
||||
} else {
|
||||
if (mainLoopCycle % (180 * 3) < 180) {
|
||||
mode = 0;
|
||||
} else if (mainLoopCycle % (180 * 3) < 180 * 2) {
|
||||
mode = 1;
|
||||
} else {
|
||||
mode = 2;
|
||||
}
|
||||
} else {
|
||||
mode = selector_get_position();
|
||||
|
@ -186,7 +186,7 @@ static int start_cava_process() {
|
||||
|
||||
if (cavaPid == 0) {
|
||||
/* Child process*/
|
||||
int fdLogOut;
|
||||
// int fdLogOut;
|
||||
char *args[] = {"cava", "-p", "/home/pi/LedBars/RpiLedBars/cava_config", NULL};
|
||||
|
||||
/* Close reading end of the pipe */
|
||||
@ -197,9 +197,9 @@ static int start_cava_process() {
|
||||
close(fdCavaPipe[1]);
|
||||
|
||||
/* 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 */
|
||||
dup2(fdLogOut, STDERR_FILENO);
|
||||
// dup2(fdLogOut, STDERR_FILENO);
|
||||
|
||||
execvp(args[0], args);
|
||||
log_error("Cava execvp failure or return: %s", strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user