move to esptool-wrapper for flashing esp devices
This commit is contained in:
parent
7028879878
commit
384b0ba8ee
3 changed files with 34 additions and 34 deletions
|
@ -22,6 +22,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^2.6.1",
|
"async": "^2.6.1",
|
||||||
|
"esptool-wrapper": "^1.0.4",
|
||||||
"serialport": "^6.2.2",
|
"serialport": "^6.2.2",
|
||||||
"tape": "^4.9.1",
|
"tape": "^4.9.1",
|
||||||
"testbed-query-fixtures": "^1.0.0"
|
"testbed-query-fixtures": "^1.0.0"
|
||||||
|
|
|
@ -121,9 +121,11 @@ void set_mode(void *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void send(void *args) {
|
void send(void *args) {
|
||||||
ESP_LOGI(TAG, "sending: %s\n", (char*)args);
|
ESP_LOGI(TAG, "sending: %s", (char*)args);
|
||||||
|
|
||||||
lora32_send(&lora, (uint8_t *)args, 12);
|
lora32_send(&lora, (uint8_t *)args, 12);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "done");
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_spreadfactor(void *args) {
|
void set_spreadfactor(void *args) {
|
||||||
|
|
45
test/test.js
45
test/test.js
|
@ -1,4 +1,5 @@
|
||||||
var async = require("async");
|
var async = require("async");
|
||||||
|
var esptool = require("esptool-wrapper");
|
||||||
var homedir = require("homedir")();
|
var homedir = require("homedir")();
|
||||||
var spawn = require("child_process").spawn;
|
var spawn = require("child_process").spawn;
|
||||||
var SerialPort = require("serialport");
|
var SerialPort = require("serialport");
|
||||||
|
@ -6,8 +7,6 @@ var path = require("path");
|
||||||
var test = require("tape");
|
var test = require("tape");
|
||||||
var testbed = require("testbed-query-fixtures");
|
var testbed = require("testbed-query-fixtures");
|
||||||
|
|
||||||
const exec = path.join(process.env.IDF_PATH, "components", "esptool_py", "esptool", "esptool.py");
|
|
||||||
|
|
||||||
const buildPath = path.join(__dirname, "lora32", "build");
|
const buildPath = path.join(__dirname, "lora32", "build");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -31,41 +30,39 @@ if(devices.length < 2) {
|
||||||
const TB_DEV1 = devices[0].DEVNAME;
|
const TB_DEV1 = devices[0].DEVNAME;
|
||||||
const TB_DEV2 = devices[1].DEVNAME;
|
const TB_DEV2 = devices[1].DEVNAME;
|
||||||
|
|
||||||
var args = [
|
var testBins = {
|
||||||
"--chip",
|
0x1000: path.join(buildPath, "bootloader/bootloader.bin"),
|
||||||
"esp32",
|
0x8000: path.join(buildPath, "partitions_singleapp.bin"),
|
||||||
"--baud",
|
0x10000: path.join(buildPath, "lora32.bin")
|
||||||
"460800",
|
};
|
||||||
|
|
||||||
|
function flash(port, cb) {
|
||||||
|
var argsReset = [
|
||||||
"--before",
|
"--before",
|
||||||
"default_reset",
|
"default_reset",
|
||||||
"--after",
|
"--after",
|
||||||
"hard_reset",
|
"hard_reset"
|
||||||
"write_flash",
|
];
|
||||||
|
|
||||||
|
var argsWriteFlash = [
|
||||||
"-z",
|
"-z",
|
||||||
"--flash_mode",
|
"--flash_mode",
|
||||||
"dio",
|
"dio",
|
||||||
"--flash_freq",
|
"--flash_freq",
|
||||||
"40m",
|
"40m",
|
||||||
"--flash_size",
|
"--flash_size",
|
||||||
"detect",
|
"detect"
|
||||||
"0x1000",
|
|
||||||
path.join(buildPath, "bootloader/bootloader.bin"),
|
|
||||||
"0x10000",
|
|
||||||
path.join(buildPath, "lora32.bin"),
|
|
||||||
"0x8000",
|
|
||||||
path.join(buildPath, "partitions_singleapp.bin")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
function flash(port, cb) {
|
|
||||||
console.log("Flashing devices at %s", port);
|
console.log("Flashing devices at %s", port);
|
||||||
|
|
||||||
var cp = spawn(exec, ["--port", port].concat(args));
|
esptool({
|
||||||
|
port: port,
|
||||||
cp.on("exit", function(code) {
|
baud: 460800,
|
||||||
console.log("%s\nexited: %d", port, code);
|
files: testBins,
|
||||||
|
args: argsReset,
|
||||||
cb(code === 0 ? null : new Error("exited non-zero: " + code));
|
cmdArgs: argsWriteFlash
|
||||||
});
|
}, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleReset(sp) {
|
function toggleReset(sp) {
|
||||||
|
|
Loading…
Reference in a new issue