mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
1. Dodanie możliwości definicji kalibracji wyjść i wejść PWM jako funkcja piątego stopnia
2. Do użycia są dwa nowe słowa kluczowe w ini: calibrate5din, calibrate5dout oba z 6 parametrami 3. Przerzucenie calibracji wejść do Console z Train 4. Dodanie funkcji obcinającej zmienną do podanego zakresu
This commit is contained in:
23
Console.cpp
23
Console.cpp
@@ -197,7 +197,8 @@ void Console::BitsSet(int mask, int entry)
|
||||
int old = iBits; // poprzednie stany
|
||||
iBits |= mask;
|
||||
BitsUpdate(old ^ iBits); // 1 dla bitów zmienionych
|
||||
WriteLog("PoKeys::BitsSet: mask: " + AnsiString(mask) + " iBits: " + AnsiString(iBits));
|
||||
if (iMode == 4)
|
||||
WriteLog("PoKeys::BitsSet: mask: " + AnsiString(mask) + " iBits: " + AnsiString(iBits));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -288,10 +289,10 @@ void Console::ValueSet(int x, double y)
|
||||
if (PoKeys55[0])
|
||||
{
|
||||
PoKeys55[0]->PWM(
|
||||
x, (((Global::fCalibrateOut[x][3] * y) + Global::fCalibrateOut[x][2]) * y +
|
||||
Global::fCalibrateOut[x][1]) *
|
||||
y +
|
||||
Global::fCalibrateOut[x][0]); // zakres <0;1>
|
||||
x, (((((Global::fCalibrateOut[x][5] * y) + Global::fCalibrateOut[x][4]) * y +
|
||||
Global::fCalibrateOut[x][3]) * y + Global::fCalibrateOut[x][2]) * y +
|
||||
Global::fCalibrateOut[x][1]) * y +
|
||||
Global::fCalibrateOut[x][0]); // zakres <0;1>
|
||||
}
|
||||
};
|
||||
|
||||
@@ -320,6 +321,18 @@ float Console::AnalogGet(int x)
|
||||
return -1.0;
|
||||
};
|
||||
|
||||
float Console::AnalogCalibrateGet(int x)
|
||||
{ // pobranie i kalibracja wartości analogowej, jeśli nie ma PoKeys zwraca NULL
|
||||
if (iMode == 4 && PoKeys55[0])
|
||||
{
|
||||
float b = PoKeys55[0]->fAnalog[x];
|
||||
return (((((Global::fCalibrateIn[x][5] * b) + Global::fCalibrateIn[x][4]) * b +
|
||||
Global::fCalibrateIn[x][3]) * b + Global::fCalibrateIn[x][2]) * b +
|
||||
Global::fCalibrateIn[x][1]) *b + Global::fCalibrateIn[x][0];
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
unsigned char Console::DigitalGet(int x)
|
||||
{ // pobranie wartości cyfrowej
|
||||
if (iMode == 4)
|
||||
|
||||
Reference in New Issue
Block a user