|
|
@@ -0,0 +1,147 @@
|
|
|
+#define Active_ControllerID 0x20
|
|
|
+
|
|
|
+//#include <StandardCplusplus.h>
|
|
|
+//#include <vector>
|
|
|
+//#include <iterator>
|
|
|
+
|
|
|
+#include "___P5_LIB/p5__struct.h"
|
|
|
+#include "___P5_LIB/p5__display.h"
|
|
|
+
|
|
|
+#include "___P5_LIB/p5__router.h"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#include "___P5_LIB/p5__intro.h"
|
|
|
+#include "___P5_LIB/p5__pwm.h"
|
|
|
+#include "___P5_LIB/p5__swing.h"
|
|
|
+#include "___P5_LIB/p5__pins__setup.h"
|
|
|
+
|
|
|
+
|
|
|
+#include "___P5_LIB/p5__task.h"
|
|
|
+
|
|
|
+
|
|
|
+#define HAS_u8g2
|
|
|
+
|
|
|
+#include <Arduino.h>
|
|
|
+#include <U8g2lib.h>
|
|
|
+#include <SPI.h>
|
|
|
+#include <Wire.h>
|
|
|
+
|
|
|
+
|
|
|
+#include "___CONFIG/config_individual.h"
|
|
|
+
|
|
|
+#include "___CONFIG/config_defaults.h"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#if defined(HAS_u8g2)
|
|
|
+U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0);
|
|
|
+//u8g2_uint_t offset; // current offset for the scrolling text
|
|
|
+//u8g2_uint_t width; // pixel width of the scrolling text (must be lesser than 128 unless U8G2_16BIT is defined
|
|
|
+//char *text ;
|
|
|
+//const char *text = "U8g2 ";
|
|
|
+//AA U8G2LOG u8g2log;
|
|
|
+
|
|
|
+#define U8LOG_WIDTH_D 32
|
|
|
+uint8_t U8LOG_WIDTH = U8LOG_WIDTH_D ;
|
|
|
+
|
|
|
+#define U8LOG_HEIGHT_D 5 //10
|
|
|
+uint8_t U8LOG_HEIGHT = U8LOG_HEIGHT_D ;
|
|
|
+uint8_t u8log_buffer[U8LOG_WIDTH_D*U8LOG_HEIGHT_D];
|
|
|
+U8G2LOG u8g2log;
|
|
|
+
|
|
|
+//p5__display__class p5__display__class_A(u8g2,U8LOG_WIDTH, U8LOG_HEIGHT , u8log_buffer ) ;
|
|
|
+//p5__display__class p5__display__class_A ;
|
|
|
+
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ void setup(void) {
|
|
|
+ Serial.begin(115200);
|
|
|
+ Serial.println(" ST ");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #if defined(HAS_u8g2)
|
|
|
+ #if defined(HAS_u8g2__ROTATED)
|
|
|
+ u8g2.setDisplayRotation(U8G2_R2);
|
|
|
+ # elif defined( HAS_NOT_u8g2__ROTATED)
|
|
|
+ #else
|
|
|
+
|
|
|
+ #endif
|
|
|
+//B u8g2.begin();
|
|
|
+ // u8g2log.begin(u8g2, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer);
|
|
|
+ // u8g2log.setLineHeightOffset(0); // set extra space between lines in pixel, this can be negative
|
|
|
+ // u8g2log.setRedrawMode(0); // 0: Update screen with newline, 1: Update screen for every char
|
|
|
+
|
|
|
+
|
|
|
+ #endif
|
|
|
+
|
|
|
+
|
|
|
+ #if defined(HAS_u8g2)
|
|
|
+ // u8g2.clearBuffer(); // clear the internal memory
|
|
|
+ // u8g2.setFont(u8g2_font_helvR10_tf); // choose a suitable font at https://github.com/olikraus/u8g2/wiki/fntlistall
|
|
|
+ //u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f); // choose a suitable font
|
|
|
+ //B u8g2.setFont(u8g2_font_tom_thumb_4x6_mf); // set the font for the terminal window
|
|
|
+
|
|
|
+
|
|
|
+ // u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f); // set the target font to calculate the pixel width
|
|
|
+ //width = u8g2.getUTF8Width(text); // calculate the pixel width of the text
|
|
|
+ //p5__display__class_A.begin(u8g2,U8LOG_WIDTH, U8LOG_HEIGHT , u8log_buffer ) ;
|
|
|
+ u8g2.begin();
|
|
|
+
|
|
|
+ u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f//u8g2_font_tom_thumb_4x6_mf); // set the font for the terminal window
|
|
|
+ );
|
|
|
+ u8g2log.begin(u8g2, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer);
|
|
|
+ u8g2log.setLineHeightOffset(0); // set extra space between lines in pixel, this can be negative
|
|
|
+ u8g2log.setRedrawMode(0); // 0: Update screen with newline, 1: Update screen for every char
|
|
|
+ Serial.println(" SB ");
|
|
|
+
|
|
|
+
|
|
|
+ #endif
|
|
|
+
|
|
|
+ P5__STATUS_T P5__STATUS_A = P5__STATUS__INIT;
|
|
|
+
|
|
|
+ // p5__pins__setup(p5__display__class_A , P5__STATUS_A);
|
|
|
+ //p5__pins__setup();
|
|
|
+ // p5__router()
|
|
|
+
|
|
|
+ // p5__config__individual__init(P5__TASK__CONFIG_A);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+unsigned long t = 0;
|
|
|
+
|
|
|
+
|
|
|
+void loop(void) {
|
|
|
+
|
|
|
+// #include "___P5_LIB/p5__task__loop.h"
|
|
|
+
|
|
|
+ // delay(100);
|
|
|
+
|
|
|
+
|
|
|
+ if ( t < millis() ) {
|
|
|
+ t = millis() + 15000; // every 15 seconds
|
|
|
+ // p5__display__print(u8g2,u8g2log, "\f"); // \f = form feed: clear the screen
|
|
|
+ u8g2log.print("\f");
|
|
|
+ }
|
|
|
+ p5__display__print(u8g2,u8g2log,"t[");
|
|
|
+ // p5__display__print(u8g2,u8g2log,millis());
|
|
|
+ // p5__display__print(u8g2,u8g2log,"\n");
|
|
|
+ u8g2log.print(millis()); //todo type class; p5__display__print(u8g2,u8g2log,millis());
|
|
|
+ u8g2log.print(u8g2,u8g2log,"\n"); //todo class type \n
|
|
|
+
|
|
|
+ delay(500);
|
|
|
+ Serial.println(" L");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|