Skip to content

Commit

Permalink
Merge pull request #83 from MilhoNerfado/51-esp-idf-plug
Browse files Browse the repository at this point in the history
Add esp-idf plugin
  • Loading branch information
matheuswhite authored Jun 5, 2024
2 parents 18de50a + aee1c95 commit 1582745
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions plugins/idf.lua
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

0 comments on commit 1582745

Please sign in to comment.