diff --git a/BlynkNCP.jidl b/BlynkNCP.jidl index 8554b27..e286838 100644 --- a/BlynkNCP.jidl +++ b/BlynkNCP.jidl @@ -1,6 +1,6 @@ { "module": "Blynk.NCP", - "@version": "0.6.2", + "@version": "0.6.4", "@author": "Volodymyr Shymanskyy", "@license": "Apache-2.0", "@output_dir": "./src/idl", @@ -194,8 +194,9 @@ "returns": "Bool" }, "otaUpdatePrefetch": { - "returns": "UInt8", - "@timeout": 30000 + "@doc": "Prefetch the firmware file, to reduce the risk of download failure", + "@timeout": 30000, + "returns": "UInt8" }, "factoryReset": { @@ -211,7 +212,7 @@ "returns": "UInt8" }, "factoryTestWiFi": { - "@timeout": 15000, + "@timeout": 30000, "args": [ { "ssid": "String" }, { "pass": "String" }, @@ -298,6 +299,7 @@ "args": [ { "event": "UInt8" } ] }, "otaUpdateAvailable": { + "@timeout": 5000, "args": [ { "filename": "String" }, { "filesize": "UInt32" }, diff --git a/docs/Factory Testing.md b/docs/Factory Testing.md index a01fff8..020f500 100644 --- a/docs/Factory Testing.md +++ b/docs/Factory Testing.md @@ -20,7 +20,7 @@ Perform a connection to the specified WiFi 2.4 Ghz hotspot. **Returns:** `RpcFactoryTestStatus` - `RPC_FACTORY_TEST_INVALID_ARGS` - call is incorrect - `RPC_FACTORY_TEST_WIFI_FAIL` - cannot connect -- `RPC_FACTORY_TEST_LOW_RSSI` - RSSI is **less than -70 dBm** +- `RPC_FACTORY_TEST_LOW_RSSI` - RSSI is **less than -85 dBm** - `RPC_FACTORY_TEST_OK` - all is OK ## `rpc_blynk_factoryTestConnect()` diff --git a/src/idl/rpc_shim_blynk.h b/src/idl/rpc_shim_blynk.h index 2dbf1e5..283beb1 100644 --- a/src/idl/rpc_shim_blynk.h +++ b/src/idl/rpc_shim_blynk.h @@ -669,7 +669,9 @@ bool rpc_blynk_otaUpdateGetSHA256(rpc_buffer_t* digest) { return _rpc_ret_val; } - +/* + * Prefetch the firmware file, to reduce the risk of download failure + */ static inline uint8_t rpc_blynk_otaUpdatePrefetch(void) { RpcStatus _rpc_res; @@ -787,7 +789,7 @@ uint8_t rpc_blynk_factoryTestWiFi(const char* ssid, const char* pass, int16_t* r /* Wait response */ MessageBuffer _rsp_buff; MessageBuffer_init(&_rsp_buff, NULL, 0); - _rpc_res = rpc_wait_result(_rpc_seq, &_rsp_buff, 15000); + _rpc_res = rpc_wait_result(_rpc_seq, &_rsp_buff, 30000); if (_rpc_res == RPC_STATUS_OK) { /* Deserialize outputs */ MessageBuffer_readInt16(&_rsp_buff, rssi); diff --git a/src/idl/rpc_shim_client.h b/src/idl/rpc_shim_client.h index 484c0f9..10a2fc1 100644 --- a/src/idl/rpc_shim_client.h +++ b/src/idl/rpc_shim_client.h @@ -68,7 +68,7 @@ bool rpc_client_otaUpdateAvailable(const char* filename, uint32_t filesize, cons /* Wait response */ MessageBuffer _rsp_buff; MessageBuffer_init(&_rsp_buff, NULL, 0); - _rpc_res = rpc_wait_result(_rpc_seq, &_rsp_buff, RPC_TIMEOUT_DEFAULT); + _rpc_res = rpc_wait_result(_rpc_seq, &_rsp_buff, 5000); if (_rpc_res == RPC_STATUS_OK) { /* Deserialize outputs */ MessageBuffer_readBool(&_rsp_buff, &_rpc_ret_val); diff --git a/test/ncptool.py b/test/ncptool.py index e2c82e1..3036e37 100755 --- a/test/ncptool.py +++ b/test/ncptool.py @@ -5,8 +5,10 @@ ncptool.py /dev/ttyUSB0 --initRGB 15 12 13 0 ncptool.py /dev/ttyUSB0 --setLedBrightness 128 ncptool.py /dev/ttyUSB0 --reboot + ncptool.py /dev/ttyUSB0 --factoryTestWiFi SSID PASS """ +import sys import asyncio import aioserial import struct @@ -364,12 +366,15 @@ async def rpc_blynk_factoryTestWiFi(ssid, password): req = MessageBuffer() req.write_cstring(ssid) req.write_cstring(password) - rsp = await rpcInvoke(RpcUID.BLYNK_FACTORYTESTWIFI, req, 15000) + rsp = await rpcInvoke(RpcUID.BLYNK_FACTORYTESTWIFI, req, 30000) rssi = rsp.read_int16() retval = FactoryTestStatus(rsp.read_uint8()) print(f"Status: {retval.name}") print(f"RSSI: {rssi}dBm") + if not retval == FactoryTestStatus.FACTORY_TEST_OK: + sys.exit(1) + async def rpc_blynk_factoryTestWiFiAP(channel): req = MessageBuffer() req.write_uint16(channel)