Instrument Neutral Distributed Interface INDI 2.2.5
pegasus_flatmaster_neo.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2026 Dominik Merkel. All rights reserved.
3
4 Pegasus FlatMaster Neo
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20
21 The full GNU General Public License is included in this distribution in the
22 file called LICENSE.
23*******************************************************************************/
24
26
27#include "indicom.h"
30
31#include <algorithm>
32#include <cerrno>
33#include <cmath>
34#include <cstring>
35#include <memory>
36#include <regex>
37#include <termios.h>
38#include <unistd.h>
39#include <inttypes.h>
40#include <sys/ioctl.h>
41#include <vector>
42#include <math.h>
43
44
45static std::unique_ptr<PegasusFlatMasterNeo> flatmaster(new PegasusFlatMasterNeo());
46
47
52
54{
56
57 // Firmware version
58 IUFillText(&FirmwareT[0], "Version", "Version", nullptr);
59 IUFillTextVector(&FirmwareTP, FirmwareT, 1, getDeviceName(), "Firmware", "Firmware", MAIN_CONTROL_TAB, IP_RO, 60, IPS_IDLE);
60
61 LI::initProperties(LIGHTBOX_TAB, LI::CAN_DIM);
63 WI::initProperties(ENVIRONMENT_TAB, ENVIRONMENT_TAB);
64
66
67 addParameter("WEATHER_TEMPERATURE", "Temperature (C)", -15, 35, 15);
68 addParameter("WEATHER_HUMIDITY", "Humidity %", 0, 100, 15);
69 addParameter("WEATHER_DEWPOINT", "Dew Point (C)", 0, 100, 15);
70 setCriticalParameter("WEATHER_TEMPERATURE");
71
72 WeatherOffsetNP[OFFSET_TEMPERATURE].fill("OFFSET_TEMPERATURE", "Temperature Offset (C)", "%.1f", -20, 20, 0.1, 0);
73 WeatherOffsetNP[OFFSET_HUMIDITY].fill( "OFFSET_HUMIDITY", "Humidity Offset (%)", "%.0f", -50, 50, 1, 0);
74 WeatherOffsetNP.fill(getDeviceName(), "WEATHER_OFFSET", "Calibration", ENVIRONMENT_TAB, IP_RW, 60, IPS_IDLE);
75
76 LightIntensityNP[0].setMin(0);
77 LightIntensityNP[0].setMax(100);
78 LightIntensityNP[0].setStep(1);
79
80 // Dew Control
81 DewHeaterNP[0].fill("DEW_HEATER_VALUE", "Heater (%)", "%.0f", 0, 100, 1, 0);
82 DewHeaterNP.fill(getDeviceName(), "DEW_HEATER", "Dew Heater", DEW_TAB, IP_RW, 60, IPS_IDLE);
83
84 AutoDewSP[0].fill("AUTO_DEW_ENABLE", "Enable", ISS_OFF);
85 AutoDewSP[1].fill("AUTO_DEW_DISABLE", "Disable", ISS_ON);
86 AutoDewSP.fill(getDeviceName(), "AUTO_DEW", "Auto Dew", DEW_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
87
88 // Cap opening angle
89 CapAngleNP[0].fill("CAP_ANGLE_VALUE", "Angle (°)", "%.0f", 0, 270, 1, 270);
90 CapAngleNP.fill(getDeviceName(), "CAP_ANGLE", "Opening Angle", DUSTCAP_TAB, IP_RW, 60, IPS_IDLE);
91
92 // Device overview (FA)
93 DeviceStatusNP[STATUS_LIGHT_INTENSITY].fill( "STATUS_LIGHT_INTENSITY", "Light Intensity", "%.0f", 0, 100, 1, 0);
94 DeviceStatusNP[STATUS_LIGHT_ACTIVE].fill( "STATUS_LIGHT_ACTIVE", "Light Active", "%.0f", 0, 1, 1, 0);
95 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].fill("STATUS_CAP_ACTUAL", "Cap Actual Angle (°)", "%.0f", 0, 270, 1, 0);
96 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].fill("STATUS_CAP_TARGET", "Cap Target Angle (°)", "%.0f", 0, 270, 1, 0);
97 DeviceStatusNP[STATUS_CAP_STATUS].fill( "STATUS_CAP_STATUS", "Cap Status", "%.0f", 0, 9999, 1, 0);
98 DeviceStatusNP[STATUS_DEW_POWER].fill( "STATUS_DEW_POWER", "Dew Power", "%.0f", 0, 100, 1, 0);
99 DeviceStatusNP[STATUS_AUTO_DEW].fill( "STATUS_AUTO_DEW", "Auto Dew Active", "%.0f", 0, 1, 1, 0);
100 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].fill( "STATUS_DEW_AGGRESSIVE", "Dew Aggressiveness (0-10)", "%.0f", 0, 10, 1, 0);
101 DeviceStatusNP[STATUS_LIGHT_SENSOR].fill( "STATUS_LIGHT_SENSOR", "Light Sensor", "%.0f", 0, 100, 1, 0);
102 DeviceStatusNP.fill(getDeviceName(), "DEVICE_STATUS", "Device Status", STATUS_TAB, IP_RO, 60, IPS_IDLE);
103
104 // Uptime (FU)
105 UptimeNP[0].fill("UPTIME_SECONDS", "Uptime (s)", "%.0f", 0, 1e9, 1, 0);
106 UptimeNP.fill(getDeviceName(), "UPTIME", "Uptime", STATUS_TAB, IP_RO, 60, IPS_IDLE);
107
108 // Reboot (FQ)
109 RebootSP[0].fill("REBOOT", "Reboot", ISS_OFF);
110 RebootSP.fill(getDeviceName(), "DEVICE_REBOOT", "Device", STATUS_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE);
111
112 // Dew aggressiveness logical level 0..10 → DA:<level> + PD:<mapped_byte>
113 DewAggressivenessNP[0].fill("DEW_AGGRESSIVENESS_VALUE", "Aggressiveness (0-10)", "%.0f", 0, 10, 1, 5);
114 DewAggressivenessNP.fill(getDeviceName(), "DEW_AGGRESSIVENESS", "Dew Aggressiveness", DEW_TAB, IP_RW, 60, IPS_IDLE);
115
116 // Dew threshold (DT:1..50)
117 ThresholdNP[0].fill("THRESHOLD_VALUE", "Threshold (1-50)", "%.0f", 1, 50, 1, 10);
118 ThresholdNP.fill(getDeviceName(), "DEW_THRESHOLD", "Dew Threshold", DEW_TAB, IP_RW, 60, IPS_IDLE);
119
120 // WiFi channel — AC (read) / AC:<channel> (write), valid 1..11
121
122 // Save dew levels (DSTR)
123 SaveDewSP[0].fill("SAVE_DEW_LEVELS", "Save", ISS_OFF);
124 SaveDewSP.fill(getDeviceName(), "DEW_SAVE", "Dew Settings", DEW_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE);
125
126 // Auto-close (DC:99 / DC:0 / DC:1)
127 AutoCloseSP[0].fill("AUTO_CLOSE_ENABLE", "Enable", ISS_OFF);
128 AutoCloseSP[1].fill("AUTO_CLOSE_DISABLE", "Disable", ISS_ON);
129 AutoCloseSP.fill(getDeviceName(), "AUTO_CLOSE", "Auto Close", DUSTCAP_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE);
130
131 // Hotspot status (A? / AE:0 / AE:1)
132 // WiFi factory reset (WZ)
133 WifiFactoryResetSP[0].fill("WIFI_FACTORY_RESET", "Reset", ISS_OFF);
134 WifiFactoryResetSP.fill(getDeviceName(), "WIFI_FACTORY_RESET", "WiFi Factory Reset", NETWORK_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE);
135
137
138 wifi.initProperties(NETWORK_TAB,
139 [this](const char *name) { loadConfig(true, name); },
140 [this](INDI::Property & property) { saveConfig(property); });
141 // The Neo joins open networks with the placeholder password "PASSWORD", as before.
142 wifi.allowOpenNetworks(true);
143
144 serialConnection = new Connection::Serial(this);
145 serialConnection->setDefaultBaudRate(Connection::Serial::B_9600);
146 serialConnection->setPortMatchPattern("FlatMaster");
147 serialConnection->registerHandshake([&]()
148 {
149 return Ack();
150 });
151 registerConnection(serialConnection);
152
153 // Over WiFi the device announces itself as fmneo.local and takes the same commands on TCP port 9999.
154 tcpConnection = new Connection::TCP(this);
155 tcpConnection->setDefaultHost("fmneo.local");
156 tcpConnection->setDefaultPort(PegasusAstro::WiFi::TCP_PORT);
157 tcpConnection->registerHandshake([&]()
158 {
159 return Ack();
160 });
161 registerConnection(tcpConnection);
162 return true;
163}
164
166{
168
169 // Get Light box properties
171 wifi.ISGetProperties();
172
173}
174
176{
178
179 if (isConnected())
180 {
181 defineProperty(&FirmwareTP);
182 defineProperty(WeatherOffsetNP);
183 defineProperty(DewHeaterNP);
184 defineProperty(AutoDewSP);
185 defineProperty(DewAggressivenessNP);
186 defineProperty(ThresholdNP);
187 defineProperty(SaveDewSP);
188 defineProperty(AutoCloseSP);
189 defineProperty(CapAngleNP);
190 defineProperty(DeviceStatusNP);
191 defineProperty(UptimeNP);
192 defineProperty(RebootSP);
193 defineProperty(WifiFactoryResetSP);
194 wifi.updateProperties(true, PortFD);
195 getWeatherOffsets();
196 getThreshold();
197 getAutoClose();
198 }
199 else
200 {
201 deleteProperty(FirmwareTP.name);
202 deleteProperty(WeatherOffsetNP);
203 deleteProperty(DewHeaterNP);
204 deleteProperty(AutoDewSP);
205 deleteProperty(DewAggressivenessNP);
206 deleteProperty(ThresholdNP);
207 deleteProperty(SaveDewSP);
208 deleteProperty(AutoCloseSP);
209 deleteProperty(CapAngleNP);
210 deleteProperty(DeviceStatusNP);
211 deleteProperty(UptimeNP);
212 deleteProperty(RebootSP);
213 deleteProperty(WifiFactoryResetSP);
214 wifi.updateProperties(false, -1);
215 }
216
220
221 // Fetch current device state immediately after all properties are defined
222 // so the UI reflects the actual hardware state on connection.
223 if (isConnected())
224 getStatusData();
225
226 return true;
227}
228
230{
231 return "Pegasus FlatMaster Neo";
232}
233
234void PegasusFlatMasterNeo::updateFirmwareVersion()
235{
236 char response[16] = {0};
237
238 if(sendCommand("FV", response))
239 {
240 IUSaveText(&FirmwareT[0], response + 3);
241 FirmwareTP.s = IPS_OK;
242 IDSetText(&FirmwareTP, nullptr);
243 }
244 else
245 {
246 FirmwareTP.s = IPS_ALERT;
247 LOG_ERROR("Error on updateFirmware.");
248 }
249}
250
251bool PegasusFlatMasterNeo::Ack()
252{
253 // Over TCP, log in with the hotspot password before any command.
254 m_IsTCP = getActiveConnection() == tcpConnection;
255 PortFD = m_IsTCP ? tcpConnection->getPortFD() : serialConnection->getPortFD();
256 if (m_IsTCP && !wifi.login(PortFD))
257 return false;
258
259 // The reply "FMNEO_<id>_A\r\n" is 16 bytes, more than a 16-byte buffer holds with its terminating zero.
260 char response[NEO_LEN] = {0};
261 if (sendCommand("F#", response))
262 {
263 if (strstr(response, "FMNEO") != nullptr)
264 {
265 updateFirmwareVersion();
266 return true;
267 }
268 }
269 LOGF_ERROR("Ack failed: unexpected response '%s'", response);
270 return false;
271}
272
274{
275 char cmd[16] = {0};
276 snprintf(cmd, 16, "FE:%d", enable ? 1 : 0);
277 return sendEchoCommand(cmd);
278}
279
281{
282 char cmd[16] = {0};
283 snprintf(cmd, 16, "FL:%d", value);
284 if (!sendEchoCommand(cmd))
285 return false;
286
287 // Brightness 0 also switches the panel off, as the Pegasus software does.
288 if (value == 0)
289 return EnableLightBox(false);
290
291 return true;
292}
293
294bool PegasusFlatMasterNeo::ignoredWhileLoadingConfig(const char *dev, const char *name) const
295{
296 // Versions up to 1.2 saved these settings, so older configurations still contain them.
297 static const char *const stored[] = {"DEW_HEATER", "CAP_ANGLE", "WEATHER_OFFSET", "DEW_AGGRESSIVENESS",
298 "DEW_THRESHOLD", "WIFI_CHANNEL", "HOTSPOT_CREDENTIALS", "AUTO_DEW",
299 "AUTO_CLOSE", "HOTSPOT_STATUS"
300 };
301 if (!isConfigLoading() || dev == nullptr || strcmp(dev, getDeviceName()) != 0)
302 return false;
303
304 for (const char *property : stored)
305 if (strcmp(name, property) == 0)
306 return true;
307 return false;
308}
309
310bool PegasusFlatMasterNeo::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
311{
312 if (ignoredWhileLoadingConfig(dev, name))
313 return true;
314
315 if (wifi.ISNewNumber(dev, name, values, names, n))
316 return true;
317
318 if (LI::processNumber(dev, name, values, names, n))
319 return true;
320
321 if (strstr(name, "WEATHER_"))
322 {
323 if (WI::processNumber(dev, name, values, names, n))
324 return true;
325 }
326
327 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
328 {
329 if (DewHeaterNP.isNameMatch(name))
330 {
331 if (setDewHeater(static_cast<uint8_t>(values[0])))
332 {
333 DewHeaterNP.update(values, names, n);
334 DewHeaterNP.setState(IPS_OK);
335 }
336 else
337 DewHeaterNP.setState(IPS_ALERT);
338 DewHeaterNP.apply();
339 return true;
340 }
341
342 if (CapAngleNP.isNameMatch(name))
343 {
344 if (setCapAngle(static_cast<uint16_t>(values[0])))
345 {
346 CapAngleNP.update(values, names, n);
347 CapAngleNP.setState(IPS_OK);
348 }
349 else
350 CapAngleNP.setState(IPS_ALERT);
351 CapAngleNP.apply();
352 return true;
353 }
354
355 if (WeatherOffsetNP.isNameMatch(name))
356 {
357 bool ok = true;
358 for (int i = 0; i < n; i++)
359 {
360 if (strcmp(names[i], "OFFSET_TEMPERATURE") == 0)
361 ok &= setTemperatureOffset(values[i]);
362 else if (strcmp(names[i], "OFFSET_HUMIDITY") == 0)
363 ok &= setHumidityOffset(values[i]);
364 }
365 // Show the offsets the device actually uses.
366 if (!getWeatherOffsets())
367 ok = false;
368 if (!ok)
369 {
370 WeatherOffsetNP.setState(IPS_ALERT);
371 WeatherOffsetNP.apply();
372 }
373 return true;
374 }
375
376 if (DewAggressivenessNP.isNameMatch(name))
377 {
378 if (setDewAggressiveness(static_cast<uint8_t>(values[0])))
379 {
380 DewAggressivenessNP.update(values, names, n);
381 DewAggressivenessNP.setState(IPS_OK);
382 }
383 else
384 DewAggressivenessNP.setState(IPS_ALERT);
385 DewAggressivenessNP.apply();
386 return true;
387 }
388
389 if (ThresholdNP.isNameMatch(name))
390 {
391 if (setThreshold(static_cast<uint8_t>(values[0])))
392 {
393 ThresholdNP.update(values, names, n);
394 ThresholdNP.setState(IPS_OK);
395 }
396 else
397 ThresholdNP.setState(IPS_ALERT);
398 ThresholdNP.apply();
399 return true;
400 }
401
402 }
403
404 return INDI::DefaultDevice::ISNewNumber(dev, name, values, names, n);
405}
406
407bool PegasusFlatMasterNeo::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
408{
409 // Before the WiFi helper, so old configurations do not send hotspot credentials to the device.
410 if (ignoredWhileLoadingConfig(dev, name))
411 return true;
412
413 if (wifi.ISNewText(dev, name, texts, names, n))
414 return true;
415
416 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
417 {
418 if (LI::processText(dev, name, texts, names, n))
419 return true;
420
421
422 }
423
424 return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n);
425}
426
427bool PegasusFlatMasterNeo::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
428{
429 // Before the WiFi helper, so old configurations do not switch the hotspot.
430 if (ignoredWhileLoadingConfig(dev, name))
431 return true;
432
433 if (wifi.ISNewSwitch(dev, name, states, names, n))
434 return true;
435
436 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
437 {
438 if (DI::processSwitch(dev, name, states, names, n))
439 return true;
440
441 if (LI::processSwitch(dev, name, states, names, n))
442 return true;
443
444 if (WI::processSwitch(dev, name, states, names, n))
445 return true;
446
447 if (AutoDewSP.isNameMatch(name))
448 {
449 AutoDewSP.update(states, names, n);
450 bool enable = AutoDewSP[0].getState() == ISS_ON;
451 if (setAutoDew(enable))
452 AutoDewSP.setState(IPS_OK);
453 else
454 AutoDewSP.setState(IPS_ALERT);
455 AutoDewSP.apply();
456 return true;
457 }
458
459 if (RebootSP.isNameMatch(name))
460 {
461 // FQ restarts the device at once and sends no reply; its USB port goes away for a moment,
462 // so disconnect instead of polling a dead port.
463 int nbytes_written = 0;
464 tty_write_string(PortFD, m_IsTCP ? "FQ\r\n" : "FQ\n", &nbytes_written);
465 RebootSP.setState(IPS_OK);
466 RebootSP.apply();
467 LOG_INFO("Device restarts. Connect again in a few seconds.");
468 Disconnect();
469 setConnected(false, IPS_IDLE);
471 return true;
472 }
473
474 if (SaveDewSP.isNameMatch(name))
475 {
476 if (saveDewLevels())
477 SaveDewSP.setState(IPS_OK);
478 else
479 SaveDewSP.setState(IPS_ALERT);
480 SaveDewSP.apply();
481 return true;
482 }
483
484 if (AutoCloseSP.isNameMatch(name))
485 {
486 AutoCloseSP.update(states, names, n);
487 bool enable = AutoCloseSP[0].getState() == ISS_ON;
488 if (setAutoClose(enable))
489 AutoCloseSP.setState(IPS_OK);
490 else
491 AutoCloseSP.setState(IPS_ALERT);
492 AutoCloseSP.apply();
493 return true;
494 }
495
496
497
498
499 if (WifiFactoryResetSP.isNameMatch(name))
500 {
501 wifiFactoryReset();
502 WifiFactoryResetSP.setState(IPS_OK);
503 WifiFactoryResetSP.apply();
504 LOG_INFO("WiFi factory reset sent to device.");
505 return true;
506 }
507 }
508
509 return INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n);
510}
511
513{
514 LI::snoop(root);
515
517}
518
520{
524 wifi.saveConfigItems(fp);
525 // Dew, cap, offset and WiFi settings are stored in the device and read from it on
526 // connection. Saving them here would send old values back every time the config loads.
527 return true;
528}
529
530bool PegasusFlatMasterNeo::sendCommandBuffer(const char *command, char *res, int res_len, int timeout_sec)
531{
532 int nbytes_written = 0, nbytes_read = 0, rc = -1;
533 char errstr[MAXRBUF];
534
535 // Room for WN:/WP: with a 63-character password; a smaller buffer cut long passwords silently.
536 char cmd[128] = {0};
537 // Over TCP the firmware only executes a command after a carriage return.
538 snprintf(cmd, sizeof(cmd), m_IsTCP ? "%s\r\n" : "%s\n", command);
539
540 // Do not write WiFi and hotspot passwords to the log.
541 const bool secret = strncmp(command, "AP:", 3) == 0 || strncmp(command, "WP:", 3) == 0;
542 LOGF_DEBUG("CMD <%s>", secret ? "<password>" : command);
543
544 // tcflush() does not discard data on a TCP socket.
546
547 if ((rc = tty_write(PortFD, cmd, strlen(cmd), &nbytes_written)) != TTY_OK)
548 {
549 tty_error_msg(rc, errstr, MAXRBUF);
550 LOGF_ERROR("command: %s error: %s.", cmd, errstr);
551 return false;
552 }
553
554 // Leave room for the terminating zero.
555 if ((rc = tty_nread_section(PortFD, res, res_len - 1, 0xA, timeout_sec, &nbytes_read)) != TTY_OK)
556 {
557 tty_error_msg(rc, errstr, MAXRBUF);
558 LOGF_ERROR("command: %s error: %s.", command, errstr);
559 res[0] = 0;
560 // Discard the rest of a reply that did not fit, so the next reply starts clean.
561 if (rc == TTY_OVERFLOW)
562 {
563 // Bounded: after a reboot (FQ) the old port only returns end-of-file, which also
564 // counts as an overflow and would otherwise loop forever.
565 char discard[256];
566 int discarded = 0;
567 for (int i = 0; i < 8 && tty_nread_section(PortFD, discard, sizeof(discard), 0xA, 1, &discarded) == TTY_OVERFLOW; i++)
568 ;
569 }
570 tcflush(PortFD, TCIOFLUSH);
571 return false;
572 }
573
574 // Strip trailing newline and carriage return
575 res[nbytes_read - 1] = 0;
576 if (nbytes_read > 1 && res[nbytes_read - 2] == '\r')
577 res[nbytes_read - 2] = 0;
578
579 // AL answers <ssid>:<password>, and AP:/WP: may echo the password.
580 LOGF_DEBUG("RES <%s>", strcmp(command, "AL") == 0 ? "<ssid>:<password>" : secret ? "<password>" : res);
581
582 tcflush(PortFD, TCIOFLUSH);
583
584 return true;
585}
586
587bool PegasusFlatMasterNeo::sendEchoCommand(const char *cmd)
588{
589 char response[32] = {0};
590 if (!sendCommand(cmd, response))
591 return false;
592
593 if (strcmp(response, cmd) != 0)
594 {
595 LOGF_ERROR("Unexpected response to %s: '%s'", cmd, response);
596 return false;
597 }
598
599 return true;
600}
601
602// FA reports the aggressiveness either as level 0..10 or as the byte 9..255 sent with PD.
603uint8_t PegasusFlatMasterNeo::aggressivenessLevel(double value)
604{
605 if (value <= 10)
606 return static_cast<uint8_t>(std::max(0.0, value));
607 return static_cast<uint8_t>(std::min(10.0, std::max(0.0, round((value - 9) * 10.0 / 246.0))));
608}
609
611{
612 if (!sendEchoCommand("FS:0"))
613 return IPS_ALERT;
614
615 // Command accepted — cap is now moving; TimerHit will finalize the state
616 m_CapTarget = CAP_STATUS_PARKED;
617 m_CapMoveStarted = std::chrono::steady_clock::now();
618 return IPS_BUSY;
619}
620
622{
623 if (!sendEchoCommand("FS:1"))
624 return IPS_ALERT;
625
626 // Command accepted — cap is now moving; TimerHit will finalize the state
627 m_CapTarget = CAP_STATUS_UNPARKED;
628 m_CapMoveStarted = std::chrono::steady_clock::now();
629 return IPS_BUSY;
630}
631
633{
634 char response[16] = {0};
635 if (sendCommand("FH", response) && strstr(response, "FH:1") != nullptr)
636 return IPS_OK;
637 return IPS_ALERT;
638}
639
640bool PegasusFlatMasterNeo::setDewHeater(uint8_t value)
641{
642 char cmd[16] = {0};
643 snprintf(cmd, 16, "DH:%d", value);
644 return sendEchoCommand(cmd);
645}
646
647bool PegasusFlatMasterNeo::setAutoDew(bool enable)
648{
649 char cmd[16] = {0};
650 snprintf(cmd, 16, "PD:%d", enable ? 1 : 0);
651
652 if (!sendEchoCommand(cmd))
653 return false;
654
655 if (!getStatusData())
656 return false;
657
658 const bool actual = (DeviceStatusNP[STATUS_AUTO_DEW].getValue() == 1);
659 if (actual != enable)
660 {
661 LOGF_ERROR("AutoDew %s failed: device reports %s.", enable ? "enable" : "disable", actual ? "enabled" : "disabled");
662 return false;
663 }
664
665 return true;
666}
667
668bool PegasusFlatMasterNeo::setCapAngle(uint16_t angle)
669{
670 char cmd[16] = {0};
671 snprintf(cmd, 16, "CD:%d", angle);
672 return sendEchoCommand(cmd);
673}
674
676{
677 if (!isConnected())
678 {
680 return;
681 }
682
683 getStatusData();
684 getWeatherData();
685 getUptime();
686 wifi.updateConnection();
687
689}
690
691bool PegasusFlatMasterNeo::getStatusData()
692{
693 char response[NEO_LEN] = {0};
694
695 if (!sendCommand("FA", response))
696 {
697 LOG_ERROR("Error querying device status.");
698 return false;
699 }
700
701 // FA response: "FMNEO:lightIntensity:lightActive:capActual:capTarget:capStatus:dewPower:autoDew:dewAggressive:lightSensor"
702 std::vector<std::string> result = split(response, ":");
703
704 if (result.size() < FA_N)
705 {
706 LOGF_WARN("Received unexpected FA status format: %s", response);
707 return false;
708 }
709
710 // Skip update if nothing changed, but always re-evaluate when a park/unpark is in progress
711 // to ensure IPS_BUSY is resolved even if the cap was already at the target position.
712 if (result == lastStatusData && ParkCapSP.getState() != IPS_BUSY)
713 return true;
714
715 try
716 {
717 const double lightIntensity = std::stod(result[FA_LIGHT_INTENSITY]);
718 const double lightActive = std::stod(result[FA_LIGHT_ACTIVE]);
719 const double capTargetAngle = std::stod(result[FA_CAP_TARGET_ANGLE]);
720 const double capActualAngle = std::stod(result[FA_CAP_ACTUAL_ANGLE]);
721 const double capStatus = std::stod(result[FA_CAP_STATUS]);
722 const double dewPower = std::stod(result[FA_DEW_POWER]);
723 const double autoDew = std::stod(result[FA_AUTO_DEW_STATUS]);
724 const double dewAggressive = std::stod(result[FA_DEW_AGGRESSIVE]);
725 const double lightSensor = std::stod(result[FA_LIGHT_SENSOR]);
726
727
728 // --- Overview tab ---
729 DeviceStatusNP[STATUS_LIGHT_INTENSITY].setValue(lightIntensity);
730 DeviceStatusNP[STATUS_LIGHT_ACTIVE].setValue(lightActive);
731 DeviceStatusNP[STATUS_CAP_TARGET_ANGLE].setValue(capTargetAngle);
732 DeviceStatusNP[STATUS_CAP_ACTUAL_ANGLE].setValue(capActualAngle);
733 DeviceStatusNP[STATUS_CAP_STATUS].setValue(capStatus);
734 DeviceStatusNP[STATUS_DEW_POWER].setValue(dewPower);
735 DeviceStatusNP[STATUS_AUTO_DEW].setValue(autoDew);
736 DeviceStatusNP[STATUS_DEW_AGGRESSIVE].setValue(aggressivenessLevel(dewAggressive));
737 DeviceStatusNP[STATUS_LIGHT_SENSOR].setValue(lightSensor);
738 DeviceStatusNP.setState(IPS_OK);
739 DeviceStatusNP.apply();
740
741 // --- LightBox interface ---
742 const bool lightOn = (lightActive != 0);
743 if (LightSP[FLAT_LIGHT_ON].getState() != (lightOn ? ISS_ON : ISS_OFF))
744 {
745 LightSP.reset();
746 LightSP[lightOn ? FLAT_LIGHT_ON : FLAT_LIGHT_OFF].setState(ISS_ON);
747 LightSP.setState(IPS_OK);
748 LightSP.apply();
749 }
750 if (LightIntensityNP[0].getValue() != lightIntensity)
751 {
752 LightIntensityNP[0].setValue(lightIntensity);
753 LightIntensityNP.setState(IPS_OK);
754 LightIntensityNP.apply();
755 }
756
757 // --- DustCap interface ---
758 // Any other value (e.g. in-motion) leaves IPS_BUSY in place until the
759 // final state arrives; the switch selection is not changed mid-motion.
760 if (ParkCapSP.getState() == IPS_BUSY && (capStatus == CAP_STATUS_PARKED || capStatus == CAP_STATUS_UNPARKED)
761 && capStatus != m_CapTarget)
762 {
763 // Right after FS:x the cap may still report the old end position.
764 if (std::chrono::steady_clock::now() - m_CapMoveStarted > CAP_START_TIMEOUT)
765 {
766 LOGF_ERROR("Cap did not move, it is still %s.", capStatus == CAP_STATUS_PARKED ? "closed" : "open");
767 ParkCapSP.reset();
768 ParkCapSP[capStatus == CAP_STATUS_PARKED ? CAP_PARK : CAP_UNPARK].setState(ISS_ON);
769 ParkCapSP.setState(IPS_ALERT);
770 ParkCapSP.apply();
771 }
772 }
773 else if (capStatus == CAP_STATUS_PARKED)
774 {
775 if (ParkCapSP[CAP_PARK].getState() != ISS_ON || ParkCapSP.getState() != IPS_OK)
776 {
777 ParkCapSP.reset();
778 ParkCapSP[CAP_PARK].setState(ISS_ON);
779 ParkCapSP.setState(IPS_OK);
780 ParkCapSP.apply();
781 }
782 }
783 else if (capStatus == CAP_STATUS_UNPARKED)
784 {
785 if (ParkCapSP[CAP_UNPARK].getState() != ISS_ON || ParkCapSP.getState() != IPS_OK)
786 {
787 ParkCapSP.reset();
788 ParkCapSP[CAP_UNPARK].setState(ISS_ON);
789 ParkCapSP.setState(IPS_OK);
790 ParkCapSP.apply();
791 }
792 }
793 if (CapAngleNP[0].getValue() != capTargetAngle)
794 {
795 CapAngleNP[0].setValue(capTargetAngle);
796 CapAngleNP.setState(IPS_OK);
797 CapAngleNP.apply();
798 }
799
800 // --- Dew controls: follow the device, which may also be set from Pegasus Unity ---
801 if (DewHeaterNP[0].getValue() != dewPower || DewHeaterNP.getState() == IPS_IDLE)
802 {
803 DewHeaterNP[0].setValue(dewPower);
804 DewHeaterNP.setState(IPS_OK);
805 DewHeaterNP.apply();
806 }
807 const bool autoDewOn = (autoDew != 0);
808 if (AutoDewSP[0].getState() != (autoDewOn ? ISS_ON : ISS_OFF) || AutoDewSP.getState() == IPS_IDLE)
809 {
810 AutoDewSP.reset();
811 AutoDewSP[autoDewOn ? 0 : 1].setState(ISS_ON);
812 AutoDewSP.setState(IPS_OK);
813 AutoDewSP.apply();
814 }
815 const uint8_t level = aggressivenessLevel(dewAggressive);
816 if (DewAggressivenessNP[0].getValue() != level || DewAggressivenessNP.getState() == IPS_IDLE)
817 {
818 DewAggressivenessNP[0].setValue(level);
819 DewAggressivenessNP.setState(IPS_OK);
820 DewAggressivenessNP.apply();
821 }
822 }
823 catch (const std::exception &e)
824 {
825 LOGF_ERROR("Error parsing FA status data: %s", e.what());
826 return false;
827 }
828
829 lastStatusData = result;
830 return true;
831}
832
833bool PegasusFlatMasterNeo::getWeatherOffsets()
834{
835 char response[NEO_LEN] = {0};
836
837 if (!sendCommand("CR", response))
838 {
839 LOG_ERROR("Error querying weather offsets.");
840 return false;
841 }
842
843 // CR response: "CR:temp_offset:humidity_offset"
844 std::vector<std::string> result = split(response, ":");
845
846 if (result.size() < CR_N)
847 {
848 LOGF_WARN("Received unexpected CR offset format: %s", response);
849 return false;
850 }
851
852 try
853 {
854 WeatherOffsetNP[OFFSET_TEMPERATURE].setValue(std::stod(result[CR_TEMP_OFFSET]));
855 WeatherOffsetNP[OFFSET_HUMIDITY].setValue(std::stod(result[CR_HUM_OFFSET]));
856 WeatherOffsetNP.setState(IPS_OK);
857 WeatherOffsetNP.apply();
858 }
859 catch (const std::exception &e)
860 {
861 LOGF_ERROR("Error parsing CR offset data: %s", e.what());
862 return false;
863 }
864
865 return true;
866}
867
868bool PegasusFlatMasterNeo::setTemperatureOffset(double value)
869{
870 char cmd[16] = {0};
871 char response[16] = {0};
872 snprintf(cmd, 16, "CT:%.1f", value);
873 // The reply is not checked, as in the Pegasus software; the caller reads the offsets back with CR.
874 if (!sendCommand(cmd, response))
875 return false;
876 LOGF_DEBUG("CT reply: %s", response);
877 return true;
878}
879
880bool PegasusFlatMasterNeo::setHumidityOffset(double value)
881{
882 // The humidity offset is a whole percentage, -50..50.
883 char cmd[16] = {0};
884 snprintf(cmd, 16, "CH:%d", static_cast<int>(std::lround(value)));
885 return sendEchoCommand(cmd);
886}
887
888bool PegasusFlatMasterNeo::getWeatherData()
889{
890 char response[NEO_LEN] = {0};
891
892 if (!sendCommand("ES", response))
893 {
894 LOG_ERROR("Error querying weather data.");
895 return false;
896 }
897
898 // ES response: "FlatMasterNeo:temperature:humidity:dewpoint"
899 // Field separator is ':' — adjust if device uses a different delimiter
900 std::vector<std::string> result = split(response, ":");
901
902 if (result.size() < WI_N)
903 {
904 LOGF_WARN("Received unexpected weather data format: %s", response);
905 return false;
906 }
907
908 if (result == lastWeatherData)
909 return true;
910
911 try
912 {
913 // The device reports nan or -127 without a sensor; do not pass that on as a temperature.
914 const double temperature = std::stod(result[WI_TEMPERATURE]);
916 {
917 if (lastWeatherData.empty())
918 LOG_WARN("No temperature/humidity sensor data available.");
919 lastWeatherData = result;
920 return false;
921 }
922 setParameterValue("WEATHER_TEMPERATURE", temperature);
923 setParameterValue("WEATHER_HUMIDITY", std::fabs(std::stod(result[WI_HUMIDITY])));
924 setParameterValue("WEATHER_DEWPOINT", std::stod(result[WI_DEWPOINT]));
925 }
926 catch (const std::exception &e)
927 {
928 LOGF_ERROR("Error parsing weather data: %s", e.what());
929 return false;
930 }
931
933 critialParametersLP.apply();
934
935 ParametersNP.setState(IPS_OK);
936 ParametersNP.apply();
937
938 lastWeatherData = result;
939 return true;
940}
941
942bool PegasusFlatMasterNeo::getUptime()
943{
944 char response[16] = {0};
945 if (!sendCommand("FU", response))
946 return false;
947
948 // Response is either a plain integer or FU:<seconds>
949 const char *val = strstr(response, "FU:");
950 UptimeNP[0].setValue(atof(val ? val + 3 : response));
951 UptimeNP.setState(IPS_OK);
952 UptimeNP.apply();
953 return true;
954}
955
956bool PegasusFlatMasterNeo::getThreshold()
957{
958 char response[16] = {0};
959 if (!sendCommand("DT", response))
960 return false;
961
962 const char *val = strstr(response, "DT:");
963 if (!val)
964 return false;
965
966 int threshold = atoi(val + 3);
967 if (threshold < 1 || threshold > 50)
968 {
969 LOGF_WARN("DT returned %d which is outside the valid range [1..50], ignoring.", threshold);
970 return false;
971 }
972
973 ThresholdNP[0].setValue(threshold);
974 ThresholdNP.setState(IPS_OK);
975 ThresholdNP.apply();
976 return true;
977}
978
979bool PegasusFlatMasterNeo::setThreshold(uint8_t value)
980{
981 if (value < 1 || value > 50)
982 {
983 LOGF_ERROR("Threshold %d is outside the valid range [1..50].", value);
984 return false;
985 }
986 char cmd[16] = {0};
987 snprintf(cmd, sizeof(cmd), "DT:%d", value);
988 return sendEchoCommand(cmd);
989}
990
991// level 0..10 → DA:<level>. Firmware 1.4 applies it right away (FA field 8 follows). The Unity
992// Platform also sends PD:<9..255>, but the firmware answers that with PD:1 and treats it as
993// "auto dew on", so it would switch auto dew on as a side effect.
994bool PegasusFlatMasterNeo::setDewAggressiveness(uint8_t level)
995{
996 char cmd[16] = {0};
997 snprintf(cmd, sizeof(cmd), "DA:%d", level);
998 return sendEchoCommand(cmd);
999}
1000
1001bool PegasusFlatMasterNeo::saveDewLevels()
1002{
1003 // Pegasus firmware answers an unknown command with ">>"; firmware 1.4 does so for DSTR.
1004 char response[16] = {0};
1005 sendCommand("DSTR", response);
1006 if (strncmp(response, ">>", 2) == 0)
1007 {
1008 LOG_WARN("This firmware does not support saving the dew levels (DSTR).");
1009 return false;
1010 }
1011 return true;
1012}
1013
1014bool PegasusFlatMasterNeo::getAutoClose()
1015{
1016 char response[16] = {0};
1017 if (!sendCommand("DC:99", response))
1018 return false;
1019
1020 const bool on = (strcmp(response, "DC:1") == 0);
1021 AutoCloseSP.reset();
1022 AutoCloseSP[on ? 0 : 1].setState(ISS_ON);
1023 AutoCloseSP.setState(IPS_OK);
1024 AutoCloseSP.apply();
1025 return true;
1026}
1027
1028bool PegasusFlatMasterNeo::setAutoClose(bool enable)
1029{
1030 char cmd[16] = {0};
1031 snprintf(cmd, sizeof(cmd), "DC:%d", enable ? 1 : 0);
1032 return sendEchoCommand(cmd);
1033}
1034
1035bool PegasusFlatMasterNeo::wifiFactoryReset()
1036{
1037 // WZ sends without waiting for a response (Channel.Write behavior). Over TCP the firmware only
1038 // executes a command after a carriage return.
1039 int nbytes_written = 0;
1040 return tty_write_string(PortFD, m_IsTCP ? "WZ\r\n" : "WZ\n", &nbytes_written) == TTY_OK;
1041}
1042
1043std::vector<std::string> PegasusFlatMasterNeo::split(const std::string &input, const std::string &sep)
1044{
1045 std::vector<std::string> result;
1046 std::regex re(sep);
1047 std::sregex_token_iterator it(input.begin(), input.end(), re, -1);
1048 std::sregex_token_iterator end;
1049 for (; it != end; ++it)
1050 result.push_back(it->str());
1051 return result;
1052}
double temperature
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
The TCP class manages connection with devices over the network via TCP/IP. Upon successful connection...
bool isConnected() const
const char * getDeviceName() const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
virtual bool Disconnect()
Disconnect from device.
void registerConnection(Connection::Interface *newConnection)
registerConnection Add new connection plugin to the existing connection pool. The connection type sha...
virtual void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
bool isConfigLoading() const
isConfigLoading Check if driver configuration is currently in the process of getting loaded.
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg=nullptr)
Set connection switch status in the client.
virtual bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
friend class WeatherInterface
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
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...
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
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.
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
friend class LightBoxInterface
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
DustCapInterface(DefaultDevice *device)
INDI::PropertySwitch ParkCapSP
bool updateProperties()
updateProperties Defines or Delete properties based on default device connection status
void initProperties(const char *group, uint32_t capabilities=0)
Initialize dust cap properties. It is recommended to call this function within initProperties() of yo...
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process dust cap switch properties.
void initProperties(const char *group, uint32_t capabilities)
Initialize light box properties. It is recommended to call this function within initProperties() of y...
void ISGetProperties(const char *deviceName)
isGetLightBoxProperties Get light box properties
INDI::PropertyNumber LightIntensityNP
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process light box switch properties.
bool processText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process light box text properties.
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process light box number properties.
Provides generic container for INDI properties.
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
static constexpr int TCP_PORT
Port of the TCP command socket.
static void drain(int portFD)
Discard pending input. tcflush() only works on a serial port, so over TCP a line end left behind by a...
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be implemented in the child class, if supported.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual IPState AbortCap() override
Abort motion. Must be implemented by child.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be implemented in the child class.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
IPState
Property state.
Definition indiapi.h:158
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
@ ISR_ATMOST1
Definition indiapi.h:172
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition indicom.c:418
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
Definition indicom.c:473
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Definition indicom.c:1243
int tty_nread_section(int fd, char *buf, int nsize, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition indicom.c:759
Implementations for common driver routines.
@ TTY_OK
Definition indicom.h:54
@ TTY_OVERFLOW
Definition indicom.h:62
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
Definition indidevapi.c:509
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition indidevapi.c:44
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
Definition indidevapi.c:416
#define MAXRBUF
Definition indidriver.c:52
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_WARN(fmt,...)
Definition indilogger.h:81
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition indilogger.h:72
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
struct xml_ele_ XMLEle
Definition lilxml.h:81
@ discarded
discarded by the parser callback function
*brief create JSON pointer *sa reference_tokens end()
json_pointer res
uint8_t cmd[4]
Definition pwc-ioctl.h:2
double round(double value, int decimal_places)