mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
maintenance: settings item refactoring, include dependencies fixes
This commit is contained in:
@@ -79,7 +79,7 @@ TMWDComm::~TMWDComm() // destruktor
|
||||
|
||||
bool TMWDComm::Open() // otwieranie portu COM
|
||||
{
|
||||
LPCSTR portId = Global::sMWDPortId.c_str();
|
||||
LPCSTR portId = Global.sMWDPortId.c_str();
|
||||
hComm = CreateFile(portId, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
@@ -99,7 +99,7 @@ bool TMWDComm::Open() // otwieranie portu COM
|
||||
CommDCB.DCBlength = sizeof(DCB);
|
||||
GetCommState(hComm, &CommDCB);
|
||||
|
||||
CommDCB.BaudRate = Global::iMWDBaudrate;
|
||||
CommDCB.BaudRate = Global.iMWDBaudrate;
|
||||
CommDCB.fBinary = TRUE;
|
||||
CommDCB.fParity = FALSE;
|
||||
CommDCB.fOutxCtsFlow = FALSE; // No CTS output flow control
|
||||
@@ -133,9 +133,9 @@ bool TMWDComm::Open() // otwieranie portu COM
|
||||
|
||||
bool TMWDComm::Close() // zamykanie portu COM
|
||||
{
|
||||
Global::bMWDmasterEnable = false; // główne włączenie portu!
|
||||
Global::bMWDInputEnable = false; // włącz wejścia
|
||||
Global::bMWDBreakEnable = false; // włącz wejścia analogowe
|
||||
Global.bMWDmasterEnable = false; // główne włączenie portu!
|
||||
Global.bMWDInputEnable = false; // włącz wejścia
|
||||
Global.bMWDBreakEnable = false; // włącz wejścia analogowe
|
||||
|
||||
WriteLog("COM Port is closing...");
|
||||
int i = 0;
|
||||
@@ -164,25 +164,25 @@ bool TMWDComm::ReadData() // odbieranie danych + odczyta danych analogowych i za
|
||||
{
|
||||
DWORD bytes_read;
|
||||
ReadFile(hComm, &ReadDataBuff[0], BYTETOREAD, &bytes_read, NULL);
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode == 128) WriteLog("Data receive. Checking data...");
|
||||
if (Global::bMWDBreakEnable)
|
||||
if (Global.bMWDdebugEnable && Global.iMWDDebugMode == 128) WriteLog("Data receive. Checking data...");
|
||||
if (Global.bMWDBreakEnable)
|
||||
{
|
||||
uiAnalog[0] = (ReadDataBuff[9] << 8) + ReadDataBuff[8];
|
||||
uiAnalog[1] = (ReadDataBuff[11] << 8) + ReadDataBuff[10];
|
||||
uiAnalog[2] = (ReadDataBuff[13] << 8) + ReadDataBuff[12];
|
||||
uiAnalog[3] = (ReadDataBuff[15] << 8) + ReadDataBuff[14];
|
||||
if (Global::bMWDdebugEnable && (Global::iMWDDebugMode & 1))
|
||||
if (Global.bMWDdebugEnable && (Global.iMWDDebugMode & 1))
|
||||
{
|
||||
WriteLog("Main Break = " + to_string(uiAnalog[0]));
|
||||
WriteLog("Locomotiv Break = " + to_string(uiAnalog[1]));
|
||||
}
|
||||
if (Global::bMWDdebugEnable && (Global::iMWDDebugMode & 2))
|
||||
if (Global.bMWDdebugEnable && (Global.iMWDDebugMode & 2))
|
||||
{
|
||||
WriteLog("Analog input 1 = " + to_string(uiAnalog[2]));
|
||||
WriteLog("Analog imput 2 = " + to_string(uiAnalog[3]));
|
||||
}
|
||||
}
|
||||
if (Global::bMWDInputEnable) CheckData();
|
||||
if (Global.bMWDInputEnable) CheckData();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -200,14 +200,14 @@ bool TMWDComm::Run() // wywoływanie obsługi MWD + generacja większego opóźn
|
||||
if (GetMWDState())
|
||||
{
|
||||
MWDTime++;
|
||||
if (!(MWDTime % Global::iMWDdivider))
|
||||
if (!(MWDTime % Global.iMWDdivider))
|
||||
{
|
||||
MWDTime = 0;
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode == 128) WriteLog("Sending data...");
|
||||
if (Global.bMWDdebugEnable && Global.iMWDDebugMode == 128) WriteLog("Sending data...");
|
||||
SendData();
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode == 128) WriteLog(" complet!\nReceiving data...");
|
||||
if (Global.bMWDdebugEnable && Global.iMWDDebugMode == 128) WriteLog(" complet!\nReceiving data...");
|
||||
ReadData();
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode == 128) WriteLog(" complet!");
|
||||
if (Global.bMWDdebugEnable && Global.iMWDDebugMode == 128) WriteLog(" complet!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "stdafx.h"
|
||||
#include "PoKeys55.h"
|
||||
#include <setupapi.h>
|
||||
#include "mczapkie/mctools.h"
|
||||
#include "utilities.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// HIDscaner: http://forum.simflight.com/topic/68257-latest-lua-package-for-fsuipc-and-wideclient/
|
||||
//#define MY_DEVICE_ID "Vid_04d8&Pid_003F"
|
||||
|
||||
Reference in New Issue
Block a user