Skip to content

Commit 976d283

Browse files
WandererAstroWandererAstro
andauthored
Driver for Wanderer Cover V4 Pro-EC added and known issue for V4-EC driver fixed. (#2267)
* Driver for Wanderer Eclipse added. * Driver for Wanderer Eclipse added. * Driver for Wanderer Eclipse added. * Driver for Wanderer Cover V4 Pro-EC added, and known issue fixed. --------- Co-authored-by: WandererAstro <skywatcherwsl2000@gmail.com>
1 parent 4768cef commit 976d283

6 files changed

Lines changed: 1409 additions & 43 deletions

File tree

drivers.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,10 @@
843843
<driver name="WandererCover V4-EC">indi_wanderercover_v4_ec</driver>
844844
<version>1.2</version>
845845
</device>
846+
<device label="WandererCover V4 Pro-EC" manufacturer="Wanderer Astro">
847+
<driver name="WandererCover V4 Pro-EC">indi_wanderercover_v4_pro_ec</driver>
848+
<version>1.0</version>
849+
</device>
846850
<device label="Wanderer Eclipse" manufacturer="Wanderer Astro">
847851
<driver name="Wanderer Eclipse">indi_wanderer_eclipse</driver>
848852
<version>1.2</version>

drivers/auxiliary/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ add_executable(indi_wanderercover_v4_ec ${indi_wanderercover_v4_ec_SRC})
2525
target_link_libraries(indi_wanderercover_v4_ec indidriver)
2626
install(TARGETS indi_wanderercover_v4_ec RUNTIME DESTINATION bin)
2727

28+
# ########## WandererCover V4 Pro-EC###############
29+
SET(indi_wanderercover_v4_pro_ec_SRC
30+
wanderer_cover_v4_pro_ec.cpp)
31+
32+
add_executable(indi_wanderercover_v4_pro_ec ${indi_wanderercover_v4_pro_ec_SRC})
33+
target_link_libraries(indi_wanderercover_v4_pro_ec indidriver)
34+
install(TARGETS indi_wanderercover_v4_pro_ec RUNTIME DESTINATION bin)
35+
2836
# ########## Wanderer Eclipse###############
2937
SET(indi_wanderer_eclipse_SRC
3038
wanderer_eclipse.cpp)

drivers/auxiliary/wanderer_cover_v4_ec.cpp

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool WandererCoverLegacyProtocol::parseDeviceData(const char* data, WandererCove
175175
device->statusData.voltage = device->voltageread;
176176

177177
// Update the UI with the parsed data
178-
device->updateData(device->closesetread, device->opensetread, device->positionread, device->voltageread);
178+
device->updateData(device->closesetread, device->opensetread, device->positionread, device->voltageread,device->flatpanelbrightnessread, device->dewheaterpowerread,device->asiaircontrolenabledread);
179179

180180
// Update the Close and Open position settings with the values from the device
181181
device->CloseSetNP[device->CloseSet].setValue(device->closesetread);
@@ -305,9 +305,12 @@ bool WandererCoverModernProtocol::parseDeviceData(const char* data, WandererCove
305305
// Parse extended data for modern protocol
306306
if (tokens.size() >= 8)
307307
{
308-
device->statusData.flatPanelBrightness = std::atoi(tokens[6].c_str());
309-
device->statusData.dewHeaterPower = std::atoi(tokens[7].c_str());
310-
device->statusData.asiairControlEnabled = (tokens.size() > 8) ? (std::atoi(tokens[8].c_str()) == 1) : false;
308+
device->flatpanelbrightnessread = std::atoi(tokens[6].c_str());
309+
device->statusData.flatPanelBrightness = device->flatpanelbrightnessread;
310+
device->dewheaterpowerread = std::atoi(tokens[7].c_str());
311+
device->statusData.dewHeaterPower = device->dewheaterpowerread;
312+
device->asiaircontrolenabledread = (tokens.size() > 8) ? (std::atoi(tokens[8].c_str()) == 1) : false;
313+
device->statusData.asiairControlEnabled = device->asiaircontrolenabledread;
311314
}
312315

313316
// Update status data
@@ -318,7 +321,7 @@ bool WandererCoverModernProtocol::parseDeviceData(const char* data, WandererCove
318321
device->statusData.voltage = device->voltageread;
319322

320323
// Update the UI with the parsed data
321-
device->updateData(device->closesetread, device->opensetread, device->positionread, device->voltageread);
324+
device->updateData(device->closesetread, device->opensetread, device->positionread, device->voltageread,device->flatpanelbrightnessread, device->dewheaterpowerread,device->asiaircontrolenabledread);
322325

323326
// Update the Close and Open position settings with the values from the device
324327
device->CloseSetNP[device->CloseSet].setValue(device->closesetread);
@@ -381,10 +384,9 @@ bool WandererCoverV4EC::initProperties()
381384
DataNP[openset_read].fill( "Open_Position", "Open Position Set(°)", "%4.2f", 0, 999, 100, 0);
382385
DataNP[position_read].fill( "Current_Position", "Current Position(°)", "%4.2f", 0, 999, 100, 0);
383386
DataNP[voltage_read].fill( "Voltage", "Voltage (V)", "%4.2f", 0, 999, 100, 0);
384-
DataNP[flat_panel_brightness_read].fill( "Flat_Panel_Brightness", "Flat Panel Brightness", "%d", 0, 255, 1, 0);
385-
DataNP[dew_heater_power_read].fill( "Dew_Heater_Power", "Dew Heater Power", "%d", 0, 150, 1, 0);
386-
DataNP[asiair_control_enabled_read].fill( "ASIAIR_Control_Enabled", "ASIAIR Control Enabled", "%d", 0, 1, 1, 0);
387-
DataNP[firmware_version_read].fill( "Firmware_Version", "Firmware Version", "%d", 0, 99999999, 1, 0);
387+
DataNP[flat_panel_brightness_read].fill( "Flat_Panel_Brightness", "Flat Panel Brightness", "%4.2f", 0, 255, 1, 0);
388+
DataNP[dew_heater_power_read].fill( "Dew_Heater_Power", "Dew Heater Power", "%4.2f", 0, 150, 1, 0);
389+
DataNP[asiair_control_enabled_read].fill( "ASIAIR_Control_Enabled", "ASIAIR Control Enabled", "%4.2f", 0, 1, 1, 0);
388390
DataNP.fill(getDeviceName(), "STATUS", "Real Time Status", MAIN_CONTROL_TAB, IP_RO, 60, IPS_IDLE);
389391

390392
// Firmware information
@@ -411,9 +413,9 @@ bool WandererCoverV4EC::initProperties()
411413
ASIAIRControlSP[ASIAIR_DISABLE].fill("ASIAIR_DISABLE", "Disable ASIAIR Control", ISS_ON);
412414
ASIAIRControlSP.fill(getDeviceName(), "ASIAIR_CONTROL", "ASIAIR Control", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
413415

414-
CustomBrightnessNP[CUSTOM_BRIGHTNESS_1].fill("CUSTOM_BRIGHTNESS_1", "Custom Brightness 1", "%d", 0, 255, 1, 100);
415-
CustomBrightnessNP[CUSTOM_BRIGHTNESS_2].fill("CUSTOM_BRIGHTNESS_2", "Custom Brightness 2", "%d", 0, 255, 1, 100);
416-
CustomBrightnessNP[CUSTOM_BRIGHTNESS_3].fill("CUSTOM_BRIGHTNESS_3", "Custom Brightness 3", "%d", 0, 255, 1, 100);
416+
CustomBrightnessNP[CUSTOM_BRIGHTNESS_1].fill("CUSTOM_BRIGHTNESS_1", "Custom Brightness 1", "%1.0f", 0, 255, 1, 1);
417+
CustomBrightnessNP[CUSTOM_BRIGHTNESS_2].fill("CUSTOM_BRIGHTNESS_2", "Custom Brightness 2", "%1.0f", 0, 255, 1, 50);
418+
CustomBrightnessNP[CUSTOM_BRIGHTNESS_3].fill("CUSTOM_BRIGHTNESS_3", "Custom Brightness 3", "%1.0f", 0, 255, 1, 255);
417419
CustomBrightnessNP.fill(getDeviceName(), "CUSTOM_BRIGHTNESS", "Custom Brightness", MAIN_CONTROL_TAB, IP_RW, 60, IPS_IDLE);
418420

419421
AutoDetectSP[AUTO_DETECT_OPEN].fill("AUTO_DETECT_OPEN", "Auto Detect Open Position", ISS_OFF);
@@ -447,15 +449,6 @@ bool WandererCoverV4EC::updateProperties()
447449
snprintf(firmwareStr, sizeof(firmwareStr), "%d", firmware);
448450
FirmwareTP[FIRMWARE_VERSION].setText(firmwareStr);
449451

450-
if(firmware >= 20240101)
451-
{
452-
LOGF_INFO("Firmware version: %d", firmware);
453-
}
454-
else
455-
{
456-
LOGF_INFO("Firmware version: %d", firmware);
457-
LOG_INFO("New firmware available!");
458-
}
459452

460453
// Update the Close and Open position settings with the values from the device
461454
CloseSetNP[CloseSet].setValue(closesetread);
@@ -612,17 +605,11 @@ bool WandererCoverV4EC::detectProtocol()
612605
LOG_INFO("WandererCover V4-EC device detected");
613606
}
614607
// Check for similar devices that might be compatible
615-
else if (deviceName == "ZXWBProV3" || deviceName == "ZXWBPlusV3" ||
616-
deviceName == "UltimateV2" || deviceName == "PlusV2")
608+
else if (deviceName == "ZXWBProV3" || deviceName == "ZXWBPlusV3" ||
609+
deviceName == "UltimateV2" || deviceName == "PlusV2"|| deviceName == "WandererEclipse"|| deviceName == "WandererDewTerminator"|| deviceName == "WandererCoverV4Pro")
617610
{
618-
LOGF_WARN("Detected similar device: '%s'. This driver is designed for WandererCover V4-EC.", deviceName.c_str());
619-
LOG_WARN("Compatibility not guaranteed. Proceeding with caution...");
620-
}
621-
// Check for partial matches (in case of data corruption or incomplete transmission)
622-
else if (deviceName.find("WandererCover") != std::string::npos)
623-
{
624-
LOGF_WARN("Partial device match detected: '%s'. Expected 'WandererCoverV4'", deviceName.c_str());
625-
LOG_WARN("Proceeding with partial match...");
611+
LOGF_ERROR("WandererAstro products detected, but the model does not match: '%s'. This driver is designed for WandererCover V4-EC only, please choose the right driver or try another serial port!", deviceName.c_str());
612+
return false;
626613
}
627614
else
628615
{
@@ -647,14 +634,14 @@ bool WandererCoverV4EC::detectProtocol()
647634
{
648635
std::unique_ptr<WandererCoverModernProtocol> modernProtocol = std::make_unique<WandererCoverModernProtocol>();
649636
setProtocol(std::move(modernProtocol));
650-
LOG_INFO("Using modern protocol (firmware >= 20250404)");
637+
LOG_INFO("Using modern protocol (firmware >= 20250404) Please note that in the newer firmware, to protect dark conditions, the flat light will remain off whenever the Cover is open.");
651638
return true;
652639
}
653640
else if (firmwareVersion > 0)
654641
{
655642
std::unique_ptr<WandererCoverLegacyProtocol> legacyProtocol = std::make_unique<WandererCoverLegacyProtocol>();
656643
setProtocol(std::move(legacyProtocol));
657-
LOG_INFO("Using legacy protocol (firmware < 20250404)");
644+
LOG_INFO("Using legacy protocol (firmware < 20250404) Firmware update recommended.");
658645
return true;
659646
}
660647
else
@@ -673,7 +660,7 @@ bool WandererCoverV4EC::detectProtocol()
673660
void WandererCoverV4EC::setProtocol(std::unique_ptr<IWandererCoverProtocol> protocol)
674661
{
675662
currentProtocol = std::move(protocol);
676-
LOGF_INFO("Protocol set to: %s", currentProtocol->getProtocolName().c_str());
663+
677664
}
678665

679666
////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -748,7 +735,7 @@ bool WandererCoverV4EC::parseDeviceData(const char *data)
748735
////////////////////////////////////////////////////////////////////////////////////////////////////////
749736
///
750737
////////////////////////////////////////////////////////////////////////////////////////////////////////
751-
void WandererCoverV4EC::updateData(double closesetread, double opensetread, double positionread, double voltageread)
738+
void WandererCoverV4EC::updateData(double closesetread, double opensetread, double positionread, double voltageread,double flatpanelbrightnessread,double dewheaterpowerread, double asiaircontrolenabledread)
752739
{
753740
// Update basic data
754741
DataNP[closeset_read].setValue(closesetread);
@@ -759,18 +746,16 @@ void WandererCoverV4EC::updateData(double closesetread, double opensetread, doub
759746
// Update extended data only if supported by current protocol
760747
if (currentProtocol && currentProtocol->supportsFeature("extended_status"))
761748
{
762-
DataNP[flat_panel_brightness_read].setValue(statusData.flatPanelBrightness);
763-
DataNP[dew_heater_power_read].setValue(statusData.dewHeaterPower);
764-
DataNP[asiair_control_enabled_read].setValue(statusData.asiairControlEnabled ? 1 : 0);
765-
DataNP[firmware_version_read].setValue(statusData.firmware);
749+
DataNP[flat_panel_brightness_read].setValue(flatpanelbrightnessread);
750+
DataNP[dew_heater_power_read].setValue(dewheaterpowerread);
751+
DataNP[asiair_control_enabled_read].setValue(asiaircontrolenabledread);
766752
}
767753
else
768754
{
769755
// For legacy protocol, set default values for unsupported features
770756
DataNP[flat_panel_brightness_read].setValue(-1);
771757
DataNP[dew_heater_power_read].setValue(-1);
772758
DataNP[asiair_control_enabled_read].setValue(-1);
773-
DataNP[firmware_version_read].setValue(-1);
774759
}
775760

776761
DataNP.setState(IPS_OK);

drivers/auxiliary/wanderer_cover_v4_ec.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,13 @@ class WandererCoverV4EC : public INDI::DefaultDevice, public INDI::DustCapInterf
177177
double opensetread=0;
178178
double positionread=0;
179179
double voltageread=0;
180+
double dewheaterpowerread=0;
181+
double asiaircontrolenabledread=0;
182+
double flatpanelbrightnessread=0;
180183
bool setDewPWM(int id, int value);
181184
bool setClose(double value);
182185
bool setOpen(double value);
183-
void updateData(double closesetread,double opensetread,double positionread,double voltageread);
186+
void updateData(double closesetread,double opensetread,double positionread,double voltageread,double flatpanelbrightnessread,double dewheaterpowerread,double asiaircontrolenabledread);
184187

185188
// Protocol detection and management
186189
bool detectProtocol();
@@ -194,7 +197,7 @@ class WandererCoverV4EC : public INDI::DefaultDevice, public INDI::DustCapInterf
194197
IWandererCoverProtocol::StatusData statusData;
195198

196199
// Properties for all protocol versions
197-
INDI::PropertyNumber DataNP{8}; // Extended to support new protocol fields
200+
INDI::PropertyNumber DataNP{7}; // Extended to support new protocol fields
198201
enum
199202
{
200203
closeset_read,
@@ -204,7 +207,6 @@ class WandererCoverV4EC : public INDI::DefaultDevice, public INDI::DustCapInterf
204207
flat_panel_brightness_read,
205208
dew_heater_power_read,
206209
asiair_control_enabled_read,
207-
firmware_version_read,
208210
};
209211

210212
//Dew heater///////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)