|
@@ -1,16 +1,27 @@
|
|
|
#include <Arduino.h>
|
|
|
#include "config.h"
|
|
|
#include "sdcard.h"
|
|
|
+#include "ArduinoJson.h"
|
|
|
extern SdFs SD;
|
|
|
extern FsFile LOG_FILE;
|
|
|
extern byte SCSI_INFO_BUF[SCSI_INFO_BUF_SIZE];
|
|
|
// If config file exists, read the first three lines and copy the contents.
|
|
|
// File must be well formed or you will get junk in the SCSI Vendor fields.
|
|
|
-void readSCSIDeviceConfig() {
|
|
|
- FsFile config_file = SD.open("scsi-config.txt", O_RDONLY);
|
|
|
+void readSCSIDeviceConfig(uint8_t disc) {
|
|
|
+ StaticJsonDocument<2048> config;
|
|
|
+ FsFile config_file = SD.open("blacksasi.json", O_RDONLY);
|
|
|
if (!config_file.isOpen()) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ DeserializationError error = deserializeJson(config, config_file);
|
|
|
+ if (error){
|
|
|
+ Serial.println(F("Failed to read file"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String configx =config["config"];
|
|
|
+ Serial.println(configx);
|
|
|
+ /*
|
|
|
char vendor[SCSI_INFO_VENDOR_SIZE];
|
|
|
memset(vendor, 0, sizeof(vendor));
|
|
|
config_file.readBytes(vendor, sizeof(vendor));
|
|
@@ -32,4 +43,5 @@ void readSCSIDeviceConfig() {
|
|
|
LOG_FILE.println(version);
|
|
|
memcpy(&(SCSI_INFO_BUF[32]), version, 4);
|
|
|
config_file.close();
|
|
|
+ */
|
|
|
}
|