From cfbd9237b4bb3a74f150c0ac0658581271d4d9dc Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Fri, 11 Aug 2017 14:54:18 -0400 Subject: [PATCH] A bit more work on motor controller config window --- motorcontrollerconfigwindow.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/motorcontrollerconfigwindow.cpp b/motorcontrollerconfigwindow.cpp index a0a6567..fc50fce 100644 --- a/motorcontrollerconfigwindow.cpp +++ b/motorcontrollerconfigwindow.cpp @@ -200,11 +200,34 @@ void MotorControllerConfigWindow::timerTick() } else //save current value of all data items { - //qDebug() << "Transmission: " << QString::number(transmitStep); - switch (transmitStep) - { + uint16 thisValue; + qDebug() << "Transmission: " << QString::number(transmitStep); + QString cellVal = ui->tableParams->item(transmitStep, 1)->text(); + + if (params[transmitStep].paramType != HEX) + thisValue = (uint16_t)QString::number(cellVal); + else + thisValue = (uint16_t)Utility::ParseStringToNum(cellVal); + + if (thisValue != params[transmitStep].value) + { + outFrame.ID = 0xC1; + outFrame.len = 8; + outFrame.bus = 0; + outFrame.extended = false; + outFrame.data[0] = params[transmitStep].paramID & 0xFF; + outFrame.data[1] = (params[transmitStep].paramID >> 8) & 0xFF; + outFrame.data[2] = 1; //0 = read, 1 = write + outFrame.data[3] = 0; //reserved + outFrame.data[4] = params[transmitStep].value & 0xFF; + outFrame.data[5] = (params[transmitStep].value >> 8) & 0xFF; + outFrame.data[6] = 0; //reserved + outFrame.data[7] = 0; //reserved + + emit sendCANFrame(&outFrame, 0); } + transmitStep++; } }