<commit_before>#include "MotorDetailsMessage.h"
#include "MessageDecodingHelpers.h"
#include "MessageDefines.h"

#include <QDebug>

using namespace MessageDecodingHelpers;

namespace
{
    const int PHASE_CCURRENT = 1;
    const int PHASE_BCURRENT = 5;
    const int MOTOR_VOLTAGE_REAL = 9;
    const int MOTOR_VOLTAGE_IMAGINARY = 13;
    const int MOTOR_CURRENT_REAL = 17;
    const int MOTOR_CURRENT_IMAGINARY = 21;
    const int BACK_EMF_REAL = 25;
    const int BACK_EMF_IMAGINARY = 29;
    const int VOLTAGE_RAIL_SUPPPLY_15_V = 33;
    const int VOLTAGE_RAIL_SUPPLY_33_V = 37;
    const int VOLTAGE_RAIL_SUPPLY_19_V = 41;
    const int HEAT_SINK_TEMPERATURE = 45;
    const int MOTOR_TEMPTERATURE = 49;
    const int DSP_BOARD_TEMPERATURE = 53;
    const int DC_BUS_AMP_HOURS = 57;
    const int ODOMETER = 61;
    const int SLIP_SPEED = 65;
}

MotorDetailsMessage::MotorDetailsMessage(const QByteArray& messageData, unsigned char motorNumber)
: messageData_(messageData)
, motorNumber_(motorNumber)
{
}

float MotorDetailsMessage::phaseCCurrent() const
{
    return getFloat(messageData_, PHASE_CCURRENT);
}

float MotorDetailsMessage::phaseBCurrent() const
{
    return getFloat(messageData_, PHASE_BCURRENT);
}

float MotorDetailsMessage::motorVoltageReal() const
{
    return getFloat(messageData_, MOTOR_VOLTAGE_REAL);
}

float MotorDetailsMessage::motorVoltageImaginary() const
{
    return getFloat(messageData_, MOTOR_VOLTAGE_IMAGINARY);
}

float MotorDetailsMessage::motorCurrentReal() const
{
    return getFloat(messageData_, MOTOR_CURRENT_REAL);
}

float MotorDetailsMessage::motorCurrentImaginary() const
{
    return getFloat(messageData_, MOTOR_CURRENT_IMAGINARY);
}

float MotorDetailsMessage::backEmfReal() const
{
    return getFloat(messageData_, BACK_EMF_REAL);
}

float MotorDetailsMessage::backEmfImaginary() const
{
    return getFloat(messageData_, BACK_EMF_IMAGINARY);
}

float MotorDetailsMessage::voltageRailSuppply15V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPPLY_15_V);
}

float MotorDetailsMessage::voltageRailSupply33V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPLY_33_V);
}

float MotorDetailsMessage::voltageRailSupply19V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPLY_19_V);
}

float MotorDetailsMessage::heatSinkTemperature() const
{
    return getFloat(messageData_, HEAT_SINK_TEMPERATURE);
}

float MotorDetailsMessage::motorTempterature() const
{
    return getFloat(messageData_, MOTOR_TEMPTERATURE);
}

float MotorDetailsMessage::dspBoardTemperature() const
{
    return getFloat(messageData_, DSP_BOARD_TEMPERATURE);
}

float MotorDetailsMessage::dcBusAmpHours() const
{
    return getFloat(messageData_, DC_BUS_AMP_HOURS);
}

float MotorDetailsMessage::odometer() const
{
    return getFloat(messageData_, ODOMETER);
}

float MotorDetailsMessage::slipSpeed() const
{
    return getFloat(messageData_, SLIP_SPEED);
}

