mirror of
https://github.com/eddyem/BTA_utils.git
synced 2025-12-06 02:35:13 +03:00
forget precipitations
This commit is contained in:
parent
ce5767775d
commit
77ca453860
@ -3,7 +3,7 @@ LDFLAGS = -lcrypt
|
|||||||
SRCS = $(wildcard *.c)
|
SRCS = $(wildcard *.c)
|
||||||
CC = gcc
|
CC = gcc
|
||||||
DEFINES = -D_XOPEN_SOURCE=1111 -D_GNU_SOURCE
|
DEFINES = -D_XOPEN_SOURCE=1111 -D_GNU_SOURCE
|
||||||
DEFINES += -DEBUG
|
#DEFINES += -DEBUG
|
||||||
CXX = gcc
|
CXX = gcc
|
||||||
CFLAGS = -std=gnu99 -Wall -Werror -Wextra $(DEFINES) -pthread
|
CFLAGS = -std=gnu99 -Wall -Werror -Wextra $(DEFINES) -pthread
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|||||||
@ -82,12 +82,18 @@ static int crc_check(uint8_t *buffer, int length){
|
|||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
uint16_t crc = 0xFFFF;
|
uint16_t crc = 0xFFFF;
|
||||||
int valid_crc;
|
int valid_crc;
|
||||||
|
#ifdef EBUG
|
||||||
|
printf("buffer: ");
|
||||||
|
for(int i = 0; i < length; ++i) printf("%02x ", buffer[i]);
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
while (length-- > 2) {
|
while (length-- > 2) {
|
||||||
byte = *buffer++ ^ crc;
|
byte = *buffer++ ^ crc;
|
||||||
crc >>= 8;
|
crc >>= 8;
|
||||||
crc ^= crc16_table[byte];
|
crc ^= crc16_table[byte];
|
||||||
}
|
}
|
||||||
valid_crc = (crc >> 8) == buffer[1] && (crc & 0xFF) == buffer[0];
|
valid_crc = (crc >> 8) == buffer[1] && (crc & 0xFF) == buffer[0];
|
||||||
|
DBG("CRC %s", valid_crc ? "OK" : "bad");
|
||||||
return valid_crc;
|
return valid_crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,11 +161,15 @@ params_ans check_meteo_params(){
|
|||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = 1500; // 1.5ms pause
|
timeout.tv_usec = 1500; // 1.5ms pause
|
||||||
|
|
||||||
if((res = select(portfd + 1, &set, NULL, NULL, &timeout)) < 0 && errno != EINTR)
|
if((res = select(portfd + 1, &set, NULL, NULL, &timeout)) < 0 && errno != EINTR){
|
||||||
|
WARN("lost connection (select)");
|
||||||
return ANS_LOSTCONN;
|
return ANS_LOSTCONN;
|
||||||
|
}
|
||||||
if(res > 0){
|
if(res > 0){
|
||||||
if ((n_bytes = read(portfd, buffer + size, MODBUS_MAX_PACKET_SIZE - size)) < 0)
|
if ((n_bytes = read(portfd, buffer + size, MODBUS_MAX_PACKET_SIZE - size)) < 0){
|
||||||
|
WARN("lost connection (read)");
|
||||||
return ANS_LOSTCONN;
|
return ANS_LOSTCONN;
|
||||||
|
}
|
||||||
size += n_bytes;
|
size += n_bytes;
|
||||||
if(n_bytes) continue;
|
if(n_bytes) continue;
|
||||||
}
|
}
|
||||||
@ -176,9 +186,9 @@ params_ans check_meteo_params(){
|
|||||||
DBG("wind speed");
|
DBG("wind speed");
|
||||||
meteoflags |= WSFLAG;
|
meteoflags |= WSFLAG;
|
||||||
if(gotsegm && !(MeteoMode & INPUT_WND)){ // not entered by hands
|
if(gotsegm && !(MeteoMode & INPUT_WND)){ // not entered by hands
|
||||||
DBG("oldvnd");
|
|
||||||
val_Wnd = f;
|
val_Wnd = f;
|
||||||
MeteoMode |= (SENSOR_WND|NET_WND);
|
MeteoMode &= ~NET_WND;
|
||||||
|
MeteoMode |= SENSOR_WND;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REG_WDIR:
|
case REG_WDIR:
|
||||||
@ -190,7 +200,8 @@ params_ans check_meteo_params(){
|
|||||||
meteoflags |= TFLAG;
|
meteoflags |= TFLAG;
|
||||||
if(gotsegm && !(MeteoMode & INPUT_T1)){
|
if(gotsegm && !(MeteoMode & INPUT_T1)){
|
||||||
val_T1 = f;
|
val_T1 = f;
|
||||||
MeteoMode |= (SENSOR_WND|NET_WND);
|
MeteoMode &= ~NET_T1;
|
||||||
|
MeteoMode |= SENSOR_T1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REG_HUM:
|
case REG_HUM:
|
||||||
@ -198,7 +209,8 @@ params_ans check_meteo_params(){
|
|||||||
meteoflags |= HFLAG;
|
meteoflags |= HFLAG;
|
||||||
if(gotsegm && !(MeteoMode & INPUT_HMD)){
|
if(gotsegm && !(MeteoMode & INPUT_HMD)){
|
||||||
val_Hmd = f;
|
val_Hmd = f;
|
||||||
MeteoMode |= (SENSOR_HMD|NET_HMD);
|
MeteoMode &= ~NET_HMD;
|
||||||
|
MeteoMode |= SENSOR_HMD;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REG_DEW:
|
case REG_DEW:
|
||||||
@ -210,7 +222,8 @@ params_ans check_meteo_params(){
|
|||||||
meteoflags |= PFLAG;
|
meteoflags |= PFLAG;
|
||||||
if(gotsegm && !(MeteoMode & INPUT_B)){
|
if(gotsegm && !(MeteoMode & INPUT_B)){
|
||||||
val_B = f;
|
val_B = f;
|
||||||
MeteoMode |= (SENSOR_B|NET_B);
|
MeteoMode &= ~NET_B;
|
||||||
|
MeteoMode |= SENSOR_B;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.8.2, 2020-08-21T12:33:04. -->
|
<!-- Written by QtCreator 6.0.0, 2022-06-09T15:28:23. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
<value type="QByteArray">{7bd84e39-ca37-46d3-be9d-99ebea85bc0d}</value>
|
<value type="QByteArray">{cf63021e-ef53-49b0-b03b-2f2570cdf3b6}</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
@ -37,56 +37,63 @@
|
|||||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</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="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
|
||||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||||
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">2</value>
|
||||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanIndentation">false</value>
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</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>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
<valuemap type="QVariantMap" key="ClangTools">
|
||||||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
<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>
|
||||||
|
<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>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
<valuemap type="QVariantMap">
|
<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.DefaultDisplayName">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{65a14f9e-e008-4c1b-89df-4eaa4774b6e3}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{91347f2c-5221-46a7-80b1-0a054ca02f79}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Big/Data/00-BTAmirtemp</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/eddy/Docs/SAO/BTA/Meteostation_new/BTA_modbusmeteo</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||||
<value type="QString">all</value>
|
<value type="QString">all</value>
|
||||||
</valuelist>
|
</valuelist>
|
||||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
|
|
||||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
|
|
||||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
|
|
||||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
@ -94,24 +101,19 @@
|
|||||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||||
<value type="QString">clean</value>
|
<value type="QString">clean</value>
|
||||||
</valuelist>
|
</valuelist>
|
||||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
|
|
||||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
|
|
||||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
|
|
||||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</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"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">По умолчанию</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">По умолчанию</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">По умолчанию</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
@ -119,38 +121,26 @@
|
|||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Развёртывание</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Конфигурация установки</value>
|
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
|
||||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
|
||||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></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.CustomExecutableRunConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
@ -161,10 +151,10 @@
|
|||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
<value type="int">20</value>
|
<value type="int">22</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>Version</variable>
|
<variable>Version</variable>
|
||||||
<value type="int">20</value>
|
<value type="int">22</value>
|
||||||
</data>
|
</data>
|
||||||
</qtcreator>
|
</qtcreator>
|
||||||
|
|||||||
@ -28,29 +28,9 @@ int gotsegm = 0; // used also in bta_meteo_modbus.c
|
|||||||
static pid_t childpid = 0;
|
static pid_t childpid = 0;
|
||||||
|
|
||||||
void clear_flags(){
|
void clear_flags(){
|
||||||
WARNX("Clear flags");
|
|
||||||
LOG("Clear flags");
|
LOG("Clear flags");
|
||||||
if(!gotsegm) return;
|
if(!gotsegm) return;
|
||||||
if(MeteoMode & NET_HMD){ // humidity now isn't from net
|
MeteoMode &= ~(SENSOR_HMD | SENSOR_WND | SENSOR_B | SENSOR_T1);
|
||||||
MeteoMode &= ~NET_HMD;
|
|
||||||
if(MeteoMode & SENSOR_HMD)
|
|
||||||
MeteoMode &= ~SENSOR_HMD;
|
|
||||||
}
|
|
||||||
if(MeteoMode & NET_WND){ // wind
|
|
||||||
MeteoMode &= ~NET_WND;
|
|
||||||
if(MeteoMode & SENSOR_WND)
|
|
||||||
MeteoMode &= ~SENSOR_WND;
|
|
||||||
}
|
|
||||||
if(MeteoMode & NET_B){ // pressure
|
|
||||||
MeteoMode &= ~NET_B;
|
|
||||||
if(MeteoMode & SENSOR_B)
|
|
||||||
MeteoMode &= ~SENSOR_B;
|
|
||||||
}
|
|
||||||
if(MeteoMode & NET_T1){ // ext. temperature
|
|
||||||
MeteoMode &= ~NET_T1;
|
|
||||||
if(MeteoMode & SENSOR_T1)
|
|
||||||
MeteoMode &= ~SENSOR_T1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void signals(int sig){
|
void signals(int sig){
|
||||||
@ -69,8 +49,8 @@ void signals(int sig){
|
|||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
signal(SIGALRM, SIG_IGN);
|
signal(SIGALRM, SIG_IGN);
|
||||||
LOG("%s - Stop!", strsignal(sig));
|
|
||||||
if(childpid){ // master process
|
if(childpid){ // master process
|
||||||
|
LOG("%s - Stop!", strsignal(sig));
|
||||||
clear_flags();
|
clear_flags();
|
||||||
}
|
}
|
||||||
exit(sig);
|
exit(sig);
|
||||||
@ -104,7 +84,7 @@ int main(int argc, char *argv[]){
|
|||||||
LOG("create child with PID %d", childpid);
|
LOG("create child with PID %d", childpid);
|
||||||
wait(NULL);
|
wait(NULL);
|
||||||
LOG("child %d died\n", childpid);
|
LOG("child %d died\n", childpid);
|
||||||
sleep(1);
|
sleep(30);
|
||||||
}else{
|
}else{
|
||||||
prctl(PR_SET_PDEATHSIG, SIGTERM); // send SIGTERM to child when parent dies
|
prctl(PR_SET_PDEATHSIG, SIGTERM); // send SIGTERM to child when parent dies
|
||||||
break; // go out to normal functional
|
break; // go out to normal functional
|
||||||
@ -118,7 +98,6 @@ int main(int argc, char *argv[]){
|
|||||||
}
|
}
|
||||||
|
|
||||||
time_t tlast = time(NULL);
|
time_t tlast = time(NULL);
|
||||||
int errlogged = FALSE;
|
|
||||||
while(1){
|
while(1){
|
||||||
if(!gotsegm){
|
if(!gotsegm){
|
||||||
sdat.mode |= 0200;
|
sdat.mode |= 0200;
|
||||||
@ -126,15 +105,13 @@ int main(int argc, char *argv[]){
|
|||||||
gotsegm = get_shm_block(&sdat, ClientSide);
|
gotsegm = get_shm_block(&sdat, ClientSide);
|
||||||
if(!gotsegm){
|
if(!gotsegm){
|
||||||
LOG("Can't find SHM segment");
|
LOG("Can't find SHM segment");
|
||||||
|
signals(SIGTERM);
|
||||||
}else get_cmd_queue(&ocmd, ClientSide);
|
}else get_cmd_queue(&ocmd, ClientSide);
|
||||||
}
|
}
|
||||||
if(time(NULL) - tlast > 60){ // no signal for 5 minutes - clear flags
|
if(time(NULL) - tlast > 60){ // no signal for 5 minutes - clear flags
|
||||||
if(!errlogged){
|
LOG("1 minute - no signal!");
|
||||||
LOG("5 minutes - no signal!");
|
|
||||||
errlogged = TRUE;
|
|
||||||
}
|
|
||||||
tlast = time(NULL);
|
|
||||||
clear_flags(); // return to Z1000 meteo
|
clear_flags(); // return to Z1000 meteo
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
params_ans a = check_meteo_params();
|
params_ans a = check_meteo_params();
|
||||||
if(a == ANS_LOSTCONN){
|
if(a == ANS_LOSTCONN){
|
||||||
@ -142,7 +119,6 @@ int main(int argc, char *argv[]){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(a == ANS_OK){
|
if(a == ANS_OK){
|
||||||
errlogged = FALSE;
|
|
||||||
tlast = time(NULL);
|
tlast = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ const double zeroV = 1.0;
|
|||||||
const double scaleT = 50.0/(5.-1.); /* New: 1:5V -> -20:+30dgr */
|
const double scaleT = 50.0/(5.-1.); /* New: 1:5V -> -20:+30dgr */
|
||||||
const double zeroT2 = -19.1; /* -20.0 + 0.9 Tind (16.11.2012)*/
|
const double zeroT2 = -19.1; /* -20.0 + 0.9 Tind (16.11.2012)*/
|
||||||
|
|
||||||
|
#define RK_Precipitations 0x000008 /*Din RK: датчик появления осадков (на метеомачте) */
|
||||||
|
|
||||||
static int stop_prog = 0;
|
static int stop_prog = 0;
|
||||||
static char *myname;
|
static char *myname;
|
||||||
|
|
||||||
@ -301,6 +303,33 @@ int main (int argc, char *argv[])
|
|||||||
ctm=0;
|
ctm=0;
|
||||||
}
|
}
|
||||||
tlast=t;
|
tlast=t;
|
||||||
|
}else if(idr==0x21){ /* принят код RK от PEP-контроллера */
|
||||||
|
static double off_time = 0.;
|
||||||
|
static double last_msg_time = 0.;
|
||||||
|
static char msg[30] = " Туман или осадки.";
|
||||||
|
static int o_rcode = 0;
|
||||||
|
rcode = ((unsigned int)rdata[0]<<16)|((unsigned int)rdata[1]<<8)|rdata[2];
|
||||||
|
if(rcode & RK_Precipitations){
|
||||||
|
if(o_rcode & RK_Precipitations){ // датчик осадков имени Данилова на метео-мачте
|
||||||
|
if(fabs(M_time-Precip_time>60.)){ // датчик осадков включен 2 считывания подряд
|
||||||
|
if(Tel_State!=Stopping && Dome_State!=D_Off && fabs(M_time-last_msg_time>30.)){ // реагировать на него не чаще раза в минуту
|
||||||
|
*msg = MesgFault; // выдать сообщение если идут реальные наблюдения
|
||||||
|
SendMessage(msg);
|
||||||
|
last_msg_time = M_time;
|
||||||
|
}
|
||||||
|
if(fabs(M_time-off_time)>3.){ // постоянно включен минимум 3сек
|
||||||
|
Precip_time = M_time; /* информировать другие программы */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{ // датчик осадков только что включился
|
||||||
|
if(fabs(M_time-last_msg_time>600.)){ // выдавать сообщение раз в 10 мин
|
||||||
|
*msg = MesgWarn;
|
||||||
|
SendMessage(msg);
|
||||||
|
last_msg_time = M_time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else off_time = M_time;
|
||||||
|
o_rcode = rcode;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user