25 size_t bytes = fwrite(dst, 1, sizeof(config), f); |
25 size_t bytes = fwrite(dst, 1, sizeof(config), f); |
26 fclose(f); |
26 fclose(f); |
27 if (bytes != sizeof(config)) { |
27 if (bytes != sizeof(config)) { |
28 ESP_LOGE(TAG, "/spiffs/etc/config.conf written %d/%d bytes", bytes, sizeof(config)); |
28 ESP_LOGE(TAG, "/spiffs/etc/config.conf written %d/%d bytes", bytes, sizeof(config)); |
29 } else { |
29 } else { |
30 ESP_LOGI(TAG, "/spiffs/etc/config.conf written %d bytes", bytes); |
30 ESP_LOGD(TAG, "/spiffs/etc/config.conf written %d bytes", bytes); |
31 } |
31 } |
32 } |
32 } |
33 |
33 |
34 |
34 |
35 |
35 |
52 write_config(); |
52 write_config(); |
53 } else { |
53 } else { |
54 dst = (uint8_t*)&config; |
54 dst = (uint8_t*)&config; |
55 size_t bytes = fread(dst, 1, sizeof(config), f); |
55 size_t bytes = fread(dst, 1, sizeof(config), f); |
56 fclose(f); |
56 fclose(f); |
57 ESP_LOGI(TAG, "/spiffs/etc/config.conf read %d bytes", bytes); |
57 ESP_LOGD(TAG, "/spiffs/etc/config.conf read %d bytes", bytes); |
58 } |
58 } |
59 } |
59 } |
60 |
60 |
61 |
61 |
62 |
62 |
71 size_t bytes = fwrite(dst, 1, sizeof(units), f); |
71 size_t bytes = fwrite(dst, 1, sizeof(units), f); |
72 fclose(f); |
72 fclose(f); |
73 if (bytes != sizeof(units)) { |
73 if (bytes != sizeof(units)) { |
74 ESP_LOGE(TAG, "/spiffs/etc/units.conf written %d/%d bytes", bytes, sizeof(units)); |
74 ESP_LOGE(TAG, "/spiffs/etc/units.conf written %d/%d bytes", bytes, sizeof(units)); |
75 } else { |
75 } else { |
76 ESP_LOGI(TAG, "/spiffs/etc/units.conf written %d bytes", bytes); |
76 ESP_LOGD(TAG, "/spiffs/etc/units.conf written %d bytes", bytes); |
77 } |
77 } |
78 } |
78 } |
79 |
79 |
80 |
80 |
81 |
81 |