QString MotorDetailsMessage::toString() const
{
    QString messageString;
    if (motorNumber_ == 0x0) {
        messageString += QString::number(MessageDefines::Motor0Details) + ", ";
    }
    else {
        // For the sake of not halting programs execution, treat all other cases as motor one
        if (motorNumber != 0x1) {
            // Log that this was used incorrectly
            qDebug() << "Invalid motor number, defaulting to motor 1";
        }
        messageString += QString::number(MessageDefines::Motor1Details) + ", ";
    }
    messageString += QString::number(phaseCCurrent()) + ", "; 
    messageString += QString::number(phaseBCurrent()) + ", "; 
    messageString += QString::number(motorVoltageReal()) + ", "; 
    messageString += QString::number(motorVoltageImaginary()) + ", "; 
    messageString += QString::number(motorCurrentReal()) + ", "; 
    messageString += QString::number(motorCurrentImaginary()) + ", "; 
    messageString += QString::number(backEmfReal()) + ", "; 
    messageString += QString::number(backEmfImaginary()) + ", "; 
    messageString += QString::number(voltageRailSuppply15V()) + ", "; <commit_msg>Fixing  MotorDetailsMessage packageID<commit_after>#include "MotorDetailsMessage.h"
#include "MessageDecodingHelpers.h"
#include "MessageDefines.h"

#include <QDebug>

using namespace MessageDecodingHelpers;

namespace
{
    const int PHASE_CCURRENT = 1;
    const int PHASE_BCURRENT = 5;
    const int MOTOR_VOLTAGE_REAL = 9;
    const int MOTOR_VOLTAGE_IMAGINARY = 13;
    const int MOTOR_CURRENT_REAL = 17;
    const int MOTOR_CURRENT_IMAGINARY = 21;
    const int BACK_EMF_REAL = 25;
    const int BACK_EMF_IMAGINARY = 29;
    const int VOLTAGE_RAIL_SUPPPLY_15_V = 33;
    const int VOLTAGE_RAIL_SUPPLY_33_V = 37;
    const int VOLTAGE_RAIL_SUPPLY_19_V = 41;
    const int HEAT_SINK_TEMPERATURE = 45;
    const int MOTOR_TEMPTERATURE = 49;
    const int DSP_BOARD_TEMPERATURE = 53;
    const int DC_BUS_AMP_HOURS = 57;
    const int ODOMETER = 61;
    const int SLIP_SPEED = 65;
}

MotorDetailsMessage::MotorDetailsMessage(const QByteArray& messageData, unsigned char motorNumber)
: messageData_(messageData)
, motorNumber_(motorNumber)
{
}

float MotorDetailsMessage::phaseCCurrent() const
{
    return getFloat(messageData_, PHASE_CCURRENT);
}

float MotorDetailsMessage::phaseBCurrent() const
{
    return getFloat(messageData_, PHASE_BCURRENT);
}

float MotorDetailsMessage::motorVoltageReal() const
{
    return getFloat(messageData_, MOTOR_VOLTAGE_REAL);
}

float MotorDetailsMessage::motorVoltageImaginary() const
{
    return getFloat(messageData_, MOTOR_VOLTAGE_IMAGINARY);
}

float MotorDetailsMessage::motorCurrentReal() const
{
    return getFloat(messageData_, MOTOR_CURRENT_REAL);
}

float MotorDetailsMessage::motorCurrentImaginary() const
{
    return getFloat(messageData_, MOTOR_CURRENT_IMAGINARY);
}

float MotorDetailsMessage::backEmfReal() const
{
    return getFloat(messageData_, BACK_EMF_REAL);
}

float MotorDetailsMessage::backEmfImaginary() const
{
    return getFloat(messageData_, BACK_EMF_IMAGINARY);
}

float MotorDetailsMessage::voltageRailSuppply15V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPPLY_15_V);
}

float MotorDetailsMessage::voltageRailSupply33V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPLY_33_V);
}

float MotorDetailsMessage::voltageRailSupply19V() const
{
    return getFloat(messageData_, VOLTAGE_RAIL_SUPPLY_19_V);
}

float MotorDetailsMessage::heatSinkTemperature() const
{
    return getFloat(messageData_, HEAT_SINK_TEMPERATURE);
}

float MotorDetailsMessage::motorTempterature() const
{
    return getFloat(messageData_, MOTOR_TEMPTERATURE);
}

float MotorDetailsMessage::dspBoardTemperature() const
{
    return getFloat(messageData_, DSP_BOARD_TEMPERATURE);
}

float MotorDetailsMessage::dcBusAmpHours() const
{
    return getFloat(messageData_, DC_BUS_AMP_HOURS);
}

float MotorDetailsMessage::odometer() const
{
    return getFloat(messageData_, ODOMETER);
}

float MotorDetailsMessage::slipSpeed() const
{
    return getFloat(messageData_, SLIP_SPEED);
}

QString MotorDetailsMessage::toString() const
{
    QString messageString;
    if ((motorNumber & 0xe) != 0x0) {
        qDebug() << "Invalid motor number, unexpected behaviour likely";
    }
    messageString += QString::number(MessageDefines::Motor0Details + motorNumber_) + ", ";
    messageString += QString::number(phaseCCurrent()) + ", "; 
    messageString += QString::number(phaseBCurrent()) + ", "; 
    messageString += QString::number(motorVoltageReal()) + ", "; 
    messageString += QString::number(motorVoltageImaginary()) + ", "; 
    messageString += QString::number(motorCurrentReal()) + ", "; 
    messageString += QString::number(motorCurrentImaginary()) + ", "; 
    messageString += QString::number(backEmfReal()) + ", "; 
    messageString += QString::number(backEmfImaginary()) + ", "; 
    messageString += QString::number(voltageRailSuppply15V()) + ", "; 
{'fraction_non_alphanumeric': 0.1021879347413684, 'fraction_numerical': 0.014291134437839888, 'mean_word_length': 5.466067048242028, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5561950', 'n_tokens_mistral': 2723, 'n_tokens_neox': 2565, 'n_words': 482}