Skip to content

Commit fc61e4b

Browse files
committed
Try to stagger SCD30 readings to stagger the peak current draw
1 parent 910925d commit fc61e4b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Firmware/OpenLog_Artemis/autoDetect.ino

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ bool beginQwiicDevices()
268268

269269
qwiicPowerOnDelayMillis = settings.qwiicBusPowerUpDelayMs; // Set qwiicPowerOnDelayMillis to the _minimum_ defined by settings.qwiicBusPowerUpDelayMs. It will be increased if required.
270270

271+
int numberOfSCD30s = 0; // Keep track of how many SCD30s we begin so we can delay before starting the second and subsequent ones
272+
271273
//Step through the list
272274
node *temp = head;
273275

@@ -395,6 +397,13 @@ bool beginQwiicDevices()
395397
SCD30 *tempDevice = (SCD30 *)temp->classPtr;
396398
struct_SCD30 *nodeSetting = (struct_SCD30 *)temp->configPtr; //Create a local pointer that points to same spot as node does
397399
if (nodeSetting->powerOnDelayMillis > qwiicPowerOnDelayMillis) qwiicPowerOnDelayMillis = nodeSetting->powerOnDelayMillis; // Increase qwiicPowerOnDelayMillis if required
400+
numberOfSCD30s++; // Keep track of how many SCD30s we begin
401+
// Delay before starting the second and subsequent SCD30s to try and stagger the measurements and the peak current draw
402+
if (numberOfSCD30s >= 2)
403+
{
404+
printDebug("beginQwiicDevices: found more than one SCD30. Delaying for 375ms to stagger the peak current draw...\r\n");
405+
delay(375);
406+
}
398407
temp->online = tempDevice->begin(qwiic); //Wire port
399408
}
400409
break;
@@ -1127,7 +1136,8 @@ deviceType_e testDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumb
11271136
//Confidence: High - begin now checks FW Ver CRC
11281137
SCD30 sensor1;
11291138
//sensor1.enableDebugging();
1130-
if (sensor1.begin(qwiic) == true) //Wire port
1139+
// Set measBegin to false. beginQwiicDevices will call begin with measBegin set true.
1140+
if (sensor1.begin(qwiic, true, false) == true) //Wire port, autoCalibrate, measBegin
11311141
return (DEVICE_CO2_SCD30);
11321142
}
11331143
break;

0 commit comments

Comments
 (0)