39static std::unique_ptr<WandererBoxProV3> wandererboxprov3(
new WandererBoxProV3());
60 CalibrateSP[0].
fill(
"Calibrate",
"Calibrate Current",
ISS_OFF);
64 PowerMonitorNP[VOLTAGE].
fill(
"VOLTAGE",
"Voltage (V)",
"%4.2f", 0, 999, 100, 0);
65 PowerMonitorNP[TOTAL_CURRENT].
fill(
"TOTAL_CURRENT",
"Total Current (A)",
"%4.2f", 0, 999, 100, 0);
66 PowerMonitorNP[V19_CURRENT].
fill(
"V19_CURRENT",
"DC2 Current (A))",
"%4.2f", 0, 999, 100, 0);
67 PowerMonitorNP[AR_CURRENT].
fill(
"AR_CURRENT",
"DC3-4 Current (A)",
"%4.2f", 0, 999, 100, 0);
101 dc5ControlNP[DC5].
fill(
"DC5",
"Dew Heater (PWM)",
"%.2f", 0, 255, 5, 0);
104 dc6ControlNP[DC6].
fill(
"DC6",
"Dew Heater (PWM)",
"%.2f", 0, 255, 5, 0);
107 dc7ControlNP[DC7].
fill(
"DC7",
"Dew Heater (PWM)",
"%.2f", 0, 255, 5, 0);
110 setDC34voltageNP[setDC34voltage].
fill(
"DC34SET",
"Adjustable Voltage",
"%.2f", 5, 13.2, 0.1, 0);
128 dc5diffSP[DC5_Manual].
fill(
"Manual",
"Manual",
ISS_ON);
129 dc5diffSP[DC5_DPD_Mode].
fill(
"DPD_Mode",
"DPD Mode",
ISS_OFF);
130 dc5diffSP[DC5_CT_Mode].
fill(
"CT_Mode",
"CT Mode",
ISS_OFF);
133 dc5diffSETNP[DC5DIFFSET].
fill(
"DC5 Auto Control",
"Dew Point Difference(C)",
"%.2f", 10, 30, 1, 0);
136 dc5constSETNP[DC5CONSTSET].
fill(
"DC5 Auto Control",
"Temperature(C)",
"%.2f", 0, 40, 1, 0);
140 dc6diffSP[DC6_Manual].
fill(
"Manual",
"Manual",
ISS_ON);
141 dc6diffSP[DC6_DPD_Mode].
fill(
"DPD_Mode",
"DPD Mode",
ISS_OFF);
142 dc6diffSP[DC6_CT_Mode].
fill(
"CT_Mode",
"CT Mode",
ISS_OFF);
145 dc6diffSETNP[DC6DIFFSET].
fill(
"DC6 Auto Control",
"Dew Point Difference(C)",
"%.2f", 10, 30, 1, 0);
148 dc6constSETNP[DC6CONSTSET].
fill(
"DC6 Auto Control",
"Temperature(C)",
"%.2f", 0, 40, 1, 0);
152 dc7diffSP[DC7_Manual].
fill(
"Manual",
"Manual",
ISS_ON);
153 dc7diffSP[DC7_DPD_Mode].
fill(
"DPD_Mode",
"DPD Mode",
ISS_OFF);
154 dc7diffSP[DC7_CT_Mode].
fill(
"CT_Mode",
"CT Mode",
ISS_OFF);
157 dc7diffSETNP[DC7DIFFSET].
fill(
"DC7 Auto Control",
"Dew Point Difference(C)",
"%.2f", 10, 30, 1, 0);
160 dc7constSETNP[DC7CONSTSET].
fill(
"DC7 Auto Control",
"Temperature(C)",
"%.2f", 0, 40, 1, 0);
164 ENVMonitorNP[Probe1_Temp].
fill(
"Probe1_Temp",
"Probe1 Temperature (C)",
"%4.2f", 0, 999, 100, 0);
165 ENVMonitorNP[Probe2_Temp].
fill(
"Probe2_Temp",
"Probe2 Temperature (C)",
"%4.2f", 0, 999, 100, 0);
166 ENVMonitorNP[Probe3_Temp].
fill(
"Probe3_Temp",
"Probe3 Temperature (C)",
"%4.2f", 0, 999, 100, 0);
167 ENVMonitorNP[ENV_Humidity].
fill(
"ENV_Humidity",
"Ambient Humidity %",
"%4.2f", 0, 999, 100, 0);
168 ENVMonitorNP[ENV_Temp].
fill(
"ENV_Temp",
"Ambient Temperature (C)",
"%4.2f", 0, 999, 100, 0);
169 ENVMonitorNP[DEW_Point].
fill(
"DEW_Point",
"Dew Point (C)",
"%4.2f", 0, 999, 100, 0);
173 addParameter(
"WEATHER_TEMPERATURE",
"Temperature (C)", -15, 35, 15);
174 addParameter(
"WEATHER_HUMIDITY",
"Humidity %", 0, 100, 15);
175 addParameter(
"WEATHER_DEWPOINT",
"Dew Point (C)", 0, 100, 15);
188bool WandererBoxProV3::getData()
193 tcflush(PortFD, TCIOFLUSH);
194 int nbytes_read_name = 0,rc=-1;
202 LOGF_INFO(
"No data received, the device may not be WandererBox Pro V3, please check the serial port!",
"Updated");
203 LOGF_ERROR(
"Device read error: %s", errorMessage);
206 name[nbytes_read_name - 1] =
'\0';
207 if(strcmp(name,
"ZXWBPlusV3")==0||strcmp(name,
"WandererCoverV4")==0||strcmp(name,
"UltimateV2")==0||strcmp(name,
"PlusV2")==0)
209 LOGF_INFO(
"The device is not WandererBox Pro V3!",
"Updated");
212 if(strcmp(name,
"ZXWBProV3")!=0)
214 LOGF_ERROR(
"Device is not WandererBox Pro V3 (got '%s'). Wrong port or device.", name);
218 int nbytes_read_version = 0;
219 char version[64] = {0};
222 version[nbytes_read_version - 1] =
'\0';
223 firmware=std::atoi(version);
227 char temp1[64] = {0};
228 int nbytes_read_temp1= 0;
230 temp1[nbytes_read_temp1 - 1] =
'\0';
231 temp1read = std::strtod(temp1,NULL);
234 char temp2[64] = {0};
235 int nbytes_read_temp2= 0;
237 temp2[nbytes_read_temp2 - 1] =
'\0';
238 temp2read = std::strtod(temp2,NULL);
241 char temp3[64] = {0};
242 int nbytes_read_temp3= 0;
244 temp3[nbytes_read_temp3 - 1] =
'\0';
245 temp3read = std::strtod(temp3,NULL);
249 int nbytes_read_DHTH= 0;
251 DHTH[nbytes_read_DHTH - 1] =
'\0';
252 DHTHread = std::strtod(DHTH,NULL);
256 int nbytes_read_DHTT= 0;
258 DHTT[nbytes_read_DHTT - 1] =
'\0';
259 DHTTread = std::strtod(DHTT,NULL);
260 updateENV(temp1read,temp2read,temp3read,DHTHread,DHTTread);
263 char Tcurrent[64] = {0};
264 int nbytes_read_Tcurrent= 0;
266 Tcurrent[nbytes_read_Tcurrent - 1] =
'\0';
267 Tcurrentread = std::strtod(Tcurrent,NULL);
270 char V19current[64] = {0};
271 int nbytes_read_V19current= 0;
273 V19current[nbytes_read_V19current - 1] =
'\0';
274 V19currentread = std::strtod(V19current,NULL);
278 char ARcurrent[64] = {0};
279 int nbytes_read_ARcurrent= 0;
281 ARcurrent[nbytes_read_ARcurrent - 1] =
'\0';
282 ARcurrentread = std::strtod(ARcurrent,NULL);
286 char voltage[64] = {0};
287 int nbytes_read_voltage= 0;
289 voltage[nbytes_read_voltage - 1] =
'\0';
290 voltageread = std::strtod(voltage,NULL);
291 updatePower(Tcurrentread,V19currentread,ARcurrentread,voltageread);
294 char USB31[64] = {0};
295 int nbytes_read_USB31= 0;
297 USB31[nbytes_read_USB31 - 1] =
'\0';
298 USB31read = std::stoi(USB31);
299 updateUSB31(USB31read);
302 char USB32[64] = {0};
303 int nbytes_read_USB32= 0;
305 USB32[nbytes_read_USB32 - 1] =
'\0';
306 USB32read = std::stoi(USB32);
307 updateUSB32(USB32read);
310 char USB33[64] = {0};
311 int nbytes_read_USB33= 0;
313 USB33[nbytes_read_USB33 - 1] =
'\0';
314 USB33read = std::stoi(USB33);
315 updateUSB33(USB33read);
318 char USB21[64] = {0};
319 int nbytes_read_USB21= 0;
321 USB21[nbytes_read_USB21 - 1] =
'\0';
322 USB21read = std::stoi(USB21);
323 updateUSB21(USB21read);
326 char USB22[64] = {0};
327 int nbytes_read_USB22= 0;
329 USB22[nbytes_read_USB22 - 1] =
'\0';
330 USB22read = std::stoi(USB22);
331 updateUSB22(USB22read);
335 int nbytes_read_DC34= 0;
337 DC34[nbytes_read_DC34 - 1] =
'\0';
338 DC34read = std::stoi(DC34);
339 updateDC34(DC34read);
343 int nbytes_read_DC5= 0;
345 DC5[nbytes_read_DC5 - 1] =
'\0';
346 DC5read = std::stoi(DC5);
351 int nbytes_read_DC6= 0;
353 DC6[nbytes_read_DC6 - 1] =
'\0';
354 DC6read = std::stoi(DC6);
359 int nbytes_read_DC7= 0;
361 DC7[nbytes_read_DC7 - 1] =
'\0';
362 DC7read = std::stoi(DC7);
366 char DC8_9[64] = {0};
367 int nbytes_read_DC8_9= 0;
369 DC8_9[nbytes_read_DC8_9 - 1] =
'\0';
370 DC8_9read =std::stoi(DC8_9);
371 updateDC8_9(DC8_9read);
374 char DC10_11[64] = {0};
375 int nbytes_read_DC10_11= 0;
377 DC10_11[nbytes_read_DC10_11 - 1] =
'\0';
378 DC10_11read =std::stoi(DC10_11);
379 updateDC10_11(DC10_11read);
382 char DC34SET[64] = {0};
383 int nbytes_read_DC34SET= 0;
385 DC34SET[nbytes_read_DC34SET - 1] =
'\0';
387 DC34SETread = std::stoi(DC34SET);
388 updateDC34SET(DC34SETread);
392 if(dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON)
394 if(temp1read<ENVMonitorNP[DEW_Point].value+dc5diffSETNP[DC5DIFFSET].value)
400 if(DC5CONSTMODE==
true )
402 if(temp1read<dc5constSETNP[DC5CONSTSET].value)
407 if (dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe1_Temp].value==-127)
414 LOGF_ERROR(
"Temp probe 1 not connected, Dew Point Difference Mode for DC5 has exited!",
"Updated");
415 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
422 if (dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON&&isnan(ENVMonitorNP[DEW_Point].value)==1)
429 LOGF_ERROR(
"DHT22 Humidity&Temperature sensor not connected, Dew Point Difference Mode for DC5 has exited!",
"Updated");
436 if (dc5diffSP[DC5_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe1_Temp].value==-127)
443 LOGF_ERROR(
"Temp probe 1 not connected, Constant Temperature Mode for DC5 has exited!",
"Updated");
444 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
455 if(DC6DIFFMODE==
true )
457 if(temp2read<ENVMonitorNP[DEW_Point].value+dc6diffSETNP[DC6DIFFSET].value)
462 if(DC6CONSTMODE==
true )
464 if(temp2read<dc6constSETNP[DC6CONSTSET].value)
469 if (dc6diffSP[DC6_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe2_Temp].value==-127)
476 LOGF_ERROR(
"Temp probe 2 not connected, Dew Point Difference Mode for DC6 has exited!",
"Updated");
477 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
484 if (dc6diffSP[DC6_DPD_Mode].getState() ==
ISS_ON&&isnan(ENVMonitorNP[DEW_Point].value)==1)
491 LOGF_ERROR(
"DHT22 Humidity&Temperature sensor not connected, Dew Point Difference Mode for DC6 has exited!",
"Updated");
498 if (dc6diffSP[DC6_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe2_Temp].value==-127)
505 LOGF_ERROR(
"Temp probe 2 not connected, Constant Temperature Mode for DC6 has exited!",
"Updated");
506 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
516 if(DC7DIFFMODE==
true )
518 if(temp3read<ENVMonitorNP[DEW_Point].value+dc7diffSETNP[DC7DIFFSET].value)
523 if(DC7CONSTMODE==
true )
525 if(temp3read<dc7constSETNP[DC7CONSTSET].value)
530 if (dc7diffSP[DC7_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe3_Temp].value==-127)
537 LOGF_ERROR(
"Temp probe 3 not connected, Dew Point Difference Mode for DC7 has exited!",
"Updated");
538 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
545 if (dc7diffSP[DC7_DPD_Mode].getState() ==
ISS_ON&&isnan(ENVMonitorNP[DEW_Point].value)==1)
552 LOGF_ERROR(
"DHT22 Humidity&Temperature sensor not connected, Dew Point Difference Mode for DC7 has exited!",
"Updated");
559 if (dc7diffSP[DC7_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe3_Temp].value==-127)
566 LOGF_ERROR(
"Temp probe 3 not connected, Constant Temperature Mode for DC7 has exited!",
"Updated");
567 LOGF_INFO(
"You need to insert the probe firmly to the end!",
"Updated");
576 catch(std::exception& e)
585void WandererBoxProV3::updateENV(
double temp1,
double temp2,
double temp3,
double DHTH,
double DHTT)
587 ENVMonitorNP[Probe1_Temp].setValue(temp1);
588 ENVMonitorNP[Probe2_Temp].setValue(temp2);
589 ENVMonitorNP[Probe3_Temp].setValue(temp3);
590 ENVMonitorNP[ENV_Humidity].setValue(DHTH);
591 ENVMonitorNP[ENV_Temp].setValue(DHTT);
592 double dewPoint = (237.7 * ((17.27 * DHTT) / (237.7 + DHTT) + std::log((DHTH / 100)))) / (17.27 - ((17.27 * DHTT) / (237.7 + DHTT) + std::log((DHTH / 100))));
593 ENVMonitorNP[DEW_Point].setValue(
dewPoint);
595 ENVMonitorNP.
apply();
608void WandererBoxProV3::updatePower(
double Tcurrent,
double V19_current,
double AR_current,
double voltage)
611 PowerMonitorNP[VOLTAGE].setValue(voltage);
612 PowerMonitorNP[TOTAL_CURRENT].setValue(Tcurrent);
613 PowerMonitorNP[V19_CURRENT].setValue(V19_current);
614 PowerMonitorNP[AR_CURRENT].setValue(AR_current);
616 PowerMonitorNP.
apply();
619void WandererBoxProV3::updateUSB31(
int res)
624 usb31ControlSP.
apply();
627void WandererBoxProV3::updateUSB32(
int res)
632 usb32ControlSP.
apply();
635void WandererBoxProV3::updateUSB33(
int res)
640 usb33ControlSP.
apply();
643void WandererBoxProV3::updateUSB21(
int res)
648 usb21ControlSP.
apply();
651void WandererBoxProV3::updateUSB22(
int res)
656 usb22ControlSP.
apply();
659void WandererBoxProV3::updateDC34(
int res)
664 dc3_4ControlSP.
apply();
667void WandererBoxProV3::updateDC5(
int res)
669 dc5ControlNP[0].setValue(res);
671 dc5ControlNP.
apply();
674void WandererBoxProV3::updateDC6(
int res)
676 dc6ControlNP[0].setValue(res);
678 dc6ControlNP.
apply();
681void WandererBoxProV3::updateDC7(
int res)
683 dc7ControlNP[0].setValue(res);
685 dc7ControlNP.
apply();
688void WandererBoxProV3::updateDC8_9(
int res)
693 dc8_9ControlSP.
apply();
696void WandererBoxProV3::updateDC10_11(
int res)
701 dc10_11ControlSP.
apply();
704void WandererBoxProV3::updateDC34SET(
double res)
706 setDC34voltageNP[setDC34voltage].setValue(res/10);
708 setDC34voltageNP.
apply();
720 if(firmware>=20240216)
723 LOGF_INFO(
"Firmware version: %d", firmware);
727 LOGF_INFO(
"The firmware is outdated, please upgrade to the latest firmware, or power reading calibration will be unavailable.",
"failed");
750 if(dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON)
756 else if(dc5diffSP[DC5_CT_Mode].getState() ==
ISS_ON)
769 if(dc6diffSP[DC6_DPD_Mode].getState() ==
ISS_ON)
775 else if(dc6diffSP[DC6_CT_Mode].getState() ==
ISS_ON)
788 if(dc7diffSP[DC7_DPD_Mode].getState() ==
ISS_ON)
794 else if(dc7diffSP[DC7_CT_Mode].getState() ==
ISS_ON)
856 if (strstr(name,
"WEATHER_"))
865 LOG_INFO(
"Calibrating Current Readings...");
873 dc3_4ControlSP.
update(states, names, n);
878 dc3_4ControlSP.
apply();
885 dc8_9ControlSP.
update(states, names, n);
890 dc8_9ControlSP.
apply();
897 dc10_11ControlSP.
update(states, names, n);
902 dc10_11ControlSP.
apply();
910 usb31ControlSP.
update(states, names, n);
921 usb32ControlSP.
update(states, names, n);
926 usb32ControlSP.
apply();
933 usb33ControlSP.
update(states, names, n);
938 usb33ControlSP.
apply();
945 usb21ControlSP.
update(states, names, n);
950 usb21ControlSP.
apply();
957 usb22ControlSP.
update(states, names, n);
962 usb22ControlSP.
apply();
970 dc5diffSP.
update(states, names, n);
972 if(dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe1_Temp].value!=-127&&isnan(ENVMonitorNP[DEW_Point].value)==0)
981 dc5diffSETNP.
apply();
984 LOGF_INFO(
"Dew Point Difference Mode for DC5 activated! WandererBox will keep the dew heater at the temperature higher than the dew point by the set value.",
"Updated");
987 else if(dc5diffSP[DC5_DPD_Mode].getState() ==
ISS_ON&&(ENVMonitorNP[Probe1_Temp].value==-127||isnan(ENVMonitorNP[DEW_Point].value)==1))
992 LOGF_INFO(
"Manual Mode for DC5 activated! Please adjust the duty cycle manually, you can also use DC5 as an ordinary switch.",
"Updated");
995 else if(dc5diffSP[DC5_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe1_Temp].value!=-127)
1004 dc5constSETNP.
apply();
1007 LOGF_INFO(
"Constant Temperature Mode for DC5 activated! WandererBox will keep the dew heater at the set temperature.",
"Updated");
1010 else if(dc5diffSP[DC5_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe1_Temp].value==-127)
1015 LOGF_INFO(
"Manual Mode for DC5 activated! Please adjust the duty cycle manually, you can also use DC5 as an ordinary switch.",
"Updated");
1027 LOGF_INFO(
"Manual Mode for DC5 activated! Please adjust the duty cycle manually, you can also use DC5 as an ordinary switch.",
"Updated");
1036 dc6diffSP.
update(states, names, n);
1038 if(dc6diffSP[DC6_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe2_Temp].value!=-127&&isnan(ENVMonitorNP[DEW_Point].value)==0)
1047 dc6diffSETNP.
apply();
1050 LOGF_INFO(
"Dew Point Difference Mode for DC6 activated! WandererBox will keep the dew heater at the temperature higher than the dew point by the set value.",
"Updated");
1053 else if(dc6diffSP[DC6_DPD_Mode].getState() ==
ISS_ON&&(ENVMonitorNP[Probe2_Temp].value==-127||isnan(ENVMonitorNP[DEW_Point].value)==1))
1058 LOGF_INFO(
"Manual Mode for DC6 activated! Please adjust the duty cycle manually, you can also use DC6 as an ordinary switch.",
"Updated");
1061 else if(dc6diffSP[DC6_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe2_Temp].value!=-127)
1070 dc6constSETNP.
apply();
1073 LOGF_INFO(
"Constant Temperature Mode for DC6 activated! WandererBox will keep the dew heater at the set temperature.",
"Updated");
1076 else if(dc6diffSP[DC6_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe2_Temp].value==-127)
1081 LOGF_INFO(
"Manual Mode for DC6 activated! Please adjust the duty cycle manually, you can also use DC6 as an ordinary switch.",
"Updated");
1093 LOGF_INFO(
"Manual Mode for DC6 activated! Please adjust the duty cycle manually, you can also use DC6 as an ordinary switch.",
"Updated");
1102 dc7diffSP.
update(states, names, n);
1104 if(dc7diffSP[DC7_DPD_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe3_Temp].value!=-127&&isnan(ENVMonitorNP[DEW_Point].value)==0)
1113 dc7diffSETNP.
apply();
1116 LOGF_INFO(
"Dew Point Difference Mode for DC7 activated! WandererBox will keep the dew heater at the temperature higher than the dew point by the set value.",
"Updated");
1119 else if(dc7diffSP[DC7_DPD_Mode].getState() ==
ISS_ON&&(ENVMonitorNP[Probe3_Temp].value==-127||isnan(ENVMonitorNP[DEW_Point].value)==1))
1124 LOGF_INFO(
"Manual Mode for DC7 activated! Please adjust the duty cycle manually, you can also use DC7 as an ordinary switch.",
"Updated");
1127 else if(dc7diffSP[DC7_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe3_Temp].value!=-127)
1136 dc7constSETNP.
apply();
1139 LOGF_INFO(
"Constant Temperature Mode for DC7 activated! WandererBox will keep the dew heater at the set temperature.",
"Updated");
1142 else if(dc7diffSP[DC7_CT_Mode].getState() ==
ISS_ON&&ENVMonitorNP[Probe3_Temp].value==-127)
1147 LOGF_INFO(
"Manual Mode for DC7 activated! Please adjust the duty cycle manually, you can also use DC7 as an ordinary switch.",
"Updated");
1159 LOGF_INFO(
"Manual Mode for DC7 activated! Please adjust the duty cycle manually, you can also use DC7 as an ordinary switch.",
"Updated");
1165 return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
1172 if (strstr(name,
"WEATHER_"))
1178 for (
int i = 0; i < n; i++)
1180 rc1 = setDewPWM(5,
static_cast<uint8_t
>(values[i]));
1185 dc5ControlNP.
update(values, names, n);
1186 dc5ControlNP.
apply();
1194 dc5diffSETNP.
update(values, names, n);
1195 dc5diffSETNP.
apply();
1203 dc5constSETNP.
update(values, names, n);
1204 dc5constSETNP.
apply();
1211 for (
int i = 0; i < n; i++)
1213 rc1 = setDewPWM(6,
static_cast<uint8_t
>(values[i]));
1218 dc6ControlNP.
update(values, names, n);
1219 dc6ControlNP.
apply();
1227 dc6diffSETNP.
update(values, names, n);
1228 dc6diffSETNP.
apply();
1236 dc6constSETNP.
update(values, names, n);
1237 dc6constSETNP.
apply();
1244 for (
int i = 0; i < n; i++)
1246 rc1 = setDewPWM(7,
static_cast<uint8_t
>(values[i]));
1251 dc7ControlNP.
update(values, names, n);
1252 dc7ControlNP.
apply();
1260 dc7diffSETNP.
update(values, names, n);
1261 dc7diffSETNP.
apply();
1269 dc7constSETNP.
update(values, names, n);
1270 dc7constSETNP.
apply();
1277 for (
int i = 0; i < n; i++)
1279 rc1 = setDewPWM(20,
static_cast<uint8_t
>(10*values[i]));
1284 setDC34voltageNP.
update(values, names, n);
1285 setDC34voltageNP.
apply();
1294bool WandererBoxProV3::setDewPWM(uint8_t
id, uint8_t value)
1297 snprintf(
cmd, 64,
"%d%03d",
id, value);
1298 if (sendCommand(
cmd))
1308 return "WandererBox Pro V3";
1312bool WandererBoxProV3::sendCommand(std::string command)
1314 int nbytes_written = 0, rc = -1;
1315 std::string command_termination =
"\n";
1321 LOGF_ERROR(
"Serial write error: %s", errorMessage);
1345 dc5diffSETNP.
save(fp);
1346 dc5constSETNP.
save(fp);
1347 dc5ControlNP.
save(fp);
1350 dc6diffSETNP.
save(fp);
1351 dc6constSETNP.
save(fp);
1352 dc6ControlNP.
save(fp);
1355 dc7diffSETNP.
save(fp);
1356 dc7constSETNP.
save(fp);
1357 dc7ControlNP.
save(fp);
1359 setDC34voltageNP.
save(fp);
void registerHandshake(std::function< bool()> callback)
registerHandshake Register a handshake function to be called once the initial connection to the devic...
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
const char * getDeviceName() const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties()
Initialize properties initial state and value. The child class must implement this function.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const ISState states[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void addParameter(std::string name, std::string label, double numMinOk, double numMaxOk, double percWarning, bool flipWarning=false)
Add a physical weather measurable parameter to the weather driver.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process weather switch properties.
bool setCriticalParameter(std::string name)
setCriticalParameter Set parameter that is considered critical to the operation of the observatory....
bool syncCriticalParameters()
Synchronize and update the state of all critical parameters.
void setParameterValue(std::string name, double value)
setParameterValue Update weather parameter value
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process weather number properties.
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save parameters ranges in the config file.
INDI::PropertyNumber ParametersNP
void initProperties(const char *statusGroup, const char *paramsGroup)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
INDI::PropertyLight critialParametersLP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
const char * getDefaultName() override
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState updateWeather() override
updateWeather Update weather conditions from device or service. The function should not change the st...
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Implementations for common driver routines.
#define LOGF_INFO(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOGF_ERROR(fmt,...)
Namespace to encapsulate INDI client, drivers, and mediator classes.