Missed a couple spots when updating the constructor
@ -118,9 +118,9 @@ public class MCP9808 extends I2cDeviceSynchDevice<I2cDeviceSynch>
|
||||
In the construction, we need to add a couple statements in order to communicate with the sensor. The sensor starts off disengaged, meaning that there isn’t any communication, which allows us to change things like the I2C address (more on that later) without causing issues. Once everything has been set up, we need to engage the sensor to start communicating. We also need to run the arming state callback method that deals with situations involving USB cables disconnecting and reconnecting:
|
||||
|
||||
```
|
||||
public MCP9808(I2cDeviceSynch deviceClient)
|
||||
public MCP9808(I2cDeviceSynch deviceClient, boolean deviceClientIsOwned)
|
||||
{
|
||||
super(deviceClient, true);
|
||||
super(deviceClient, deviceClientIsOwned);
|
||||
|
||||
super.registerArmingStateCallback(false);
|
||||
this.deviceClient.engage();
|
||||
@ -227,9 +227,9 @@ Now that we have the registers set up, we can add a few more things to the initi
|
||||
this.deviceClient.setReadWindow(readWindow);
|
||||
}
|
||||
|
||||
public MCP9808(I2cDeviceSynch deviceClient)
|
||||
public MCP9808(I2cDeviceSynch deviceClient, boolean deviceClientIsOwned)
|
||||
{
|
||||
super(deviceClient, true);
|
||||
super(deviceClient, deviceClientIsOwned);
|
||||
|
||||
this.setOptimalReadWindow();
|
||||
this.deviceClient.setI2cAddress(ADDRESS_I2C_DEFAULT);
|
||||
|
Reference in New Issue
Block a user