ESP32 ArduinoNVS or Preferences - unable to store Strings of 80 bytes.

Hello everyone.
Having not found the solution to store 80-byte files on SPIFFS or with LittleFS, I tried initially in vain with the ArduinoNVS library and then with Preferences.
In both cases, it seems impossible to store more than 8 bytes: the recording process goes well, but upon rereading, the file is empty.
The recording routine:
C++
Preferences pref;

//*********NVS recording of a complete program (10 manipulations of 8 bytes each) 6x => Px   x=0 to 9
case '6': {
    String tempo = "";
    char nFic[3];
    nprog = ci(com[1]); //program number ASCII to Numeric Conversion
    if (!(nprog >= 0 && nprog <= 9)) afficErreurs(prg);
    else {
        nFic[0] = 'P'; nFic[1] = com[1]; nFic[2] = '\0'; //file number Px with x=0 to 9
        for (int i = 0; i < 80; i++) {
            tempo += pg[nprog][i]; //char pg[10][80];   10 programs of 8*10 manipulations
        }
        int size = pref.putString(nFic, tempo); //in file Px, we save the entire program x
        lcd.clear(); lcd.print(size); delay(2000); lcd.clear();
    }
}
break;

The result correctly indicates the number of bytes saved. However, upon rereading, the recording is empty.

C++
//****display programmed memory x *****
case '5': {
    String tempo = "";
    char prog[3];
    prog[0] = 'P'; prog[1] = com[1]; prog[2] = '\0';
    tempo = pref.getString(prog, "");
    for (i = 0; i < 10; i++) {
        lcd.clear(); lcd.print(String(prog) + " " + String(i));
        lcd.setCursor(0, 1); lcd.print(tempo.substring(i * 8, i * 8 + 8)); //display in sets of 8 bytes
        delay('s', 2);
    }
}
break;

If anyone has an idea for this problem.
Was this page helpful?