reset to hardware evn if no file

This commit is contained in:
maliakal_d 2020-05-08 18:14:59 +02:00
parent 30078d6c1f
commit 6620027439
2 changed files with 17 additions and 8 deletions

View File

@ -456,6 +456,8 @@ int readConfigFile() {
FILE *fd = fopen(CONFIG_FILE, "r"); FILE *fd = fopen(CONFIG_FILE, "r");
if (fd == NULL) { if (fd == NULL) {
// reset to hardware settings if not in config file (if overwritten)
resetToHardwareSettings();
return OK; return OK;
} }
LOG(logINFO, ("Reading config file %s\n", CONFIG_FILE)); LOG(logINFO, ("Reading config file %s\n", CONFIG_FILE));
@ -565,6 +567,18 @@ int readConfigFile() {
fclose(fd); fclose(fd);
// reset to hardware settings if not in config file (if overwritten) // reset to hardware settings if not in config file (if overwritten)
resetToHardwareSettings();
if (strlen(initErrorMessage)) {
initError = FAIL;
LOG(logERROR, ("%s\n\n", initErrorMessage));
} else {
LOG(logINFO, ("Successfully read config file\n"));
}
return initError;
}
int resetToHardwareSettings() {
#ifndef VIRTUAL #ifndef VIRTUAL
if (top == -1) { if (top == -1) {
if (!Beb_SetTop(TOP_HARDWARE)) { if (!Beb_SetTop(TOP_HARDWARE)) {
@ -595,14 +609,6 @@ int readConfigFile() {
} }
} }
#endif #endif
if (strlen(initErrorMessage)) {
initError = FAIL;
LOG(logERROR, ("%s\n\n", initErrorMessage));
} else {
LOG(logINFO, ("Successfully read config file\n"));
}
return initError;
} }
/* set up detector */ /* set up detector */

View File

@ -115,6 +115,9 @@ int setDefaultDacs();
#if defined(GOTTHARD2D) || defined(EIGERD) #if defined(GOTTHARD2D) || defined(EIGERD)
int readConfigFile(); int readConfigFile();
#endif #endif
#ifdef EIGERD
int resetToHardwareSettings();
#endif
// advanced read/write reg // advanced read/write reg
#ifdef EIGERD #ifdef EIGERD