diff --git a/README.md b/README.md index 87c00f4..cb1aaf2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ There are in .github/workflows/ files:\ esp-extrinsics.yml -> act -j esp8622 -> to build by arduino-cli binary for target device and run library unit tests # Deploy -1. Set up in Private.h file proper values of keys and addresses for subscription owner and device.\ +1. Set up in Private.h file proper values of keys (Note: ED25519 scheme!) and addresses for subscription owner and device.\ Note: to explore/create existing key/address can be used sub.py script from this repository or subkey utility from substrate\ i.e. to get keys for known account mnemonic phrase:\ subkey inspect "some ... mnemonics" --network robonomics --scheme ed25519\ @@ -29,4 +29,4 @@ After ESP8266 reset you have 3 seconds window to send URL as string, i.e.: http - 3rd byte: 1st character of URL # Submit of extrinsic be checked in polkadot web UI -> Network -> Explorer -https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama.rpc.robonomics.network%2F#/explorer \ No newline at end of file +https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama.rpc.robonomics.network%2F#/explorer diff --git a/libraries/Crypto/src/AES.h b/libraries/Crypto/src/AES.h old mode 100644 new mode 100755 index 63adc6d..5685319 --- a/libraries/Crypto/src/AES.h +++ b/libraries/Crypto/src/AES.h @@ -27,7 +27,8 @@ // Determine which AES implementation to export to applications. #if defined(ESP32) -#define CRYPTO_AES_ESP32 1 +// fix to allow build for ESP32 +// #define CRYPTO_AES_ESP32 1 #else #define CRYPTO_AES_DEFAULT 1 #endif diff --git a/libraries/RpcRobonomics/Defines.h b/libraries/RpcRobonomics/Defines.h old mode 100644 new mode 100755 index 9c9bf6c..85145d6 --- a/libraries/RpcRobonomics/Defines.h +++ b/libraries/RpcRobonomics/Defines.h @@ -1,7 +1,14 @@ #pragma once +#define USE_ARDUINO + +#ifdef USE_ARDUINO +// ESP32 or ES8266 in other case +// #define ESP32_MODEL +#endif + #define KEYS_SIZE 32 #define SIGNATURE_SIZE 64 #define URLRPC "http://kusama.rpc.robonomics.network/rpc/" //#define URLRPC "http://192.168.0.100:9933" -//#define DEBUG_PRINT \ No newline at end of file +//#define DEBUG_PRINT diff --git a/libraries/RpcRobonomics/RpcRobonomics.h b/libraries/RpcRobonomics/RpcRobonomics.h old mode 100644 new mode 100755 index 6dd3e85..236576c --- a/libraries/RpcRobonomics/RpcRobonomics.h +++ b/libraries/RpcRobonomics/RpcRobonomics.h @@ -1,12 +1,17 @@ #pragma once -#include -#include - +#include #include #include #include -#include + +#ifdef ESP32_MODEL +#include +#include +#else +#include +#include +#endif typedef struct { std::string body; // responce body diff --git a/libraries/RpcRobonomics/esp32.diff b/libraries/RpcRobonomics/esp32.diff new file mode 100644 index 0000000..c216868 --- /dev/null +++ b/libraries/RpcRobonomics/esp32.diff @@ -0,0 +1,4 @@ +7c7 +< // #define ESP32_MODEL +--- +> #define ESP32_MODEL diff --git a/rpcjsonc/rpcjsonc.ino b/rpcjsonc/rpcjsonc.ino index 02d173f..bf081aa 100644 --- a/rpcjsonc/rpcjsonc.ino +++ b/rpcjsonc/rpcjsonc.ino @@ -2,12 +2,18 @@ #include #include -#include -#include #include - +#include #include +#ifdef ESP32_MODEL +#include +#include +#else +#include +#include +#endif + // WiFi credentials and private keys are hidden in Private.h file // pub keys are derived on ctor of RobonomicsRpc // need to have derived or generated PUB_OWNER_KEY, SS58_ADR, SS58_DEVICE_ADR @@ -147,7 +153,7 @@ void loop () { #else Serial.println("RPC RWS task run"); RobonomicsRpc rpcProvider(client, robonomics_url, PRIV_DEVICE_KEY, SS58_DEVICE_ADR, id_counter); - RpcResult r = rpcProvider.RwsDatalogRecord(PUB_OWNER_KEY, std::to_string(id_counter)); + RpcResult r = rpcProvider.RwsDatalogRecord(PUB_OWNER_KEY, PUB_OWNER_KEY); #endif coins_count += 10000; id_counter = id_counter + 2;