Skip to content

Commit 2576a3d

Browse files
author
Miles Burton
committed
fix: Resolved merge conflicts - take one million
1 parent f72579e commit 2576a3d

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed
Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
//
2-
// FILE: readPowerSupply.ino
31
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.0
2+
// VERSION: 0.2.0
53
// PURPOSE: demo
6-
// DATE: 2020-02-10
4+
// DATE: 2025-01-04
75
//
86
// Released to the public domain
97
//
@@ -19,24 +17,25 @@
1917
OneWire oneWire(ONE_WIRE_BUS);
2018

2119
// Pass our oneWire reference to Dallas Temperature.
22-
DallasTemperature sensors(&oneWire);
20+
Dallas::DallasTemperature sensors(&oneWire);
21+
22+
// Arrays to hold device addresses
23+
Dallas::DeviceAddress insideThermometer, outsideThermometer;
2324

24-
// arrays to hold device addresses
25-
DeviceAddress insideThermometer, outsideThermometer;
26-
// Assign address manually. The addresses below will beed to be changed
25+
// Assign address manually. The addresses below will need to be changed
2726
// to valid device addresses on your bus. Device address can be retrieved
2827
// by using either oneWire.search(deviceAddress) or individually via
2928
// sensors.getAddress(deviceAddress, index)
30-
// DeviceAddress insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
31-
// DeviceAddress outsideThermometer = { 0x28, 0x3F, 0x1C, 0x31, 0x2, 0x0, 0x0, 0x2 };
29+
// Example:
30+
// Dallas::DeviceAddress insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
31+
// Dallas::DeviceAddress outsideThermometer = { 0x28, 0x3F, 0x1C, 0x31, 0x2, 0x0, 0x0, 0x2 };
3232

3333
int devCount = 0;
3434

3535
/*
3636
* The setup function. We only start the sensors here
3737
*/
38-
void setup(void)
39-
{
38+
void setup(void) {
4039
Serial.begin(115200);
4140
Serial.println("Arduino Temperature Control Library Demo - readPowerSupply");
4241

@@ -46,47 +45,40 @@ void setup(void)
4645
Serial.print("#devices: ");
4746
Serial.println(devCount);
4847

49-
// report parasite power requirements
48+
// Report parasite power requirements
5049
Serial.print("Parasite power is: ");
51-
if (sensors.readPowerSupply()) Serial.println("ON"); // no address means "scan all devices for parasite mode"
50+
if (sensors.isParasitePowerMode()) Serial.println("ON"); // Check parasite mode globally
5251
else Serial.println("OFF");
5352

54-
// Search for devices on the bus and assign based on an index.
53+
// Search for devices on the bus and assign based on an index
5554
if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
5655
if (!sensors.getAddress(outsideThermometer, 1)) Serial.println("Unable to find address for Device 1");
5756

58-
// show the addresses we found on the bus
57+
// Show the addresses we found on the bus
5958
Serial.print("Device 0 Address: ");
6059
printAddress(insideThermometer);
6160
Serial.println();
6261
Serial.print("Power = parasite: ");
6362
Serial.println(sensors.readPowerSupply(insideThermometer));
6463
Serial.println();
65-
Serial.println();
6664

6765
Serial.print("Device 1 Address: ");
6866
printAddress(outsideThermometer);
6967
Serial.println();
7068
Serial.print("Power = parasite: ");
7169
Serial.println(sensors.readPowerSupply(outsideThermometer));
7270
Serial.println();
73-
Serial.println();
7471
}
7572

76-
// function to print a device address
77-
void printAddress(DeviceAddress deviceAddress)
78-
{
79-
for (uint8_t i = 0; i < 8; i++)
80-
{
81-
// zero pad the address if necessary
73+
// Function to print a device address
74+
void printAddress(Dallas::DeviceAddress deviceAddress) {
75+
for (uint8_t i = 0; i < 8; i++) {
76+
// Zero pad the address if necessary
8277
if (deviceAddress[i] < 0x10) Serial.print("0");
8378
Serial.print(deviceAddress[i], HEX);
8479
}
8580
}
8681

87-
// empty on purpose
88-
void loop(void)
89-
{
82+
// Empty on purpose
83+
void loop(void) {
9084
}
91-
92-
// END OF FILE

0 commit comments

Comments
 (0)