@@ -45,13 +45,13 @@ DS18X20Controller::~DS18X20Controller() { delete _DS18X20_model; }
45
45
bool DS18X20Controller::Handle_Ds18x20Add (pb_istream_t *stream) {
46
46
// Attempt to decode the incoming message into a Ds18x20Add message
47
47
if (!_DS18X20_model->DecodeDS18x20Add (stream)) {
48
- WS_DEBUG_PRINTLN (" ERROR: Unable to decode Ds18x20Add message" );
48
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Unable to decode Ds18x20Add message" );
49
49
return false ;
50
50
}
51
51
52
52
// If we receive no sensor types to configure, bail out
53
53
if (_DS18X20_model->GetDS18x20AddMsg ()->sensor_types_count == 0 ) {
54
- WS_DEBUG_PRINTLN (" ERROR: No ds18x sensor types provided!" );
54
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : No ds18x sensor types provided!" );
55
55
return false ;
56
56
}
57
57
@@ -87,27 +87,30 @@ bool DS18X20Controller::Handle_Ds18x20Add(pb_istream_t *stream) {
87
87
_DS18X20_model->GetDS18x20AddMsg ()->sensor_types [i] ==
88
88
wippersnapper_sensor_SensorType_SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT) {
89
89
new_dsx_driver->is_read_temp_f = true ;
90
+ } else {
91
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20: Unknown SensorType, failed to add sensor!" );
92
+ return false ;
90
93
}
91
94
}
92
95
93
96
// Add the DS18X20Hardware object to the vector of hardware objects
94
97
_DS18X20_pins.push_back (std::move (new_dsx_driver));
95
98
} else {
96
99
WS_DEBUG_PRINTLN (
97
- " ERROR: Unable to get ds18x sensor ID, ds18x sensor not initialized " );
100
+ " ERROR | DS18x20 : Unable to get sensor ID! " );
98
101
}
99
102
100
103
// Encode and publish a Ds18x20Added message back to the broker
101
104
unsigned long encode_start_time = millis ();
102
105
if (!_DS18X20_model->EncodeDS18x20Added (
103
106
_DS18X20_model->GetDS18x20AddMsg ()->onewire_pin , is_initialized)) {
104
- WS_DEBUG_PRINTLN (" ERROR: Unable to encode Ds18x20Added message" );
107
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Unable to encode Ds18x20Added message! " );
105
108
return false ;
106
109
}
107
110
108
111
if (!WsV2.PublishSignal (wippersnapper_signal_DeviceToBroker_ds18x20_added_tag,
109
112
_DS18X20_model->GetDS18x20AddedMsg ())) {
110
- WS_DEBUG_PRINTLN (" ERROR: Unable to publish Ds18x20Added message" );
113
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Unable to publish Ds18x20Added message! " );
111
114
return false ;
112
115
}
113
116
@@ -129,7 +132,7 @@ bool DS18X20Controller::Handle_Ds18x20Remove(pb_istream_t *stream) {
129
132
WS_DEBUG_PRINT (" Removing DS18X20 sensor..." );
130
133
// Attempt to decode the stream
131
134
if (!_DS18X20_model->DecodeDS18x20Remove (stream)) {
132
- WS_DEBUG_PRINTLN (" ERROR: Unable to decode Ds18x20Remove message" );
135
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Unable to decode Ds18x20Remove message" );
133
136
return false ;
134
137
}
135
138
// Create a temp. instance of the Ds18x20Remove message
@@ -144,7 +147,7 @@ bool DS18X20Controller::Handle_Ds18x20Remove(pb_istream_t *stream) {
144
147
return true ;
145
148
}
146
149
}
147
- WS_DEBUG_PRINT (" Removed!" );
150
+ WS_DEBUG_PRINTLN (" Removed!" );
148
151
return true ;
149
152
}
150
153
@@ -182,7 +185,7 @@ void DS18X20Controller::update() {
182
185
#endif
183
186
184
187
if (!temp_dsx_driver.ReadTemperatureC ()) {
185
- WS_DEBUG_PRINTLN (" ERROR: Unable to read temperature in Celsius" );
188
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Unable to read temperature in Celsius" );
186
189
continue ;
187
190
}
188
191
@@ -228,7 +231,7 @@ void DS18X20Controller::update() {
228
231
229
232
// Encode the Ds18x20Event message
230
233
if (!_DS18X20_model->EncodeDs18x20Event ()) {
231
- WS_DEBUG_PRINTLN (" ERROR: Failed to encode Ds18x20Event message" );
234
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Failed to encode Ds18x20Event message" );
232
235
continue ;
233
236
}
234
237
@@ -237,7 +240,7 @@ void DS18X20Controller::update() {
237
240
if (!WsV2.PublishSignal (
238
241
wippersnapper_signal_DeviceToBroker_ds18x20_event_tag,
239
242
_DS18X20_model->GetDS18x20EventMsg ())) {
240
- WS_DEBUG_PRINTLN (" ERROR: Failed to publish Ds18x20Event message" );
243
+ WS_DEBUG_PRINTLN (" ERROR | DS18x20 : Failed to publish Ds18x20Event message" );
241
244
continue ;
242
245
}
243
246
WS_DEBUG_PRINTLN (" Published!" );
0 commit comments