Difference between revisions of "Settings storage layout"

From Let's Control It
Jump to navigation Jump to search
Line 6: Line 6:
 
The levels of indent resemble:
 
The levels of indent resemble:
 
: Filename
 
: Filename
:: Variable in ESPEasy
+
:: Variable (struct) in ESPEasy
 
::: Some explanation
 
::: Some explanation
  

Revision as of 00:16, 23 January 2018

Settings Storage Layout

ESP Easy uses a lot of structs to store the internal settings. Some of these structs are stored as a memory dump inside a binary file, which is stored in SPIFFS.

The levels of indent resemble:

Filename
Variable (struct) in ESPEasy
Some explanation

SPIFFS storage:

   security.dat:
       SecuritySettings    
           struct:   SecurityStruct
           function: LoadSettings(), SaveSettings()
           offset:   0
           maxsize: 
   config.dat:
       Settings
           struct:   SettingsStruct
           function: LoadSettings(), SaveSettings()
           offset:   0
           maxsize:  4096 (DAT_OFFSET_TASKS)
       ExtraTaskSettings[TaskIndex]
           struct:   ExtraTaskSettingsStruct
           function: LoadTaskSettings(TaskIndex), SaveTaskSettings(TaskIndex)
           offset:   DAT_OFFSET_TASKS + (TaskIndex * DAT_TASKS_SIZE)
           maxsize:  1024 (DAT_TASKS_SIZE shared between CustomTaskSettings & ExtraTaskSettings)
       CustomTaskSettings[TaskIndex]  
           struct:   free 
                     P012_LCD:  char deviceTemplate[4][80];
                     P036_FrameOLED: char deviceTemplate[Nlines][32];
                     P037_MQTTImport: char deviceTemplate[4][41];  // variable for saving the subscription topics
           function: LoadCustomTaskSettings(int TaskIndex, byte* memAddress, int datasize)
                     SaveCustomTaskSettings(int TaskIndex, byte* memAddress, int datasize)
           offset:   DAT_OFFSET_TASKS + (TaskIndex * DAT_TASKS_SIZE) + DAT_TASKS_CUSTOM_OFFSET
           maxsize:  1024 (DAT_TASKS_SIZE shared between CustomTaskSettings & ExtraTaskSettings)
       ControllerSettings[ControllerIndex]
           struct:   ControllerSettingsStruct
           function: LoadControllerSettings(int ControllerIndex, byte* memAddress, int datasize)
                     SaveControllerSettings(int ControllerIndex, byte* memAddress, int datasize)
           offset:   DAT_OFFSET_CONTROLLER + (ControllerIndex * DAT_CONTROLLER_SIZE)
           maxsize:  DAT_CONTROLLER_SIZE              1024
       CustomControllerSettings[ControllerIndex]
           struct:   ControllerSpecific
                     C011_ConfigStruct                   
           function: LoadCustomControllerSettings(int ControllerIndex,byte* memAddress, int datasize)
                     SaveCustomControllerSettings(int ControllerIndex,byte* memAddress, int datasize)
           offset:   DAT_OFFSET_CUSTOM_CONTROLLER + (ControllerIndex * DAT_CUSTOM_CONTROLLER_SIZE)
           maxsize:  DAT_CUSTOM_CONTROLLER_SIZE       1024
   notification.dat:
       NotificationSettings[NotificationIndex]
           struct:   NotificationSettingsStruct
           function: LoadNotificationSettings(int NotificationIndex, byte* memAddress, int datasize)
                     SaveNotificationSettings(int NotificationIndex, byte* memAddress, int datasize)
           offset:   NotificationIndex * DAT_NOTIFICATION_SIZE
           maxsize:  DAT_NOTIFICATION_SIZE            1024
           
           
  1. define DAT_TASKS_SIZE 2048
  2. define DAT_TASKS_CUSTOM_OFFSET 1024
  3. define DAT_CUSTOM_CONTROLLER_SIZE 1024
  4. define DAT_CONTROLLER_SIZE 1024
  5. define DAT_NOTIFICATION_SIZE 1024
  1. define DAT_OFFSET_TASKS 4096 // each task = 2k, (1024 basic + 1024 bytes custom), 12 max
  2. define DAT_OFFSET_CONTROLLER 28672 // each controller = 1k, 4 max
  3. define DAT_OFFSET_CUSTOM_CONTROLLER 32768 // each custom controller config = 1k, 4 max.