Skip to content

Commit

Permalink
feat: add esp-idf plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MilhoNerfado committed May 9, 2024
1 parent f0f9f9b commit d3ec769
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions plugins/esp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
--- 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()
local _, stderr = scope.exec("idf.py")
return stderr ~= nil
end

function serial_rx(msg) end

function user_command(arg_list)
if not check_esp_idf() then
scope.eprintln("esp-idf not found, try exporting esp-idf environment variables first")
return
end

local cmd = "idf.py " .. table.concat(arg_list, " ")

if arg_list[2] == "flash" or "monitor" then
scope.disconnect()
scope.exec(cmd)
scope.connect()
end
end

0 comments on commit d3ec769

Please sign in to comment.