Added some Motor tags, changed back to some qt 6.0 methods.

This commit is contained in:
2025-12-30 20:43:36 +01:00
parent fbeb4fb3c0
commit 100014c00d
6 changed files with 68 additions and 53 deletions

View File

@@ -53,6 +53,51 @@ QString BCValueType::formatValue( uint32_t value ) const
double result = value * factor;
return QString::number(result, 'f', 2);
}
/*
_dataTypes.insert( "Float", new Fitz{{ "", 1.5625F}} );
_dataTypes.insert( "Percent",new Fatz{{ "%", 1.5625 }} );
_dataTypes.insert( "KWh", new Fatz{{ "kwh", 1.5625 }} );
_dataTypes.insert( "Watt", new Long{{ "w", 1.5625 }} );
_dataTypes.insert( "Km", new BCValueTypeWord{{ "km", 1.5625 }} );
_dataTypes.insert( "Kmh", new BCValueTypeWord{{ "km/h", 0.1 }} );
_dataTypes.insert( "Mm", new BCValueTypeWord{{ "mm", 1.5625 }} );
_dataTypes.insert( "Sec", new BCValueTypeWord{{ "s", 1.5625 }} );
_dataTypes.insert( "SoC", new Long{{ "%", 1.5625 }} );
_dataTypes.insert( "Odo", new Fitz{{ "km", 1.5625 }} );
_dataTypes.insert( "Assist", new Fatz{{ "", 0 ,4 }} );
_dataTypes.insert( "Assist", new Fatz{{ "%" }} );
//_dataTypes.insert( "Date", { BCValueType::TypeID::Date } );
*/
std::optional<BCValueType*> BCValueType::fetchValueType( const QString& unitTypeKey )
{
static QHash<QString,BCValueType*> s_bcDataTypes
{
{ "Byte", new BCValueTypeWord( "", 1.5625F) },
{ "Word", new BCValueTypeWord( "", 1.5625F) },
{ "Float", new BCValueTypeWord( "", 1.5625F) },
{ "Percent",new BCValueTypeWord( "%", 1.5625 ) },
{ "KWh", new BCValueTypeWord( "kwh", 1.5625 ) },
{ "Watt", new BCValueTypeWord( "w", 1.5625 ) },
{ "Km", new BCValueTypeWord( "km", 1.5625 ) },
{ "Kmh", new BCValueTypeWord( "km/h", 0.1 ) },
{ "Mm", new BCValueTypeWord( "mm", 1.5625 ) },
{ "Sec", new BCValueTypeWord( "s", 1.5625 ) },
{ "Degree", new BCValueTypeByte( "°C", 1.0 ) },
{ "SoC", new BCValueTypeWord( "%", 1.5625 ) },
{ "Odo", new BCValueTypeWord( "km", 1.5625 ) },
{ "Assist", new BCValueTypeWord( "", 0 ,4 ) },
{ "Assist", new BCValueTypeWord( "%" ) },
};
if( !s_bcDataTypes.contains( unitTypeKey ) )
return std::nullopt;
return s_bcDataTypes[unitTypeKey];
}
/// ----
BCValueTypeByte::BCValueTypeByte( QString unitLabel_, double factor_, optDouble min_, optDouble max_ )