Go Down

Topic: uploading an include file to an ESP8266 (Read 84 times) previous topic - next topic

NextPirate

I've been search for a way to upload "settings.h" to an ESP8266 with having to flash the chip.

I have found where we can Post files to SPIFF but have yet to find how I can POST a file to where it can be used as an "include" file in the Sketch.

I tried #include </data/settings.h> but that yields an error.

The idea is that in operation the chip will be physically installed in a place that is hard to get at.  In order to update the chip with configuration settings for ht e application, I put all those settings in an Include file. 

What I want to do is to replace the Include file (Setting.h) using a call to the ESP8266.

I was following this but I could not figure out how to get the file to anyplace but in /data inthe SPIFF:

https://tttapa.github.io/ESP8266/Chap12%20-%20Uploading%20to%20Server.html


PieterP

You can't.

Settings.h is added to your source code by the preprocessor, so the path is a path on your computer. Then it is compiled into an executable file.

You cannot possibly change it at runtime, you have to compile it again.

What you can do is adding a config file that you add to the SPIFFS and read it in the setup, setting some configuration variables.

Pieter

NextPirate


Go Up