vedderb / vesc_tool

The source code for VESC Tool. See vesc-project.com
GNU General Public License v3.0
723 stars 532 forks source link

Add getHardwareNow and getHardwareTypeNow #390

Closed cortex closed 2 weeks ago

cortex commented 3 weeks ago

This allows getting hardware name and type from QML

Example code:

import QtQuick 2.7
import QtQuick.Controls 2.0

import Vedder.vesc.vescinterface 1.0

Item {
    function testHw(){
       console.log( VescIf.getHardwareNow());
       console.log( VescIf.getHardwareTypeNow());
    }

    Button{
        text :"Test HW"
        onClicked: testHw()
    }
}
vedderb commented 3 weeks ago

This should be possible as it is now I think. Can you give this a try?

import QtQuick 2.15
import QtQuick.Controls 2.15

import Vedder.vesc.vescinterface 1.0

Item {
    function testHw(){
       var fw = VescIf.getLastFwRxParams()
       console.log(fw.hw)
       console.log(fw.hwTypeStr())
    }

    Button{
        text :"Test HW"
        onClicked: testHw()
    }
}
cortex commented 2 weeks ago

Those work just fine, didn't realize they existed , thanks @vedderb !