Skip to content

Commit

Permalink
Version 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes committed Dec 14, 2024
1 parent e93ad44 commit cb920a0
Show file tree
Hide file tree
Showing 17 changed files with 2,379 additions and 2,334 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ GPIO = ./release/gpio
# deleting dependencies appended to the file from 'make depend'
#

.PHONY: depend clean
.PHONY: depend clean release

release:
sudo docker run -it --mount type=bind,source=./,target=/build aqualinkd-releasebin make armhf
$(info Binaries for release have been built)

armhf: CC = arm-linux-gnueabihf-gcc
armhf: $(MAIN)

all: $(MAIN)
@echo: $(MAIN) have been compiled
Expand Down
29 changes: 29 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ void readCfg(char *inifile)
exit (EXIT_FAILURE);
}

_sdconfig_.inputs = 0;
// Caculate how many inputs we have
for (i=1; i <= 24; i++) // 24 = Just some arbutary number (max GPIO without expansion board)
{
Expand Down Expand Up @@ -420,6 +421,34 @@ void readCfg(char *inifile)
}
}

_sdconfig_.runBeforeCmds = 0;
// Caculate how many external command to run
for (i=1; i <= 10; i++) // 10 = Just some arbutary number
{
sprintf(str, "EXTERNAL:%d", i);
pin = ini_getl(str, "RUNB4STARTTIME", -1, inifile);
if (pin == -1)
break;
else
_sdconfig_.runBeforeCmds = i;
}

if ( _sdconfig_.runBeforeCmds != 0) {
// n= _sdconfig_.zones+1;
_sdconfig_.runBeforeCmd = malloc((_sdconfig_.runBeforeCmds) * sizeof(struct RunB4CalStart));
for (i=0; i < _sdconfig_.runBeforeCmds; i++)
{
sprintf(str, "EXTERNAL:%d", i+1);
_sdconfig_.runBeforeCmd[i].mins = ini_getl(str, "RUNB4STARTTIME", -1, inifile);
ini_gets(str, "COMMAND", NULL, _sdconfig_.runBeforeCmd[i].command, sizearray(_sdconfig_.runBeforeCmd[i].command), inifile);
//if (_sdconfig_.runBeforeCmd[i].mins <= 0 || _sdconfig_.runBeforeCmd[i].mins > 120) {
// logMessage (LOG_ERR, "RUNB4STARTTIME %d is not valid, found in EXTERNAL:%d of configuration file %s \n",_sdconfig_.runBeforeCmd[i].mins, i+1, inifile);
// continue;
//}
logMessage (LOG_DEBUG,"Run external command '%s', %d mins before start time\n",_sdconfig_.runBeforeCmd[i].command, _sdconfig_.runBeforeCmd[i].mins);
}
}


/*
idx=0;
Expand Down
31 changes: 30 additions & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ struct CALENDARday {
int minute;
int *zruntimes;
};

struct RunB4CalStart {
int mins;
char command[256];
};
/*
struct GPIOextra {
char command_high[COMMAND_SIZE];
Expand Down Expand Up @@ -96,8 +101,11 @@ struct sprinklerdcfg {
long cron_update;
int log_level;
struct szRunning currentZone;
struct RunB4CalStart *runBeforeCmd;
int runBeforeCmds;
char cache_file[512];
bool eventToUpdateHappened;
//bool eventToUpdateHappened;
uint8_t updateEventMask;
int todayRainChance;
float todayRainTotal;
};
Expand Down Expand Up @@ -127,5 +135,26 @@ void read_cache();
#define ON 0
#define OFF 1
*/

#define UPDATE_RAINTOTAL (1 << 0) //
#define UPDATE_RAINPROBABILITY (1 << 1) //
#define UPDATE_ZONES (1 << 2) //
#define UPDATE_STATUS (1 << 3) //

#define isEventRainTotal ((_sdconfig_.updateEventMask & UPDATE_RAINTOTAL) == UPDATE_RAINTOTAL)
#define isEventRainProbability ((_sdconfig_.updateEventMask & UPDATE_RAINPROBABILITY) == UPDATE_RAINPROBABILITY)
#define isEventZones ((_sdconfig_.updateEventMask & UPDATE_ZONES) == UPDATE_ZONES)
#define isEventStatus ((_sdconfig_.updateEventMask & UPDATE_STATUS) == UPDATE_STATUS)

#define setEventRainTotal (_sdconfig_.updateEventMask |= UPDATE_RAINTOTAL)
#define setEventRainProbability (_sdconfig_.updateEventMask |= UPDATE_RAINPROBABILITY)
#define setEventZones (_sdconfig_.updateEventMask |= UPDATE_ZONES)
#define setEventStatus (_sdconfig_.updateEventMask |= UPDATE_STATUS)

#define clearEventRainTotal (_sdconfig_.updateEventMask &= ~UPDATE_RAINTOTAL)
#define clearEventRainProbability (_sdconfig_.updateEventMask &= ~UPDATE_RAINPROBABILITY)
#define clearEventZones (_sdconfig_.updateEventMask &= ~UPDATE_ZONES)
#define clearEventStatus (_sdconfig_.updateEventMask &= ~UPDATE_STATUS)

#define NO_CHANGE 2
#endif /* CONFIG_H_ */
51 changes: 0 additions & 51 deletions extras/sprinklerDarkskys.sh

This file was deleted.

30 changes: 0 additions & 30 deletions extras/sprinklerMeteohub.sh

This file was deleted.

53 changes: 0 additions & 53 deletions extras/sprinklerOpenWeather.sh

This file was deleted.

Loading

0 comments on commit cb920a0

Please sign in to comment.