1 # Licence: WTFPLv2 <http://www.wtfpl.net/txt/copying/>
2 # Copyright 2015: Julien Moutinho <julm+air@autogeree.net>
11 .rrd = $(wildcard rrd/*/*.rrd)
20 ARDUINO_DIR := /usr/share/arduino/
21 ARDMK_DIR := /usr/share/arduino/
30 Humidity_Temperature_Sensor \
34 USER_LIB_PATH := $(abspath ./libraries)
36 include $(ARDMK_DIR)/Arduino.mk
38 ino: $(TARGET_EEP) $(TARGET_HEX)
43 .PHONY: png $(addprefix png/,$(SENSORS))
44 png: $(addprefix png/,$(SENSORS))
47 ym=$(patsubst %.rrd,,$(notdir $*))
48 month_begin=$(shell date +'%s' -d '$(ym)/01')
49 month_end=$(shell date +'%s' -d '$(ym)/01 + 1 month - 1 second')
50 month_length=$(shell date +'%d' -d '$(ym)/01 + 1 month - 1 second')
51 day_begin=$(shell date +'%s' -d '$(ym)/$(day)')
52 day_end=$(shell date +'%s' -d '$(ym)/$(day) + 1 month - 1 second')
58 $(patsubst rrd/%.rrd,png/$(sensor)/%.png,$(.rrd))
60 png/$(sensor)/%.png: rrd/%.rrd
61 mkdir -p png/$(sensor)/$$*
63 -w 785 -h 120 -a PNG \
65 --start $$(month_begin) --end $$(month_end) \
66 --vertical-label '$(label)' \
67 --x-grid HOUR:8:DAY:1:DAY:1:86400:%d \
68 DEF:$(sensor)=rrd/$$*.rrd:$(sensor):$$(RRD_CF) \
69 LINE1:$(sensor)'#ff0000':"$(sensor)"
70 for day in $$(shell seq -w $$(month_length)); \
72 day_begin=$$$$(date +'%s' -d "$$(ym)/$$$$day"); \
73 day_end=$$$$(date +'%s' -d "$$(ym)/$$$$day + 1 day - 1 second"); \
74 rrdtool graph png/$(sensor)/$$*/$$$$day.png \
75 -w 785 -h 120 -a PNG \
77 --start $$$$day_begin --end $$$$day_end \
78 --vertical-label '$(label)' \
79 --x-grid MINUTE:10:HOUR:1:HOUR:1:0:%H \
80 DEF:$(sensor)=rrd/$$*.rrd:$(sensor):$$(RRD_CF) \
81 LINE1:$(sensor)'#ff0000':"$(sensor)"; \
86 $(eval $(call png/sensor,temperature,Température (°C$)))
87 $(eval $(call png/sensor,humidity,Humidité (%$)))
88 $(eval $(call png/sensor,particles,Particules))
89 $(eval $(call png/sensor,quality,Qualité de l’air))