-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from MilhoNerfado/51-esp-idf-plug
Add esp-idf plugin
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
--- Generated by EmmyLua(https://github.com/EmmyLua) | ||
--- Created by MilhoNerfado. | ||
--- DateTime: 07/05/24 17:00 | ||
--- | ||
|
||
require("scope") | ||
|
||
-- Validates if esp-idf is available | ||
local function check_esp_idf() | ||
stdout, stderr = scope.exec("idf.py", true) | ||
return #stderr == 0 | ||
end | ||
|
||
function serial_rx(msg) end | ||
|
||
function user_command(arg_list) | ||
if arg_list[1] == "monitor" then | ||
scope.eprintln("Cannot run idf.py monitor inside Scope") | ||
return | ||
end | ||
|
||
if not check_esp_idf() then | ||
scope.eprintln("idf.py not found, try exporting idf.py environment variables first") | ||
return | ||
end | ||
|
||
local cmd = "idf.py " .. table.concat(arg_list, " ") | ||
|
||
if arg_list[1] == "flash" then | ||
scope.disconnect() | ||
end | ||
|
||
scope.exec(cmd) | ||
|
||
if arg_list[1] == "flash" then | ||
scope.connect() | ||
end | ||
end |