diff --git a/.vscode/settings.json b/.vscode/settings.json index 0f00390..5a82208 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "terminal.integrated.env.windows": { - "PATH": "C:\\Users\\PBRY\\.platformio\\penv\\Scripts;C:\\Users\\PBRY\\.platformio\\penv;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;i:\\MyProjects\\Kicad\\BOM\";C:\\Users\\PBRY\\AppData\\Local\\Programs\\Fiddler;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;i:\\MyProjects\\Kicad\\BOM\";C:\\Users\\PBRY\\AppData\\Local\\Programs\\Fiddler;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin", + "PATH": "C:\\Users\\PBRY\\.platformio\\penv\\Scripts;C:\\Users\\PBRY\\.platformio\\penv;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\nodejs\\;\"C:\\Program Files\\TortoiseSVN\\bin\\\";C:\\Users\\PBRY\\.dnx\\bin;\"C:\\Program Files\\Microsoft DNX\\Dnvm\\\";\"C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\\";\"C:\\Program Files\\Intel\\WiFi\\bin\\\";\"C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\\";i:\\MyProjects\\Kicad\\BOM;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\PBRY\\AppData\\Roaming\\npm;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\nodejs\\;\"C:\\Program Files\\TortoiseSVN\\bin\\\";C:\\Users\\PBRY\\.dnx\\bin;\"C:\\Program Files\\Microsoft DNX\\Dnvm\\\";\"C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\\";\"C:\\Program Files\\Intel\\WiFi\\bin\\\";\"C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\\";i:\\MyProjects\\Kicad\\BOM;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\PBRY\\AppData\\Roaming\\npm", "PLATFORMIO_CALLER": "vscode" } } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index c9539bd..79fc51d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -7,7 +7,7 @@ board = esp12e framework = arduino board_build.flash_mode = dio ;upload_port = com25 -upload_port = finger.local +upload_port = 192.168.1.200 ;finger.local ;upload_port = /dev/ttyUSB0 upload_speed = 230400 lib_deps = diff --git a/src/configuration.h b/src/configuration.h index 1878be4..4da8877 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -72,7 +72,9 @@ #define CORS_DEBUG -#define TX_PIN 1 -#define RX_PIN 3 +//#define TX_PIN 1 +#define TX_PIN 14 +//#define RX_PIN 3 +#define RX_PIN 12 #endif diff --git a/src/vsp.ino b/src/vsp.ino index 0992a05..ee4ae9f 100644 --- a/src/vsp.ino +++ b/src/vsp.ino @@ -157,7 +157,11 @@ void setserialport(int32_t speed, int32_t databits, int32_t parity, int32_t stop // delay(200); SP.end(); delay(10); // 100 - SP.begin(spd, (SerialConfig)serialMode); + #if (TX_PIN != 1) || (RX_PIN != 3) + SP.begin(spd); + #else + SP.begin(spd, (SerialConfig)serialMode); + #endif delay(10); // 100 SP.flush(); serial_tx = 0; @@ -168,7 +172,11 @@ void setserialport(int32_t speed, int32_t databits, int32_t parity, int32_t stop void sputchar(uint8_t c) { +#if (TX_PIN != 1) || (RX_PIN != 3) + if (1) +#else if (fromNet.empty() && SP.availableForWrite()) +#endif { SP.write(c); ++serial_tx; @@ -375,8 +383,15 @@ void vsp_loop() } // testovani, zda neposlat nejaka data do serioveho rozhrani + +#if (TX_PIN != 1) || (RX_PIN != 3) + if (!fromNet.empty()) + { + len = 1; +#else if (!fromNet.empty() && (len = SP.availableForWrite())) { +#endif size_t will_copy = (len < sizeof(sbuf)) ? len : sizeof(sbuf); will_copy = fromNet.read((char *)sbuf, will_copy); SP.write(sbuf, will_copy);