Dev/g2 fix configure chip startup (#1009)

* g2: chip reconfigure variable not set when powering on at startup because readconfig is the one configuring the chip the first time to default chip settings

* cleaning up code
This commit is contained in:
maliakal_d 2024-10-22 17:19:28 +02:00 committed by GitHub
parent 6fcdba56a4
commit 37e65634d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View File

@ -987,6 +987,8 @@ int readConfigFile() {
// to inform powerchip config parameters are set
startupPowerChipConfigDone = 1;
chipConfigured = 1;
LOG(logINFOBLUE, ("Chip configured\n"));
}
return initError;
}
@ -2278,8 +2280,7 @@ int powerChip(int on, char *mess) {
if (on) {
LOG(logINFO, ("Powering chip: on\n"));
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK);
// only if power chip config done, configure chip with current set up
if (startupPowerChipConfigDone == 1 && configureChip(mess) == FAIL)
if (configureChip(mess) == FAIL)
return FAIL;
} else {
// throw if high voltage on
@ -2310,6 +2311,12 @@ int getPowerChip() {
int isChipConfigured() { return chipConfigured; }
int configureChip(char *mess) {
if (!startupPowerChipConfigDone) {
LOG(logINFOBLUE,
("Startup: Chip to be configured when reading config file\n"));
return OK;
}
LOG(logINFOBLUE, ("\tConfiguring chip\n"));
// on chip dacs

View File

@ -9,6 +9,6 @@
#define APIEIGER "developer 0x240918"
#define APIMYTHEN3 "developer 0x241001"
#define APIJUNGFRAU "developer 0x241001"
#define APIGOTTHARD2 "developer 0x241007"
#define APIRECEIVER "developer 0x241014"
#define APILIB "developer 0x241021"
#define APIGOTTHARD2 "developer 0x241022"