added ledmatrix footfall line diagram

This commit is contained in:
Verkehrsrot 2019-08-17 18:30:45 +02:00
parent 267d04488b
commit d332a17b28

View File

@ -2,7 +2,8 @@
#include "globals.h" #include "globals.h"
#define NUMCHARS 5 #define NUMROWS 16
#define NUMCOLS 96
#define MATRIX_DISPLAY_PAGES (2) // number of display pages #define MATRIX_DISPLAY_PAGES (2) // number of display pages
// local Tag for logging // local Tag for logging
@ -17,7 +18,7 @@ LEDMatrix matrix(LED_MATRIX_LA_74138, LED_MATRIX_LB_74138, LED_MATRIX_LC_74138,
LED_MATRIX_LATCHPIN, LED_MATRIX_CLOCKPIN); LED_MATRIX_LATCHPIN, LED_MATRIX_CLOCKPIN);
// Display Buffer 128 = 64 * 16 / 8 // Display Buffer 128 = 64 * 16 / 8
uint8_t displaybuf[LED_MATRIX_WIDTH * LED_MATRIX_HEIGHT / NUMCHARS]; uint8_t displaybuf[LED_MATRIX_WIDTH * LED_MATRIX_HEIGHT / 8];
// --- SELECT YOUR FONT HERE --- // --- SELECT YOUR FONT HERE ---
const FONT_INFO *ActiveFontInfo = &digital7_18ptFontInfo; const FONT_INFO *ActiveFontInfo = &digital7_18ptFontInfo;
@ -34,11 +35,11 @@ void init_matrix_display(bool reverse) {
if (reverse) if (reverse)
matrix.reverse(); matrix.reverse();
matrix.clear(); matrix.clear();
DrawNumber(String("0")); matrix.drawPoint(0, NUMROWS - 1, 1);
} // init_display } // init_display
void refreshTheMatrixDisplay(bool nextPage) { void refreshTheMatrixDisplay(bool nextPage) {
static uint8_t DisplayPage = 0; static uint8_t DisplayPage = 0, col = 0, row = 0;
char buff[16]; char buff[16];
// if Matrixdisplay is switched off we don't refresh it to relax cpu // if Matrixdisplay is switched off we don't refresh it to relax cpu
@ -54,20 +55,49 @@ void refreshTheMatrixDisplay(bool nextPage) {
DisplayPage = DisplayPage =
(DisplayPage >= MATRIX_DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1); (DisplayPage >= MATRIX_DISPLAY_PAGES - 1) ? 0 : (DisplayPage + 1);
matrix.clear(); matrix.clear();
col = 0;
} }
switch (DisplayPage % MATRIX_DISPLAY_PAGES) { switch (DisplayPage % MATRIX_DISPLAY_PAGES) {
// page 0: pax // page 0: number of current pax OR footfall line diagram
// page 1: time // page 1: time of day
case 0: case 0:
if (cfg.countermode == 1)
{ // cumulative counter mode -> display total number of pax
if (ulLastNumMacs != macs.size()) { if (ulLastNumMacs != macs.size()) {
ulLastNumMacs = macs.size(); ulLastNumMacs = macs.size();
matrix.clear(); matrix.clear();
DrawNumber(String(ulLastNumMacs)); DrawNumber(String(ulLastNumMacs));
} }
}
else { // cyclic counter mode -> plot a line diagram
if (ulLastNumMacs != macs.size()) {
// next count cycle?
if (macs.size() == 0) {
col++;
// display full?
if (col >= NUMCOLS) {
col = 0;
matrix.clear();
}
} else {
// clear previous dot
matrix.drawPoint(col, row, 0);
}
// set current dot
ulLastNumMacs = macs.size();
row = NUMROWS - 1 - (ulLastNumMacs / 2) % NUMROWS;
matrix.drawPoint(col, row, 1);
}
}
break; break;
case 1: case 1: