Skip to content

File examples and Spiffs on ESP32 #162

Description

@wilberforce

The files examples just use a filename 'test.txt', however I have discovered that a path needs to be supplied for both the the win and esp32 cases.

For the esp32 - it needs to be /spiffs/test.txt and on the desktop you can specify ./folder/test.txt and it will read/write in the the current project folder.

./ also works for windows - c:\\users\....\\ is not necesssary.

For the ESP32 you also need to add the partitions csv to the manifest. My current manifest looks like this:

{
	"platforms":{
		"esp32": {
			"build": {
				"PARTITIONS_FILE": "$(MODDABLE)/examples/files/files/partitions.csv",
			},
			"config": {
				"root_fs": "/spiffs/",
			},
		},
		"win": {
			"config": {
				"root_fs": "./dist/",
			},
		},		
	},
...
}

so this alows:

import config from "mc/config";
const root = config.root_fs;

Which keeps the code platform independant. Will this sort of thing confuse the basic examples or should it be constributed as separate example? The current examples hint at this with commented out code that could be fleshed out.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions