Skip to content
Permalink
Browse files

Removed test script from code

  • Loading branch information
spacehuhn committed Oct 6, 2019
1 parent 22c175b commit becece39109d70476aeeff80ff7a5cc36af0fda7
Showing with 64 additions and 104 deletions.
  1. +1 −15 esp_duck/config.h
  2. +0 −87 esp_duck/duckscript.cpp
  3. +0 −2 esp_duck/esp_duck.ino
  4. +63 −0 test.script
@@ -31,18 +31,4 @@
#define I2C_CLOCK_SPEED 100000L #define I2C_CLOCK_SPEED 100000L


#define BUFFER_SIZE 512 #define BUFFER_SIZE 512
#define PACKET_SIZE 32 #define PACKET_SIZE 32

// Test Settings
// #define ENABLE_DEFAULT_DELAY
// #define LED_TEST
// #define OPEN_NOTEPAD
// #define HELLO_WORLD
// define DELAY_TEST
// #define REPEAT_TEST
// #define US_CHAR_TEST
// #define DE_CHAR_TEST
// #define GB_CHAR_TEST
// #define OVERFLOW_TEST
// #define KEYCODE_TEST
// #define CLOSE_NOTEPAD
@@ -26,94 +26,7 @@ namespace duckscript {


bool running { false }; bool running { false };


void testw(const char* msg) {
spiffs::write("/scripts/test.script", (const uint8_t*)msg, strlen(msg));
debugf("Writing \"%s\" to file\n", msg);
}

// ===== PUBLIC ===== // // ===== PUBLIC ===== //
void runTest() {
spiffs::remove("/scripts/test.script");

#ifdef ENABLE_DEFAULT_DELAY
testw("DEFAULTDELAY 200\n");
#endif // ifdef ENABLE_DEFAULT_DELAY

#ifdef LED_TEST
testw("LED 0 100 0\n");
testw("LED 255 0 0\n");
testw("DELAY 1000\n");
testw("LED 0 255 0\n");
testw("DELAY 1000\n");
testw("LED 0 0 255\n");
#endif // ifdef ENABLE_DEFAULT_DELAY

#ifdef OPEN_NOTEPAD
testw("GUI r\n");
testw("STRING notepad\n");
testw("ENTER\n");
#endif // ifdef OPEN_NOTEPAD

#ifdef HELLO_WORLD
testw("STRING Hello World! \n");
testw("ENTER\n");
#endif // ifdef HELLO_WORLD

#ifdef DELAY_TEST
testw("DELAY 1000\n");
testw(".\n");
testw("DELAY 3000\n");
testw(".\n");
testw("DELAY 5000\n");
testw(".\n");
testw("ENTER\n");
#endif // ifdef HELLO_WORLD

#ifdef REPEAT_TEST
testw("STRING Hello World! \n");
testw("REPEAT 2\n");
testw("ENTER\n");
#endif // ifdef REPEAT_TEST

#ifdef US_CHAR_TEST
testw("LOCALE US\n");
testw("STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~`\n");
testw("ENTER\n");
#endif // ifdef ALL_CHAR_TEST

#ifdef DE_CHAR_TEST
testw("LOCALE DE\n");
testw("STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~²³äöüÄÖÜ߀°§` \n");
testw("ENTER\n");
#endif // ifdef ALL_CHAR_TEST

#ifdef GB_CHAR_TEST
testw("LOCALE GB\n");
testw("STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~£¦¬éíúóÉÍÚÓ€\n");
testw("ENTER\n");
#endif // ifdef ALL_CHAR_TEST

#ifdef OVERFLOW_TEST
testw("STRING 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 \n");
testw("ENTER\n");
#endif // ifdef OVERFLOW_TEST

#ifdef KEYCODE_TEST
testw("A\n");
testw("KEYCODE 0x02 0x04\n");
testw("KEYCODE 2 4\n");
#endif // ifdef ALL_CHAR_TEST

#ifdef CLOSE_NOTEPAD
testw("DELAY 5000\n");
testw("ALT F4\n");
testw("RIGHT\n");
testw("ENTER\n");
#endif // ifdef CLOSE_NOTEPAD

run("/scripts/test.script");
}

void run(const String& fileName) { void run(const String& fileName) {
debugf("Run file %s\n", fileName.c_str()); debugf("Run file %s\n", fileName.c_str());
f = spiffs::open(fileName); f = spiffs::open(fileName);
@@ -35,8 +35,6 @@ void setup() {
webserver::begin(); webserver::begin();


debugln("\nESP Duck Started"); debugln("\nESP Duck Started");

duckscript::runTest();
} }


void loop() { void loop() {
@@ -0,0 +1,63 @@
REM default delay
DEFAULTDELAY 200

REM LED Test
LED 0 100 0
LED 255 0 0
DELAY 1000
LED 0 255 0
DELAY 1000
LED 0 0 255

REM open notepad
GUI r
STRING notepad
ENTER

REM hello world
STRING Hello World!
ENTER

REM delay test
DELAY 1000
.
DELAY 3000
.
DELAY 5000
.
ENTER

REM repeat test
STRING Hello World!
REPEAT 2
ENTER

REM us char test
LOCALE US
STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~`
ENTER

REM de char test
LOCALE DE
STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~²³äöüÄÖÜ߀°§`
ENTER

REM gb char test
LOCALE GB
STRING !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~£¦¬éíúóÉÍÚÓ€
ENTER

REM overflow test
STRING 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890 01234567890
ENTER

REM keycode test
A
KEYCODE 0x02 0x04
KEYCODE 2 4

REM close notepad
DELAY 5000
ALT F4
RIGHT
ENTER

0 comments on commit becece3

Please sign in to comment.
You can’t perform that action at this time.