Skip to content

Commit c6c4f14

Browse files
committed
Use the new ISNewProperty function to call the parent ISNewXXX function so that it handle PulseDuration instead of calling commandOutput directly
1 parent 897a849 commit c6c4f14

2 files changed

Lines changed: 39 additions & 12 deletions

File tree

cmake_modules/CMakeCommon.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ include(CheckCCompilerFlag)
66
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
77
#ENDIF ()
88

9-
# C++14 Support
9+
# C++17 Support
1010
if (NOT ANDROID)
11-
set(CMAKE_CXX_STANDARD 14)
11+
set(CMAKE_CXX_STANDARD 17)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313
endif(NOT ANDROID)
1414

indi-armadillo-platypus/dragonfly_dome.cpp

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,32 @@ bool DragonFlyDome::setRoofOpen(bool enabled)
392392
if (enabled && DigitalOutputsSP[close_relay_idx][INDI::OutputInterface::On].s == ISS_ON)
393393
{
394394
LOG_DEBUG("Turning off Close Roof Relay in order to turn on Open Roof relay...");
395-
if (!CommandOutput(close_relay_idx, INDI::OutputInterface::Off))
395+
if (!ISNewProperty(DigitalOutputsSP[close_relay_idx], DigitalOutputsSP[close_relay_idx][INDI::OutputInterface::Off].getName(), ISS_ON))
396396
{
397-
LOG_ERROR("Failed to turn off close relay before opening.");
398-
// Decide if we should still try to open or return false.
399-
// For safety, perhaps return false.
400-
return false;
397+
LOG_ERROR("Failed to send command to turn off close relay before opening.");
398+
// ISNewProperty updates property states, so we check the actual state
399+
if (DigitalOutputsSP[close_relay_idx][INDI::OutputInterface::On].s == ISS_ON)
400+
{
401+
LOG_ERROR("Close relay is still ON after attempting to turn it off.");
402+
return false; // Safety: don't proceed if we can't turn off the opposing relay
403+
}
401404
}
405+
// Give a small delay for the command to be processed if needed, or check state
406+
// For now, assume ISNewProperty is synchronous enough for the next check or command.
402407
}
403408

404-
return CommandOutput(open_relay_idx, enabled ? INDI::OutputInterface::On : INDI::OutputInterface::Off);
409+
const char *elementToActivate = enabled ? DigitalOutputsSP[open_relay_idx][INDI::OutputInterface::On].getName()
410+
: DigitalOutputsSP[open_relay_idx][INDI::OutputInterface::Off].getName();
411+
if (!ISNewProperty(DigitalOutputsSP[open_relay_idx], elementToActivate, ISS_ON))
412+
{
413+
LOGF_ERROR("Failed to send command to %s open relay.", enabled ? "turn on" : "turn off");
414+
return false;
415+
}
416+
// ISNewProperty returns true if the property is found and processed, not necessarily if the hardware command succeeded.
417+
// The property state (IPS_OK, IPS_ALERT) should reflect success.
418+
// We rely on OutputInterface::processSwitch to set the correct state.
419+
// For the purpose of this function, returning true means the command was dispatched.
420+
return true;
405421
}
406422

407423
//////////////////////////////////////////////////////////////////////////////
@@ -427,14 +443,25 @@ bool DragonFlyDome::setRoofClose(bool enabled)
427443
if (enabled && DigitalOutputsSP[open_relay_idx][INDI::OutputInterface::On].s == ISS_ON)
428444
{
429445
LOG_DEBUG("Turning off Open Roof relay in order to turn on Close Roof relay...");
430-
if (!CommandOutput(open_relay_idx, INDI::OutputInterface::Off))
446+
if (!ISNewProperty(DigitalOutputsSP[open_relay_idx], DigitalOutputsSP[open_relay_idx][INDI::OutputInterface::Off].getName(), ISS_ON))
431447
{
432-
LOG_ERROR("Failed to turn off open relay before closing.");
433-
return false; // Safety: don't proceed if we can't turn off the opposing relay
448+
LOG_ERROR("Failed to send command to turn off open relay before closing.");
449+
if (DigitalOutputsSP[open_relay_idx][INDI::OutputInterface::On].s == ISS_ON)
450+
{
451+
LOG_ERROR("Open relay is still ON after attempting to turn it off.");
452+
return false; // Safety: don't proceed if we can't turn off the opposing relay
453+
}
434454
}
435455
}
436456

437-
return CommandOutput(close_relay_idx, enabled ? INDI::OutputInterface::On : INDI::OutputInterface::Off);
457+
const char *elementToActivate = enabled ? DigitalOutputsSP[close_relay_idx][INDI::OutputInterface::On].getName()
458+
: DigitalOutputsSP[close_relay_idx][INDI::OutputInterface::Off].getName();
459+
if (!ISNewProperty(DigitalOutputsSP[close_relay_idx], elementToActivate, ISS_ON))
460+
{
461+
LOGF_ERROR("Failed to send command to %s close relay.", enabled ? "turn on" : "turn off");
462+
return false;
463+
}
464+
return true;
438465
}
439466

440467
//////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)