|
@@ -0,0 +1,206 @@
|
|
|
|
|
+
|
|
|
|
|
+//### Defines for Flash saved Text #############################################
|
|
|
|
|
+#define FPr(x); Serial.print(FP(x)); // FlashPrint(FT)
|
|
|
|
|
+#define FPrL(x); Serial.println(FP(x)); // FlasPrintLine(FT)
|
|
|
|
|
+#define SPFT(x); Serial.print(FP(FT_##x)); // shorter version (ID)
|
|
|
|
|
+ #define SPFT2(x,y); Serial.print(FP(FT_##x)); Serial.print("["); Serial.print(y); Serial.print("] "); // shorter version (ID)
|
|
|
|
|
+
|
|
|
|
|
+#define SPFTL(x); Serial.println(FP(FT_##x)); // shorter version (ID)
|
|
|
|
|
+ #define SPFTL2(x,y); Serial.println(); Serial.println(FP(FT_##x)); Serial.print("["); Serial.print(y); Serial.print("] "); // shorter version (ID)
|
|
|
|
|
+
|
|
|
|
|
+#define SFP(x); Serial.print(FP(x));
|
|
|
|
|
+
|
|
|
|
|
+ #define USPFT(x); u8g2.print(FP(FT_##x)); // shorter version (ID)
|
|
|
|
|
+ #define USPFT2(x,y); u8g2.print(FP(FT_##x)); u8g2.print(y); // shorter version (ID)
|
|
|
|
|
+ // #define USPFTL(x); u8g2.println(FP(FT_##x)); // shorter version (ID)
|
|
|
|
|
+ // #define USPFTL2(x,y); u8g2.println(FP(FT_##x)); u8g2.print(y); // shorter version (ID)
|
|
|
|
|
+ #define USFP(x); u8g2.print(FP(x));
|
|
|
|
|
+ #define USFP2(x,y); u8g2.print(FP(x)); u8g2.print(y);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#define FT(x,y); const char FT_##x[] PROGMEM = {y};// generate FlashText(ID,FT)
|
|
|
|
|
+#define FP(x) (__FlashStringHelper*)(x) // Helper
|
|
|
|
|
+//******************************************************************************
|
|
|
|
|
+
|
|
|
|
|
+//### Shortening standard Serial.Print F() #####################################
|
|
|
|
|
+#define SPr(x); Serial.print(x); // short for Serial.print
|
|
|
|
|
+#define SPrL(x); Serial.println(x); // short for Serial.println
|
|
|
|
|
+#define SPrF(x); SPr(F(x)); // short for F-Macro Serial.print
|
|
|
|
|
+#define SPrLF(x); SPrL(F(x)); // short for F-Macro Serial.println
|
|
|
|
|
+//******************************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//### Shortening standard Serial.Print F() #####################################
|
|
|
|
|
+#define USPr(x); u8g2.print(x); // short for Serial.print
|
|
|
|
|
+#define USPrL(x); u8g2.print(x); // short for Serial.println
|
|
|
|
|
+#define USPrF(x); USPr(F(x)); // short for F-Macro Serial.print
|
|
|
|
|
+#define USPrLF(x); USPrL(F(x)); // short for F-Macro Serial.println
|
|
|
|
|
+//******************************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//### Generate global Flash saved strings ######################################
|
|
|
|
|
+//FT(0,"Text 0"); // Flash Text FT_0
|
|
|
|
|
+//FT(1,"This is a global saved and Flash "
|
|
|
|
|
+ // "saved Text!"); // FT_1
|
|
|
|
|
+//FT(2,"File: " __FILE__ " Date: " __DATE__ " Time: " __TIME__);// FT_2
|
|
|
|
|
+//FT(3,"***************************************************"); // FT_3
|
|
|
|
|
+//FT(B4,"*\t RS232 Menu\t\t\t\t *"); // FT_4
|
|
|
|
|
+//FT(5,"###################################################"); // FT_3
|
|
|
|
|
+
|
|
|
|
|
+FT(TASK_config__set__increment, "## T++" );
|
|
|
|
|
+FT(TASK_config__set, "## T+" );
|
|
|
|
|
+
|
|
|
|
|
+FT(TASK_p5__task__loop__run, "## TX" );
|
|
|
|
|
+
|
|
|
|
|
+FT(TASK_ATTR, " #@ ");
|
|
|
|
|
+FT(TODO_ATTR__NOT_EXISTS, "NOT_EXISTS");
|
|
|
|
|
+FT(TODO_ATTR__EXISTS, "EXISTS");
|
|
|
|
|
+
|
|
|
|
|
+FT(TODO_ATTR__ERROR__LIMITS, " ERROR LIMIT ELEMENTS ");
|
|
|
|
|
+FT(TODO_ATTR__ERROR__NOT_FOUND, " ERROR NOT FOUND ");
|
|
|
|
|
+FT(TODO_ATTR__OK__SAVED, " OK SAVED ");
|
|
|
|
|
+FT(TODO_ATTR__OK__SAVED__INIT, " OK SAVED_INI ");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+FT(TASK_LOOP, " ###L1 ");
|
|
|
|
|
+FT(TASK_LOOP_EXEC, " Lx");
|
|
|
|
|
+
|
|
|
|
|
+FT(TASK_PWM," PWM ");
|
|
|
|
|
+FT(TASK_SWING," SWING ");
|
|
|
|
|
+FT(TASK_DISPLAY," DISPLAY ");
|
|
|
|
|
+FT(TASK_I2C," I2C ");
|
|
|
|
|
+FT(TASK_p5__i2c__loop, "I2C@L"); //todo
|
|
|
|
|
+FT(TASK_p5__swing__loop, "SWING@L");
|
|
|
|
|
+
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__INDEX," i#");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__ATTRIBUTE__P5__TASK__ATTR_ACCTION,"[act]");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__ATTRIBUTE__P5__TASK__ATTR_ACCTION__REPLY,"repl");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__ATTRIBUTE__P5__TASK__ATTR_ACCTION__SET__INIT,"ini");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__ATTRIBUTE__P5__TASK__ATTR_ACCTION__SET,"set");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__NAME__ATTRIBUTE__P5__TASK__ATTR_ACCTION__IF_EXISTS,"if");
|
|
|
|
|
+
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__TYPE__SEQUENCE__ARRAY__INDEX," #.");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__TYPE__CLASS," *");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__ATTR_INT,"=v");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__INDEX__CURRENT__EXEC,"x");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__CONFIG__INDEX__CURRENT,"i#");
|
|
|
|
|
+FT(ATTRIBUTE__P5__TASK__TYPE__ASSOC_A, "^");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+FT(ATTRIBUTE_DISPLAY__REFERENCE__CONFIG__INDEX__CURRENT,"[Ref]");
|
|
|
|
|
+FT(ATTRIBUTE_LIMITS__MAX, "[x<]");
|
|
|
|
|
+FT(ATTRIBUTE_LIMITS__MIN, "[x>]");
|
|
|
|
|
+FT(ATTRIBUTE_HARDWARE_PIN__NUMBER,"[p#]");
|
|
|
|
|
+FT(ATTRIBUTE_LIMITS__MAX__DELTA,"D[x-y<]");
|
|
|
|
|
+FT(ATTRIBUTE_LIMITS__CURRENT__DELTA,"D=");
|
|
|
|
|
+FT(ATTRIBUTE_I2C__ADDRESS, "@i2c");
|
|
|
|
|
+FT(ATTRIBUTE_DISPLAY__ASSIGNED_X_MIN, "%[x>=]");
|
|
|
|
|
+FT(ATTRIBUTE_DISPLAY__ASSIGNED_X_MAX, "%[x<=]");
|
|
|
|
|
+FT(ATTRIBUTE_DISPLAY__ASSIGNED_Y_MIN, "%[y>=]");
|
|
|
|
|
+FT(ATTRIBUTE_DISPLAY__ASSIGNED_Y_MAX, "%[y<=]");
|
|
|
|
|
+FT(ATTRIBUTE_LATENCY_TASK_EXEC_TIME, "£[");
|
|
|
|
|
+FT(ATTRIBUTE_LATENCY_TASK_EXEC_TICKS, ".[");
|
|
|
|
|
+FT(ATTRIBUTE_LATENCY_TASK_EXEC_DIFF_RESULT, ".|");
|
|
|
|
|
+
|
|
|
|
|
+FT(ATTRIBUTE_STATUS__OUTPUT__LEVEL, ">V");
|
|
|
|
|
+FT(ATTRIBUTE_SWING__FREQUENCY, "~");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//******************************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//### Typedefs ################################################################
|
|
|
|
|
+typedef void(*pF)(void); // Pointer to void FCN(void)
|
|
|
|
|
+//*****************************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+
|
|
|
|
|
+#define CMD_CNT (sizeof(CmdAR)/sizeof(CmdAR[0])) // Number of Commands
|
|
|
|
|
+
|
|
|
|
|
+//### Define RS232-Command-Array ##############################################
|
|
|
|
|
+Commands CmdAR[] = {
|
|
|
|
|
+// cmd1, cmd2, callback, info
|
|
|
|
|
+{"TASK", "t ", cTask, "set Task Parameter (ID, Periode, Set, CNT, Offset)"},
|
|
|
|
|
+{"Set", "s ", cTask, "set Task Parameter (ID, Periode, Set, CNT, Offset)"},
|
|
|
|
|
+{"LCDBL", "lcdb", cLcdBL, "set LCD BackLight (off/Auto-Off Periode)" }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+void cTask(){
|
|
|
|
|
+ SPrLF("cTask");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void cLcdBL(){
|
|
|
|
|
+ SPrLF("cLcdBL");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void printComands(){
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+ //SPrLF("**************************************************");
|
|
|
|
|
+ SPFTL(3);
|
|
|
|
|
+ //SPrLF("*\tRS232 Command List\t\t\t *");
|
|
|
|
|
+ SPFTL(B4);
|
|
|
|
|
+ //SPrLF("**************************************************");
|
|
|
|
|
+ SPFTL(3);
|
|
|
|
|
+ SPrLF("Cmd1\t, Cmd2\t, Info (Parameter)");
|
|
|
|
|
+ for(byte i=0; i<CMD_CNT; i++){
|
|
|
|
|
+ SPrF(" ");
|
|
|
|
|
+ //SPr(FP(CmdAR[i].cmd1)); SPrF("\t, ");
|
|
|
|
|
+ SFP(CmdAR[i].cmd1); SPrF("\t, ");
|
|
|
|
|
+ SFP(CmdAR[i].cmd2); SPrF("\t, ");
|
|
|
|
|
+ SFP(CmdAR[i].info);
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+ }
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+ //SPrLF("**************************************************");
|
|
|
|
|
+ SPFTL(3);
|
|
|
|
|
+ SPrLF("Type: < Command1/2, Val1, Val2, Val3, Val4, Val5");
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//### Setup() #####################################################
|
|
|
|
|
+void setup() {
|
|
|
|
|
+ Serial.begin(230400);
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+ Serial.println(F("Macro-Based, only single "
|
|
|
|
|
+ "In-Function usable Flash saved Text."));
|
|
|
|
|
+ SPrLF("...the same, but shorter command ");
|
|
|
|
|
+
|
|
|
|
|
+ SPrL(); // Newline
|
|
|
|
|
+
|
|
|
|
|
+ FPrL(FT_0); // Serial Print Line Flash saved Text
|
|
|
|
|
+ FPrL(FT_1);
|
|
|
|
|
+ SPFTL(2); // Shortest Version SerialPrintFlashText(ID)
|
|
|
|
|
+ SPFTL(5);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}//void setup()
|
|
|
|
|
+//*****************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//### Main loop() #################################################
|
|
|
|
|
+void loop(){
|
|
|
|
|
+
|
|
|
|
|
+ // reuse same string anywere in the Code
|
|
|
|
|
+ //SPrL(); // Newline
|
|
|
|
|
+ //SPFTL(3); // Headder, SerialPrintFlashTextLine
|
|
|
|
|
+ //SPFTL(B4);
|
|
|
|
|
+ //SPFTL(3);
|
|
|
|
|
+
|
|
|
|
|
+ SPrL();
|
|
|
|
|
+ printComands();
|
|
|
|
|
+
|
|
|
|
|
+ delay(10000);
|
|
|
|
|
+}// void loop()
|
|
|
|
|
+//*****************************************************************
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+*/
|