version 5.2.1

fix potentially errors in PIConstChars compare methods
PIHIDevice::open() for open last device
PIVariant::toPoint() now can cast from PIMathVectord
This commit is contained in:
2025-09-13 17:25:12 +03:00
parent 3c72db2de8
commit dcdd7db33d
5 changed files with 33 additions and 10 deletions

View File

@@ -125,6 +125,11 @@ bool PIHIDevice::open(const PIHIDeviceInfo & device) {
}
bool PIHIDevice::open() {
return open(di);
}
void PIHIDevice::close() {
stop();
#ifndef WINDOWS
@@ -242,12 +247,13 @@ void PIHIDevice::run() {
if (ReadFile(PRIVATE->deviceHandle, PRIVATE->buffer.data(), PRIVATE->buffer.size_s(), &readed, nullptr) != TRUE) return;
// piCout << readed << PRIVATE->buffer.size();
if (readed != PRIVATE->buffer.size()) return;
auto gd = HidP_GetData(HidP_Input, gdd, &gdd_len, PRIVATE->preparsed, (PCHAR)PRIVATE->buffer.data(), PRIVATE->buffer.size_s());
auto gd = HidP_GetData(HidP_Input, gdd, &gdd_len, PRIVATE->preparsed, (PCHAR)PRIVATE->buffer.data(), PRIVATE->buffer.size_s());
NO_UNUSED(gd);
// piCout << "readed" << PRIVATE->buffer << gdd_len;
auto cbit = cur_buttons.makeIterator();
while (cbit.next())
cbit.value() = 0;
for (int i = 0; i < gdd_len; ++i) {
for (ULONG i = 0; i < gdd_len; ++i) {
const auto & cd(gdd[i]);
// piCout << cd.DataIndex << cd.RawValue;
auto vi = di.axis_by_dataindex.value(cd.DataIndex);
@@ -258,7 +264,7 @@ void PIHIDevice::run() {
e.value = static_cast<LONG>(cd.RawValue);
event(e);
} else {
auto & axis(cur_axes[cd.DataIndex]);
// auto & axis(cur_axes[cd.DataIndex]);
float fv = (cd.RawValue - vi.min) / piMaxf(1.f, (float)(vi.max - vi.min));
cur_axes[vi.data_index] = procDeadZone(fv);
}

View File

@@ -94,6 +94,7 @@ public:
bool isOpened() const;
bool open(const PIHIDeviceInfo & device);
bool open();
void close();
void start();
void stop();