From 9792239688042eb18339af1806b92e4df9a58097 Mon Sep 17 00:00:00 2001 From: Michael Carpenter Date: Wed, 1 Jan 2014 22:06:03 -0500 Subject: [PATCH] General engine variable config and actual decoder offset config now in QML wizards --- core/core.pro | 4 +- core/menuconfig.json | 54 ++++ core/src/mainwindow.cpp | 2 +- core/wizards/ActualDecoderOffset.qml | 220 +++++++++++++++ core/wizards/EngineConfig.qml | 405 +++++++++++++++++++++++++++ plugins/freeems/feconfigdata.cpp | 2 +- 6 files changed, 684 insertions(+), 3 deletions(-) create mode 100644 core/wizards/ActualDecoderOffset.qml create mode 100644 core/wizards/EngineConfig.qml diff --git a/core/core.pro b/core/core.pro index 32b5efe..980370e 100644 --- a/core/core.pro +++ b/core/core.pro @@ -184,4 +184,6 @@ OTHER_FILES += \ README.md \ wizards/BenchTest.qml \ wizards/DecoderOffset.qml \ - wizards/wizard.qml + wizards/wizard.qml \ + wizards/EngineConfig.qml \ + wizards/ActualDecoderOffset.qml diff --git a/core/menuconfig.json b/core/menuconfig.json index 1e55d82..bf1c3c6 100644 --- a/core/menuconfig.json +++ b/core/menuconfig.json @@ -85,6 +85,60 @@ "offset" : "99", "calc" : [ ], "locationid" : "0xC003" + }, + { + "name" : "perCylinderVolume", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "0", + "calc" : [ { "type":"div","value":"65536.0"},{"type":"mult","value":"2000.0"} ], + "locationid" : "0xC000" + }, + { + "name" : "injectorFlow", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "2", + "calc" : [ { "type":"div","value":"65536.0"},{"type":"mult","value":"3840"} ], + "locationid" : "0xC000" + }, + { + "name" : "InjectionRPMDisableThreshold", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "0", + "calc" : [ { "type":"div","value":"2.0"} ], + "locationid" : "0xC004" + }, + { + "name" : "InjectionRPMEnableThreshold", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "2", + "calc" : [ { "type":"div","value":"2.0"} ], + "locationid" : "0xC004" + }, + { + "name" : "IgnitionRPMDisableThreshold", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "4", + "calc" : [ { "type":"div","value":"2.0"} ], + "locationid" : "0xC004" + }, + { + "name" : "IgnitionRPMEnableThreshold", + "type" : "value", + "sizeofelement":"2", + "size" : "1", + "offset" : "6", + "calc" : [ { "type":"div","value":"2.0"} ], + "locationid" : "0xC004" } ] } diff --git a/core/src/mainwindow.cpp b/core/src/mainwindow.cpp index 40d236e..fb91bbf 100644 --- a/core/src/mainwindow.cpp +++ b/core/src/mainwindow.cpp @@ -1233,7 +1233,7 @@ void MainWindow::loadWizards(QString dir) } view->setFile(emsComms,wizards.absoluteFilePath(file)); view->passConfig(m_memoryMetaData->configMetaData()); - view->setGeometry(0,0,800,600); + //view->setGeometry(0,0,800,600); QAction *action = new QAction(this); action->setText(file.mid(0,file.lastIndexOf("."))); action->setCheckable(true); diff --git a/core/wizards/ActualDecoderOffset.qml b/core/wizards/ActualDecoderOffset.qml new file mode 100644 index 0000000..78d3680 --- /dev/null +++ b/core/wizards/ActualDecoderOffset.qml @@ -0,0 +1,220 @@ +// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import QtQuick 1.1 + +Rectangle { + width: 840 + height: 800 + color: "#D4D0C8" + Component.onCompleted: { + decoder.payloadDecoded.connect(decode); + decoderEngineOffset.update.connect(offsetupdate); + } + function decode(map) { + //advancetext.text = map["Advance"].toFixed(2); + advancetext.text = "62.21"; + } + function offsetupdate() { + offsettext.text = decoderEngineOffset.value().toFixed(2); + } + Rectangle { + x:200 + y:0 + width:440 + height:200 + color:"black" + Text { + id: advancetext + anchors.fill: parent + clip: true + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignTop + color:"white" + font.pixelSize: 150 + text: "" + } + Text { + x:0 + y:180 + width:400 + height:20 + horizontalAlignment: Text.AlignHCenter + color:"white" + text: "Ignition Advance (degrees)" + } + } + + + Rectangle { + x:200 + y:205 + width:440 + height:200 + color:"black" + Text { + id: offsettext + anchors.fill: parent + clip: true + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignTop + color:"white" + font.pixelSize: 100 + text: "" + } + Text { + x:0 + y:180 + width:440 + height:20 + horizontalAlignment: Text.AlignHCenter + color:"white" + text: "Current Offset (degrees)" + } + } + Rectangle { + x:0 + y:205 + width:100 + height:200 + color:"black" + Rectangle { + x:2 + y:2 + width:96 + height:196 + color:"Red" + Text { + color:"black" + anchors.fill: parent + font.pixelSize: 50 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "-10" + MouseArea { + anchors.fill: parent + onClicked: { + decoderEngineOffset.setValue((parseFloat(offsettext.text) - 10.0)); + } + } + } + } + } + Rectangle { + x:100 + y:205 + width:100 + height:200 + color:"black" + Rectangle { + x:2 + y:2 + width:96 + height:196 + color:"Red" + Text { + color:"black" + anchors.fill: parent + font.pixelSize: 50 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "-1" + MouseArea { + anchors.fill: parent + onClicked: { + decoderEngineOffset.setValue((parseFloat(offsettext.text) - 1.0)); + } + } + } + } + } + + + Rectangle { + x:740 + y:205 + width:100 + height:200 + color:"black" + Rectangle { + x:2 + y:2 + width:96 + height:196 + color:"green" + Text { + color:"black" + anchors.fill: parent + font.pixelSize: 50 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "+10" + MouseArea { + anchors.fill: parent + onClicked: { + decoderEngineOffset.setValue((parseFloat(offsettext.text) + 10.0)); + } + } + } + } + } + Rectangle { + x:640 + y:205 + width:100 + height:200 + color:"black" + Rectangle { + x:2 + y:2 + width:96 + height:196 + color:"green" + Text { + color:"black" + anchors.fill: parent + font.pixelSize: 50 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "+1" + MouseArea { + anchors.fill: parent + onClicked: { + decoderEngineOffset.setValue((parseFloat(offsettext.text) + 1.0)); + } + } + } + } + } + Rectangle { + x:0 + y:400 + width:840 + height:400 + color:"black" + Rectangle { + x:1 + y:1 + width: 838 + height:398 + color: "#D4D0C8" + Text { + color:"black" + anchors.fill: parent + font.pixelSize: 20 + wrapMode: Text.Wrap + + text: "With FreeEMS to make the timing more advanced you increase the offset and to make it more retarded you decrease it.\n\ +The offset must be less than the decoder total angle (360 for a crank mounted missing tooth setup), you will get no outputs if it is larger.\n\ +If the position that you know is really zero is 60 degrees away from the position of the first tooth post the gap, then your offset is one of two\ +values:\n\ +60 or 300 (360 - 60)\n\ +This depends upon whether it is before or after.\n\ + +Make the offset number larger to advance the base timing, make it smaller to retard the base timing. For example, if you have 10* BTDC in your\ + table, flat, and a timing light shows 5btdc on the engine, then increase this number by 5 degrees. The same applies statically, except you have\ + to think more.This is where some descriptive text goes, on how to configure this screen." + } + + } + + } +} diff --git a/core/wizards/EngineConfig.qml b/core/wizards/EngineConfig.qml new file mode 100644 index 0000000..1ef1ec4 --- /dev/null +++ b/core/wizards/EngineConfig.qml @@ -0,0 +1,405 @@ +// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import QtQuick 1.1 + +Item { + Rectangle { + x:0 + y:0 + width: 600 + height: 400 + color: "grey" + Text { + x:10 + y:130 + width:200 + color: "white" + text: "Volume per cylinder (In CCs):" + horizontalAlignment: Text.AlignRight + } + TextEdit { + id: configcylindervolume + x:220 + y:130 + width:100 + color: "white" + text: "Test" + } + Text { + x:10 + y:150 + width:200 + horizontalAlignment: Text.AlignRight + color: "white" + text: "Injector size (In CC/Minute):" + } + TextEdit { + id: configinjectorsize + x:220 + y:150 + width:100 + color: "white" + } + Text { + x:10 + y:170 + width:200 + horizontalAlignment: Text.AlignRight + color: "white" + text: "RPM Fuel Cutoff:" + } + TextEdit { + id: configrpmfuelcutoff + x:220 + y:170 + width:100 + color: "white" + } + Text { + x:10 + y:190 + width:200 + horizontalAlignment: Text.AlignRight + color: "white" + text: "RPM Fuel Reenable:" + } + TextEdit { + id: configrpmfuelreenable + x:220 + y:190 + width:100 + color: "white" + } + Text { + x:10 + y:210 + width:200 + horizontalAlignment: Text.AlignRight + color: "white" + text: "RPM Ignition Cutoff:" + } + TextEdit { + id: configrpmtimingcutoff + x:220 + y:210 + width:100 + color: "white" + } + Text { + x:10 + y:230 + width:200 + horizontalAlignment: Text.AlignRight + color: "white" + text: "RPM Ignition Reenable:" + } + TextEdit { + id: configrpmtimingreenable + x:220 + y:230 + width:100 + color: "white" + } + Text { + x:340 + y:130 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "MAP Minimum:" + } + TextEdit { + id: configmapminimum + x:500 + y:130 + width:100 + color: "white" + text: "testtext" + } + Text { + x:340 + y:150 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "MAP Range:" + } + TextEdit { + id: configmaprange + x:500 + y:150 + width:100 + color: "white" + } + + + + + + Text { + x:340 + y:170 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "AAP Minimum:" + } + TextEdit { + id: configaapminimum + x:500 + y:170 + width:100 + color: "white" + } + + + Text { + x:340 + y:190 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "AAP Range:" + } + TextEdit { + id: configaaprange + x:500 + y:190 + width:100 + color: "white" + } + + + Text { + x:340 + y:210 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "EGO Minimum:" + } + TextEdit { + id: configegominimum + x:500 + y:210 + width:100 + color: "white" + } + + + Text { + x:340 + y:230 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "EGO Range:" + } + TextEdit { + id: configegorange + x:500 + y:230 + width:100 + color: "white" + } + + Text { + x:340 + y:250 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "BRV Minimum:" + } + TextEdit { + id: configbrvminimum + x:500 + y:250 + width:100 + color: "white" + } + + + Text { + x:340 + y:270 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "BRV Range:" + } + TextEdit { + id: configbrvrange + x:500 + y:270 + width:100 + color: "white" + } + + + Text { + x:340 + y:290 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "TPS Minimum ADC:" + } + TextEdit { + id: configtpsminimum + x:500 + y:290 + width:100 + color: "white" + } + + + Text { + x:340 + y:310 + width:150 + horizontalAlignment: Text.AlignRight + color: "white" + text: "TPS Maximum ADC:" + } + TextEdit { + id: configtpsrange + x:500 + y:310 + width:100 + color: "white" + } + + + Rectangle { + x: 10 + y: 10 + radius:5 + width:380 + height:120 + color: "white" + Rectangle { + x:5 + y:5 + width:370 + height:110 + radius:5 + color: "grey" + Text { + x:5 + y:5 + width:360 + height:100 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "These are the scheduler settings for your engine. Current values are displayed, enter new values and then click Write Values to save them to flash." + } + } + } + + Rectangle { + x:10 + y:310 + width:200 + height:30 + radius:5 + color:"white" + Rectangle { + x:5 + y:5 + width:190 + height:20 + radius:5 + color: "blue" + Text { + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "Write Values" + MouseArea { + anchors.fill: parent + onClicked: { + console.log("Capture Clicked"); + numberOfConfiguredOutputEvents.setValue(configoutputeventstext.text); + numberOfInjectionsPerEngineCycle.setValue(configinjectionspercycle.text); + decoderEngineOffset.setValue(tpstext.text); + var retval = new Array(); + var split = configanglesoftdc.text.split(","); + for (var i = 0; i < numberOfConfiguredOutputEvents.value(); i++) { + retval[i] = parseFloat(split[i]); + } + anglesOfTDC.setValue(retval); + + var retval1 = new Array(); + var split1 = configoutputpinnumbers.text.split(","); + for (var i = 0; i < numberOfConfiguredOutputEvents.value(); i++) { + retval1[i] = parseFloat(split1[i]); + } + outputEventPinNumbers.setValue(retval1); + + var retval2 = new Array(); + var split2 = configschedulingbits.text.split(","); + for (var i = 0; i < numberOfConfiguredOutputEvents.value(); i++) { + retval2[i] = parseFloat(split2[i]); + } + schedulingConfigurationBits.setValue(retval2); + } + } + } + } + } + Component.onCompleted: { + //decoder.payloadDecoded.connect(decode); + //decoderEngineOffset.update.connect(offsetupdate); + //numberOfConfiguredOutputEvents.update.connect(outputeventupdate); + //numberOfInjectionsPerEngineCycle.update.connect(injectionspercycleupdate); + //anglesOfTDC.update.connect(anglesoftdcupdate); + //outputEventPinNumbers.update.connect(outputeventpinsupdate); + //schedulingConfigurationBits.update.connect(configschedulingbitsupdate); + + + //anglesoftdcupdate(); + configcylindervolume.text = perCylinderVolume.value(); + configinjectorsize.text = injectorFlow.value(); + configrpmfuelcutoff.text = InjectionRPMDisableThreshold.value(); + configrpmfuelreenable.text = InjectionRPMEnableThreshold.value(); + + perCylinderVolume.update.connect(percylindervolumeupdate); + injectorFlow.update.connect(injectorflowupdate); + InjectionRPMDisableThreshold.update.connect(injectionrpmdisableupdate); + InjectionRPMEnableThreshold.update.connect(injectionrpmreenableupdate); + + //tpstext.text = decoderEngineOffset.value(); + //configoutputeventstext.text = numberOfConfiguredOutputEvents.value(); + //configinjectionspercycle.text = numberOfInjectionsPerEngineCycle.value(); + + } + function percylindervolumeupdate() { + configcylindervolume.text = perCylinderVolume.value(); + } + function injectorflowupdate() { + configinjectorsize.text = injectorFlow.value(); + } + function injectionrpmdisableupdate() { + configrpmfuelcutoff.text = InjectionRPMDisableThreshold.value(); + } + function injectionrpmreenableupdate() { + configrpmfuelreenable.text = InjectionRPMEnableThreshold.value(); + } + + function offsetupdate() { + console.log("Offset update"); + //tpstext.text = decoderEngineOffset.value(); + } + function outputeventupdate() { + //configoutputeventstext.text = numberOfConfiguredOutputEvents.value(); + } + function injectionspercycleupdate() { + //configinjectionspercycle.text = numberOfInjectionsPerEngineCycle.value(); + } + function decode(map){ + //console.log("Decoded"); + // tpstext.text = map["TPS"]; + } + } +} diff --git a/plugins/freeems/feconfigdata.cpp b/plugins/freeems/feconfigdata.cpp index 43538bc..2ecaa37 100644 --- a/plugins/freeems/feconfigdata.cpp +++ b/plugins/freeems/feconfigdata.cpp @@ -20,7 +20,7 @@ FEConfigData::FEConfigData(QString name,QString type, QString override,unsigned } QVariant FEConfigData::value() { - QLOG_DEBUG() << "value requested for" << m_name << ":" << m_value; + //QLOG_DEBUG() << "value requested for" << m_name << ":" << m_value; return m_value; } void FEConfigData::setValue(QVariant value)