mirror of
https://github.com/eddyem/small_tel.git
synced 2025-12-06 02:35:14 +03:00
it works
This commit is contained in:
parent
ef2c86675e
commit
a888b42eb6
@ -150,10 +150,25 @@ static int runcmd(const char *cmd, const char *par){
|
||||
|
||||
// check current state and turn on/off relay if need
|
||||
static void chkrelay(){
|
||||
static dome_state_t oldstate = DOME_S_MOVING;
|
||||
static double t0 = 0.;
|
||||
if(state != DOME_S_MOVING) return;
|
||||
if(dome_status.coverstate[0] == COVER_INTERMEDIATE ||
|
||||
dome_status.coverstate[1] == COVER_INTERMEDIATE) return; // still moving
|
||||
// OK, we are on place - turn off motors' power
|
||||
dome_status.coverstate[1] == COVER_INTERMEDIATE){ // still moving
|
||||
oldstate = DOME_S_MOVING;
|
||||
return;
|
||||
}
|
||||
DBG("state=%d, oldstate=%d", state, oldstate);
|
||||
// OK, we are on place - turn off motors' power after 5 seconds
|
||||
if(oldstate == DOME_S_MOVING){ // just stopped - fire pause
|
||||
t0 = sl_dtime();
|
||||
oldstate = DOME_S_IDLE;
|
||||
DBG("START 5s pause");
|
||||
return;
|
||||
}else{ // check pause
|
||||
if(sl_dtime() - t0 < POWER_STOP_TIMEOUT) return;
|
||||
}
|
||||
DBG("5s out -> turn off power");
|
||||
char buf[128];
|
||||
snprintf(buf, 127, "%s%d,%d", ASIB_CMD_RELAY, MOTRELAY_NO, MOTRELAY_OFF);
|
||||
if(serial_write(buf, buf, 128) && check_status()){
|
||||
@ -161,6 +176,7 @@ static void chkrelay(){
|
||||
if(dome_status.relay[MOTRELAY_NO-1] == MOTRELAY_OFF){
|
||||
DBG("OK state->IDLE");
|
||||
state = DOME_S_IDLE;
|
||||
oldstate = DOME_S_MOVING;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,23 +238,23 @@ dome_state_t dome_poll(dome_cmd_t cmd, int par){
|
||||
case DOME_CLOSE:
|
||||
if(!runcmd(ASIB_CMD_CLOSE, NULL)) goto ret;
|
||||
break;
|
||||
case DOME_OPEN_ONE:
|
||||
case DOME_OPEN_ONE: // due to bug in documentation, 0 - OPEN
|
||||
if(par < 1 || par > 2) goto ret;
|
||||
snprintf(buf, 127, "%d 90", par);
|
||||
snprintf(buf, 127, "%d,0", par-1);
|
||||
if(!runcmd(ASIB_CMD_MOVEONE, buf)) goto ret;
|
||||
break;
|
||||
case DOME_CLOSE_ONE:
|
||||
case DOME_CLOSE_ONE: // due to bug in documentation, 90 - CLOSE
|
||||
if(par < 1 || par > 2) goto ret;
|
||||
snprintf(buf, 127, "%d 0", par);
|
||||
snprintf(buf, 127, "%d,90", par-1);
|
||||
if(!runcmd(ASIB_CMD_MOVEONE, buf)) goto ret;
|
||||
break;
|
||||
case DOME_RELAY_ON:
|
||||
if(par < 1 || par > 3) goto ret;
|
||||
if(par < NRELAY_MIN || par > NRELAY_MAX) goto ret;
|
||||
snprintf(buf, 127, "%d,1", par);
|
||||
if(!runcmd(ASIB_CMD_RELAY, buf)) goto ret;
|
||||
break;
|
||||
case DOME_RELAY_OFF:
|
||||
if(par < 1 || par > 3) goto ret;
|
||||
if(par < NRELAY_MIN || par > NRELAY_MAX) goto ret;
|
||||
snprintf(buf, 127, "%d,0", par);
|
||||
if(!runcmd(ASIB_CMD_RELAY, buf)) goto ret;
|
||||
break;
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
#define NRELAY_MIN 1
|
||||
#define NRELAY_MAX 3
|
||||
|
||||
// pause to clear power after stop - 5 seconds
|
||||
#define POWER_STOP_TIMEOUT (5.)
|
||||
|
||||
// dome finite state machine state
|
||||
typedef enum{
|
||||
DOME_S_IDLE, // idle, motors disabled
|
||||
@ -43,13 +46,13 @@ typedef enum{
|
||||
|
||||
// cover states
|
||||
enum{
|
||||
COVER_INTERMEDIATE = 1,
|
||||
COVER_INTERMEDIATE = 0,
|
||||
COVER_OPENED = 2,
|
||||
COVER_CLOSED = 3
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
int coverstate[2]; // north/south covers state (3 - closed, 2 - opened, 1 - intermediate)
|
||||
int coverstate[2]; // north/south covers state (3 - closed, 2 - opened, 0 - intermediate)
|
||||
int encoder[2]; // encoders values
|
||||
float Tin; // temperatures (unavailable)
|
||||
float Tout;
|
||||
|
||||
184
Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user
Normal file
184
Daemons/domedaemon-astrosib/domedaemon-astrosib.creator.user
Normal file
@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 16.0.2, 2025-06-04T10:34:29. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{cf63021e-ef53-49b0-b03b-2f2570cdf3b6}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="qlonglong">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoDetect">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">KOI8-R</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.LineEndingBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<value type="bool" key="AutoTest.ApplyFilter">false</value>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<valuelist type="QVariantList" key="AutoTest.PathFilters"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
||||
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{91347f2c-5221-46a7-80b1-0a054ca02f79}</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/eddy/Docs/SAO/10micron/C-sources/domedaemon-astrosib</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||
<value type="QString">all</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||
<value type="QString">clean</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">По умолчанию</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Развёртывание</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="QList<int>" key="Analyzer.Valgrind.VisibleErrorKinds"></value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
|
||||
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
||||
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="qlonglong">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
@ -110,5 +110,5 @@ int main(int argc, char **argv){
|
||||
sl_tty_tmout(DEFAULT_SERTMOUT);
|
||||
server_run(type, G.node, serial);
|
||||
LOGERR("Unreacheable code reached!");
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -33,6 +33,10 @@
|
||||
#define CMD_STATUS "status"
|
||||
#define CMD_STATUST "statust"
|
||||
#define CMD_RELAY "relay"
|
||||
#define CMD_OPEN "open"
|
||||
#define CMD_CLOSE "close"
|
||||
#define CMD_STOP "stop"
|
||||
#define CMD_HALF "half"
|
||||
|
||||
// main socket
|
||||
static sl_sock_t *s = NULL;
|
||||
@ -81,7 +85,6 @@ static sl_sock_hresult_e statusth(sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ c
|
||||
}
|
||||
// relay on/off
|
||||
static sl_sock_hresult_e relays(int Nrelay, int Stat){
|
||||
if(Nrelay < NRELAY_MIN|| Nrelay > NRELAY_MAX) return RESULT_BADKEY;
|
||||
dome_cmd_t cmd = Stat ? DOME_RELAY_ON : DOME_RELAY_OFF;
|
||||
if(DOME_S_ERROR == dome_poll(cmd, Nrelay)) return RESULT_FAIL;
|
||||
return RESULT_OK;
|
||||
@ -89,6 +92,7 @@ static sl_sock_hresult_e relays(int Nrelay, int Stat){
|
||||
static sl_sock_hresult_e relay(sl_sock_t *c, sl_sock_hitem_t *item, const char *req){
|
||||
char buf[128];
|
||||
int N = item->key[sizeof(CMD_RELAY) - 1] - '0';
|
||||
if(N < NRELAY_MIN|| N > NRELAY_MAX) return RESULT_BADKEY;
|
||||
if(!req || !*req){ // getter
|
||||
dome_status_t dome_status;
|
||||
double lastt = get_dome_status(&dome_status);
|
||||
@ -100,6 +104,46 @@ static sl_sock_hresult_e relay(sl_sock_t *c, sl_sock_hitem_t *item, const char *
|
||||
int Stat = *req - '0';
|
||||
return relays(N, Stat);
|
||||
}
|
||||
// dome open/close/stop
|
||||
static sl_sock_hresult_e domecmd(dome_cmd_t cmd){
|
||||
if(DOME_S_ERROR == dome_poll(cmd, 0)) return RESULT_FAIL;
|
||||
return RESULT_OK;
|
||||
}
|
||||
static sl_sock_hresult_e opendome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){
|
||||
return domecmd(DOME_OPEN);
|
||||
}
|
||||
static sl_sock_hresult_e closedome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){
|
||||
return domecmd(DOME_CLOSE);
|
||||
}
|
||||
static sl_sock_hresult_e stopdome(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item, _U_ const char *req){
|
||||
return domecmd(DOME_STOP);
|
||||
}
|
||||
// half open/close
|
||||
static sl_sock_hresult_e halfmove(sl_sock_t *c, sl_sock_hitem_t *item, const char *req){
|
||||
char buf[128];
|
||||
int N = item->key[sizeof(CMD_HALF) - 1] - '0';
|
||||
if(N < 1 || N > 2) return RESULT_BADKEY;
|
||||
if(!req || !*req){ // getter
|
||||
dome_status_t dome_status;
|
||||
double lastt = get_dome_status(&dome_status);
|
||||
if(sl_dtime() - lastt > STATUS_MAX_AGE) return RESULT_FAIL;
|
||||
int s = dome_status.coverstate[N-1];
|
||||
int S = -1;
|
||||
switch(s){
|
||||
case COVER_OPENED: S = 1; break;
|
||||
case COVER_CLOSED: S = 0; break;
|
||||
default: break;
|
||||
}
|
||||
snprintf(buf, 127, "%s=%d\n", item->key, S);
|
||||
sl_sock_sendstrmessage(c, buf);
|
||||
return RESULT_SILENCE;
|
||||
}
|
||||
int Stat = *req - '0';
|
||||
dome_cmd_t cmd = Stat ? DOME_OPEN_ONE : DOME_CLOSE_ONE;
|
||||
green("\n\nstat=%d, cmd=%d, N=%d\n\n", Stat, cmd, N);
|
||||
if(DOME_S_ERROR == dome_poll(cmd, N)) return RESULT_FAIL;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
// and all handlers collection
|
||||
static sl_sock_hitem_t handlers[] = {
|
||||
@ -109,6 +153,11 @@ static sl_sock_hitem_t handlers[] = {
|
||||
{relay, CMD_RELAY "1", "turn on/off (=1/0) relay 1", NULL},
|
||||
{relay, CMD_RELAY "2", "turn on/off (=1/0) relay 2", NULL},
|
||||
{relay, CMD_RELAY "3", "turn on/off (=1/0) relay 3", NULL},
|
||||
{opendome, CMD_OPEN, "open dome", NULL},
|
||||
{closedome, CMD_CLOSE, "close dome", NULL},
|
||||
{stopdome, CMD_STOP, "stop moving", NULL},
|
||||
{halfmove, CMD_HALF "1", "open/close (=1/0) north half of dome", NULL},
|
||||
{halfmove, CMD_HALF "2", "open/close (=1/0) south half of dome", NULL},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user