Create an interface so that the feed factor can also be set on the configuration interface.
This involves creating an endpoint and incorporating it into the interface on the configuration interface.
The approaches to this can already be found in the LoggingManager under delete_first_n_lines.
The procedure is as follows:
a temporary file is created in "w" mode.
the system.log is scanned up to the new first line.
transfer to the new file is started.
the system.log is deleted and the temporary file is renamed.
An error occurs here during the last step. It seems that system.log is still open. However, I am very sure that this is not the case.
I have already tried to do the whole thing without a temporary file using a string buffer. However, that did not work either. I don't know exactly but I can't seem to write anything to the file. It would be good to start at that point.
For debugging, you can proceed as follows:
make start upload fs and flash code
connect to the wifi
via https://192.168.4.1/logging you can read the content of the system.log.
you can find more information about the length of the file and a bit more at https://192.168.4.1/log_lines.
A file is to be added so that it can be logged exactly when feeding took place. A separate lib is to be written that takes over the logging with classic log levels.
The format should look as follows: "[Time] - [Level] - [Message]".
The log file is to be output completely via a page "/logging".
Unfortunately I don't have an esp8266 here, so it would be great if you could load the builds from the latest release onto your esp8266 soon. You can also find how to do this (a command) in the README.md. I would be very happy if you could do this.
So that only a new configuration has to be entered, it should also be possible to set the FEED_FACTOR from the main.cpp in the config.json. The FEED_FACTOR is responsible for the calibration of the feed quantity in grams.
TODO
To do this, the ConfigManager (ConfigManager::save_config() and ConfigManager::load_config()) and the associated feed_config_t type must be adapted.
So that the configuration interface can also be accessed via a local domain, another configuration hostname and subnetmask could be added to config.json under wifi. This also creates further transparency as to how exactly the configuration interface can be called up.
Todo
For this, the config.json(-template), the ConfigManager (save, load and the wifi type), the main.cpp (wifi config and such), as well as the documentation (README.md) must be adapted.
If the config.json does not exist, the template should be renamed to config.json. If the config.json already exists, the template can also be deleted.
To do this, look at ConfigManager.cpp under ./lib/ConfigManager. This functionality can be implemented in the constructor. You can also write your own private function if you need this routine more often.
When the automatic sleep mode is activated, it should still be ensured that the feeding is turned off.
To do this, look at the place where the sleep mode is automatically activated in the main.cpp.