Skip to content

Commit 8766415

Browse files
authored
fix uploadfs
1 parent b27efb2 commit 8766415

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

platform.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ def install_tool(TOOL, retry_count=0):
187187
if check_tool in package:
188188
install_tool(package)
189189

190-
if "buildfs" in targets:
190+
if "buildfs" or "uploadfs" in targets:
191191
filesystem = variables.get("board_build.filesystem", "littlefs")
192192
if filesystem == "littlefs":
193193
# ensure use of mklittlefs 3.2.0
194194
piopm_path = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tool-mklittlefs", ".piopm")
195195
if os.path.exists(piopm_path):
196196
with open(piopm_path, "r") as file:
197197
package_data = json.load(file)
198-
if package_data['version'] == "4.0.0":
198+
if package_data['version'] != "3.2.0":
199199
os.remove(piopm_path)
200200
install_tool("tool-mklittlefs")
201201
elif filesystem == "fatfs":
@@ -226,10 +226,15 @@ def install_tool(TOOL, retry_count=0):
226226
os.path.join(mklittlefs400_dir, "package.json"),
227227
)
228228
shutil.copytree(mklittlefs400_dir, mklittlefs_dir, dirs_exist_ok=True)
229+
del self.packages["tool-mkfatfs"]
230+
elif filesystem == "fatfs":
231+
install_tool("tool-mkfatfs")
229232

230233
# Currently only Arduino Nano ESP32 uses the dfuutil tool as uploader
231234
if variables.get("board") == "arduino_nano_esp32":
232235
install_tool("tool-dfuutil-arduino")
236+
else:
237+
del self.packages["tool-dfuutil-arduino"]
233238

234239
return super().configure_default_packages(variables, targets)
235240

0 commit comments

Comments
 (0)