()
| 1208 | } |
| 1209 | } |
| 1210 | run() { |
| 1211 | if (this.platform === "esp") { |
| 1212 | let base; |
| 1213 | if (this.windows) { |
| 1214 | base = this.environment.BASE_DIR ?? this.getenv("BASE_DIR") ?? this.getenv("USERPROFILE"); |
| 1215 | this.environment.BASE_DIR = base; |
| 1216 | this.setenv("BASE_DIR", base); |
| 1217 | base = this.resolveDirectoryPath(base + this.slash + "esp" + this.slash); |
| 1218 | if (!base) |
| 1219 | throw new Error("esp directory not found"); |
| 1220 | } |
| 1221 | else { |
| 1222 | base = this.environment.ESP_BASE ?? this.getenv("ESP_BASE"); |
| 1223 | if (!base) { |
| 1224 | base = this.resolveDirectoryPath(this.getenv("HOME") + "/esp/"); |
| 1225 | if (!base) |
| 1226 | throw new Error("esp directory not found"); |
| 1227 | } |
| 1228 | this.environment.ESP_BASE = base; |
| 1229 | this.setenv("ESP_BASE", base); |
| 1230 | } |
| 1231 | |
| 1232 | this.environment.ARDUINO_ROOT = base + this.slash + "esp8266-2.3.0"; |
| 1233 | this.setenv("ARDUINO_ROOT", this.environment.ARDUINO_ROOT); |
| 1234 | } |
| 1235 | else if (this.platform === "zephyr") { |
| 1236 | let temp = this.environment.ZEPHYR_BASE ?? this.getenv("ZEPHYR_BASE"); |
| 1237 | if (!temp) |
| 1238 | throw new Error ("$ZEPHYR_BASE not set. See set-up instructions at https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/devices/zephyr.md"); |
| 1239 | |
| 1240 | this.environment.ZEPHYR_BASE = temp; |
| 1241 | |
| 1242 | temp = this.environment.UPLOAD_PORT ?? this.getenv("UPLOAD_PORT"); |
| 1243 | if (!temp) { |
| 1244 | if (this.currentPlatform === "mac") { |
| 1245 | if (this.environment.ZEPHYR_PID && this.environment.ZEPHYR_VID) |
| 1246 | temp = this.environment.ZEPHYR_VID + ":" + this.environment.ZEPHYR_PID; |
| 1247 | else |
| 1248 | temp = "0483:374b"; // STMicroelectronics dev boards |
| 1249 | } |
| 1250 | else if (this.currentPlatform === "win") |
| 1251 | temp = "COM3"; |
| 1252 | else |
| 1253 | temp = "/dev/ttyACM0"; |
| 1254 | this.setenv("UPLOAD_PORT", temp); |
| 1255 | trace(`$UPLOAD_PORT not set. Using "${temp}".\n`); |
| 1256 | } |
| 1257 | this.environment.UPLOAD_PORT = temp; |
| 1258 | |
| 1259 | temp = this.environment.DEBUGGER_PORT ?? this.getenv("DEBUGGER_PORT"); |
| 1260 | if (!temp) |
| 1261 | temp = this.environment.UPLOAD_PORT; |
| 1262 | this.environment.DEBUGGER_PORT = temp; |
| 1263 | this.setenv("DEBUGGER_PORT", temp); |
| 1264 | trace(`$DEBUGGER_PORT set to "${temp}".\n`); |
| 1265 | |
| 1266 | temp = this.environment.DEBUGGER_SPEED ?? this.getenv("DEBUGGER_SPEED"); |
| 1267 | if (!temp) |
nothing calls this directly
no test coverage detected