Browse Source

init branch for display 2: adding display afterglow functionality, simplifying the refresh algorithm, building structurefor generalized display pages

Sebastian 6 years ago
parent
commit
3f0d165f3c
3 changed files with 42 additions and 19 deletions
  1. 2 1
      CoffeeCode/display2.cpp
  2. 39 17
      CoffeeCode/display2.h
  3. 1 1
      CoffeeCode/main.cpp

+ 2 - 1
CoffeeCode/display.cpp → CoffeeCode/display2.cpp

@@ -10,8 +10,9 @@
 #include <unistd.h>
 #include <string.h>
 
+#include "display2.h"
+
 #include "global.h"
-#include "display.h"
 #include "logger.h"
 #include "database.h"
 #include "timer.h"

+ 39 - 17
CoffeeCode/display.h → CoffeeCode/display2.h

@@ -5,11 +5,28 @@
  *      Author: Philipp Hinz
  */
 
-#ifndef DISPLAY_H_
-#define DISPLAY_H_
+#ifndef DISPLAY2_H_
+#define DISPLAY2_H_
 #include <string>
 #include "coffee.h"
 
+#define DEFAULT_LANG 	lang_en /**< Default display language */
+#define REFRESH_RATE	5 /**< Display refresh rate in Hz when active */
+#define DISPLAY_ROWS	2
+#define DISPLAY_COLS	16
+
+#define MAX_PAGENAME	20
+
+void *displayThread(void *threadid);
+void *displayTimerHandler(void *threadid);
+void displayInit(void);
+void displayPrintLn(int line, const char* str, bool centered);
+
+void displayPushState(coffee_status_t state);
+
+void displayRefresh(void);
+
+
 typedef enum {
 	lang_de,
 	lang_en,
@@ -39,6 +56,25 @@ typedef enum {
 	str_last
 } display_strings_t;
 
+typedef struct {
+	const char * const pagename[MAX_PAGENAME];
+	void (*ContentFunction)(void);
+	uint16_t refreshrate;
+	uint16_t timeToDisplay;
+	uint16_t displayTime;
+}display2_page_t;
+
+static const display2_page_t pages[] =
+{
+		{
+				{"demopage"},
+				displayInit,
+				10,
+				19,
+				10
+		}
+};
+
 typedef struct {
 	char const * const text[lang_last];
 } display_string_t;
@@ -160,21 +196,7 @@ static const display_string_t display_strings[str_last] =
 		}
 };
 
-#define DEFAULT_LANG 	lang_en /**< Default display language */
-#define REFRESH_RATE	5 /**< Display refresh rate in Hz when active */
-#define DISPLAY_ROWS	2
-#define DISPLAY_COLS	16
-
-void *displayThread(void *threadid);
-void *displayTimerHandler(void *threadid);
-void displayInit(void);
-void displaySetLang(display_lang_t lang);
-void displayPrintLn(int line, const char* str, bool centered);
-
-void displayPushState(coffee_status_t state);
-
-void displayRefresh(void);
 const char* displayGetString(display_strings_t string);
-
+void displaySetLang(display_lang_t lang);
 
 #endif /* DISPLAY_H_ */

+ 1 - 1
CoffeeCode/main.cpp

@@ -23,7 +23,7 @@
 #include "hal.h"
 #include "stripe.h"
 #include "coffee.h"
-#include "display.h"
+#include "display2.h"
 #include "server.h"
 #include "events.h"
 #include "DS18B20.h"