Mercurial > public > ostc_companion
changeset 11:6fba58c4964b
Minor changes done by automatic style checker
| author | Ideenmodellierer |
|---|---|
| date | Mon, 12 Jan 2026 13:57:24 +0000 |
| parents | 9a3c1a6f9833 |
| children | ac837fe1d590 |
| files | HardwareOperations.h OSTC4Operations.h crc_wrapper.cpp crc_wrapper.h crcmodel.h ostc45_icon.cpp ostc45_icon.h |
| diffstat | 7 files changed, 148 insertions(+), 181 deletions(-) [+] |
line wrap: on
line diff
--- a/HardwareOperations.h Mon Jan 12 13:55:38 2026 +0000 +++ b/HardwareOperations.h Mon Jan 12 13:57:24 2026 +0000 @@ -45,15 +45,15 @@ #include <QDateTime> #include <QImage> +#include <QRegularExpression> +#include <QSize> #include <QString> #include <QStringList> -#include <QSize> -#include <QRegularExpression> #ifdef TEST_MODE -# include "test/SerialTest.h" +#include "test/SerialTest.h" #else -# include "Serial.h" +#include "Serial.h" #endif class HexFile; @@ -75,13 +75,13 @@ protected: #ifdef TEST_MODE /// \brief Fake communication port used for mockup operations. - SerialTest _serial; + SerialTest _serial; #else /// \brief Communication port used for all I/O operations. /// /// Note that in *emulation mode*, aka TEST_MODE, this is replaced by /// an instance of SerialTest. - Serial _serial; + Serial _serial; #endif public: @@ -104,7 +104,7 @@ //------------------------------------------------------------------------ /// \brief Gives access to serial port in use. /// Used for other high and low level operations, eg. in *OSTC Planner*. - inline Serial& serial() { return _serial; } + inline Serial &serial() { return _serial; } /// \} ////////////////////////////////////////////////////////////////////////// @@ -120,12 +120,12 @@ /// 8 bit mask. See HardwareDescriptor for known combinations. /// enum HardwareOption { - HW_CHARGEABLE_BATTERY= 0x01, ///< Recharge option. - HW_LIGHT_SENSOR = 0x02, ///< Detects light level, and tune screen. - HW_S8_COM = 0x04, ///< Analog connector to O2 cells. - HW_OPTICAL_COM = 0x08, ///< Digital connector to O2 cells. - HW_BLUETOOTH_COM = 0x10, ///< Bluetooth, hence no USB connection. - HW_DUALCORE = 0x20, ///< Dual core processor. + HW_CHARGEABLE_BATTERY = 0x01, ///< Recharge option. + HW_LIGHT_SENSOR = 0x02, ///< Detects light level, and tune screen. + HW_S8_COM = 0x04, ///< Analog connector to O2 cells. + HW_OPTICAL_COM = 0x08, ///< Digital connector to O2 cells. + HW_BLUETOOTH_COM = 0x10, ///< Bluetooth, hence no USB connection. + HW_DUALCORE = 0x20, ///< Dual core processor. }; ///----------------------------------------------------------------------- @@ -138,20 +138,20 @@ /// enum HardwareDescriptor { HW_UNKNOWN_OSTC = 0, - HW_Frog = HW_BLUETOOTH_COM, + HW_Frog = HW_BLUETOOTH_COM, HW_OSTCSport_a = HW_LIGHT_SENSOR | HW_BLUETOOTH_COM, HW_OSTCSport_b = HW_OSTCSport_a | HW_CHARGEABLE_BATTERY, - HW_OSTC2c = HW_CHARGEABLE_BATTERY, - HW_OSTC2_a = HW_CHARGEABLE_BATTERY | HW_BLUETOOTH_COM, - HW_OSTC2_b = HW_OSTCSport_b, - HW_OSTC2_c = HW_OSTC2_b | HW_OPTICAL_COM, - HW_OSTC3 = HW_LIGHT_SENSOR | HW_OPTICAL_COM, - HW_OSTC3p_a = HW_LIGHT_SENSOR | HW_OPTICAL_COM | HW_BLUETOOTH_COM, - HW_OSTC3p_b = HW_OSTCSport_b, - HW_OSTCcR_a = HW_CHARGEABLE_BATTERY | HW_S8_COM, - HW_OSTCcR_b = HW_OSTCcR_a | HW_LIGHT_SENSOR, - HW_OSTC4 = HW_DUALCORE|HW_BLUETOOTH_COM| - HW_OPTICAL_COM|HW_LIGHT_SENSOR|HW_CHARGEABLE_BATTERY + HW_OSTC2c = HW_CHARGEABLE_BATTERY, + HW_OSTC2_a = HW_CHARGEABLE_BATTERY | HW_BLUETOOTH_COM, + HW_OSTC2_b = HW_OSTCSport_b, + HW_OSTC2_c = HW_OSTC2_b | HW_OPTICAL_COM, + HW_OSTC3 = HW_LIGHT_SENSOR | HW_OPTICAL_COM, + HW_OSTC3p_a = HW_LIGHT_SENSOR | HW_OPTICAL_COM | HW_BLUETOOTH_COM, + HW_OSTC3p_b = HW_OSTCSport_b, + HW_OSTCcR_a = HW_CHARGEABLE_BATTERY | HW_S8_COM, + HW_OSTCcR_b = HW_OSTCcR_a | HW_LIGHT_SENSOR, + HW_OSTC4 = HW_DUALCORE | HW_BLUETOOTH_COM | HW_OPTICAL_COM | HW_LIGHT_SENSOR + | HW_CHARGEABLE_BATTERY }; //------------------------------------------------------------------------ @@ -167,17 +167,17 @@ /// what are the supported command. /// enum CompanionFeature { - PARAMETERS = (1<<0), ///< Download/Edit/Upload various parameters. - DATE = (1<<1), ///< Set date & time. - NAME = (1<<2), ///< Set custom text displayed on main screen. - ICON = (1<<3), ///< Set custom image displayed on main screen. - DUMPSCREEN = (1<<4), ///< Makes copy of current screen. - FIRMWARE = (1<<5), ///< Do firmware upgrades. - HELIUM_DIVE = (1<<6), ///< Computes deco stops for trimix dives. - CCR_DIVE = (1<<7), ///< Computes deco stops for rebreather dives. - BLUETOOTH = (1<<8), ///< Use Bluetooh communication (instead of USB) - VPM_MODEL = (1<<9), ///< Also propose VPM deco stops. - SIGNAL_CHECK = (1<<10) ///< Echo signal quality for bluetooth computer + PARAMETERS = (1 << 0), ///< Download/Edit/Upload various parameters. + DATE = (1 << 1), ///< Set date & time. + NAME = (1 << 2), ///< Set custom text displayed on main screen. + ICON = (1 << 3), ///< Set custom image displayed on main screen. + DUMPSCREEN = (1 << 4), ///< Makes copy of current screen. + FIRMWARE = (1 << 5), ///< Do firmware upgrades. + HELIUM_DIVE = (1 << 6), ///< Computes deco stops for trimix dives. + CCR_DIVE = (1 << 7), ///< Computes deco stops for rebreather dives. + BLUETOOTH = (1 << 8), ///< Use Bluetooh communication (instead of USB) + VPM_MODEL = (1 << 9), ///< Also propose VPM deco stops. + SIGNAL_CHECK = (1 << 10) ///< Echo signal quality for bluetooth computer }; Q_DECLARE_FLAGS(CompanionFeatures, CompanionFeature) /// \brief Tells what is supported for a given computer. @@ -205,7 +205,7 @@ /// different file formats (due to support tool, and/or need for /// encryption). /// So each driver have to implement its specific loader. - virtual void loadFirmware(HexFile&, const QString& fileName) const = 0; + virtual void loadFirmware(HexFile &, const QString &fileName) const = 0; //------------------------------------------------------------------------ /// \brief Regular expression to filter *USB* or *Bluetooth* port names. @@ -213,7 +213,7 @@ /// Used to propose only the list of ports that matches the serial ports /// compatible with USB/Bluetooth emulation and the connected dive /// computer. - // virtual QRegExp portTemplate() const = 0; + // virtual QRegExp portTemplate() const = 0; virtual QRegularExpression portTemplate() const = 0; /// \} ////////////////////////////////////////////////////////////////////////// @@ -252,15 +252,15 @@ /// Used on most devices to display commands as they are processed, /// so the user can see *OSTC Companion* is working properly, by seeing /// progress on the dive computer itself. - virtual void writeText(const QString& msg) = 0; + virtual void writeText(const QString &msg) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer date and time. - virtual void setDate(const QDateTime& date) = 0; + virtual void setDate(const QDateTime &date) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer user text. - virtual void setName(const QString& newName) = 0; + virtual void setName(const QString &newName) = 0; //------------------------------------------------------------------------ /// \brief Display signal quality at OSTC. @@ -268,26 +268,25 @@ //------------------------------------------------------------------------ /// \brief Read all header from OSTC - virtual void getAllHeader(unsigned char* pBuffer) = 0; + virtual void getAllHeader(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Write all header from OSTC - virtual void writeAllHeader(unsigned char* pBuffer) = 0; - + virtual void writeAllHeader(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Read all samples from OSTC - virtual void getAllSamples(unsigned char* pBuffer) = 0; + virtual void getAllSamples(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Write all samples to OSTC - virtual void writeAllSamples(unsigned char* pBuffer) = 0; + virtual void writeAllSamples(unsigned char *pBuffer) = 0; //------------------------------------------------------------------------ /// \brief Set HW dive computer icon set /// /// *Currently only supported by Frog dive computer*. - virtual void setIcons(const QString& fileName) = 0; + virtual void setIcons(const QString &fileName) = 0; //------------------------------------------------------------------------ /// \brief Take a snapshot of the connected computer's screen. @@ -300,7 +299,7 @@ /// /// \note needs service mode connection. /// \sa connectServiceMode(). - virtual void upgradeFW(const QString& fileName) = 0; + virtual void upgradeFW(const QString &fileName) = 0; //------------------------------------------------------------------------ /// \brief Close connection. @@ -338,9 +337,7 @@ /// \param [in] retries: Optional max number of retries. Default to 10. /// /// \returns the ack byte (if any), or 0xFF if never received. - static unsigned char retryCommand(Serial& serial, - unsigned char cmd, - int retries = 10); + static unsigned char retryCommand(Serial &serial, unsigned char cmd, int retries = 10); //------------------------------------------------------------------------ /// \brief Read and check connected dive computer identity. @@ -395,7 +392,6 @@ /// Ask *OS* for the list of USB serial emulation currently connected whose name /// matches the portTemplate() regular expression. QStringList listUSBPorts() const; - }; #endif // COMPUTEROPERATIONS_H
--- a/OSTC4Operations.h Mon Jan 12 13:55:38 2026 +0000 +++ b/OSTC4Operations.h Mon Jan 12 13:57:24 2026 +0000 @@ -41,20 +41,19 @@ #ifndef OSTC4_OPERATIONS_H #define OSTC4_OPERATIONS_H +#include <QRegularExpression> #include "OSTC3Operations.h" -#include <QRegularExpression> -#include "AES/Adler16.h" -#include "ostc45_icon.h" -#include "crc_wrapper.h" -#include "Export.h" #include <QFile> #include <QString> +#include "AES/Adler16.h" +#include "Export.h" +#include "crc_wrapper.h" +#include "ostc45_icon.h" ////////////////////////////////////////////////////////////////////////////// /// \brief Implementing various operations for H&W OSTC4 dive computer -class OSTC4Operations - : public OSTC3Operations +class OSTC4Operations : public OSTC3Operations { //------------------------------------------------------------------------ /// \brief Custom text size (lines and columns). @@ -71,42 +70,42 @@ /// \brief Tells what is supported for a given computer. EXPORT CompanionFeatures supported() const override; - struct FirmwareOSTC4 { - uint length; - uchar type, dummy5, dummy6, dummy7; - uint checksum; - struct { + struct FirmwareOSTC4 + { + uint length; + uchar type, dummy5, dummy6, dummy7; + uint checksum; + struct + { unsigned char x, y, z, beta; - } version; + } version; }; - QFile _file; + QFile _file; std::unique_ptr<BmpToArray> bmp; /// \param[in] dryRun: If TRUE, do not upload FW, just check file structure. - void openFirmware(const QString& fileName, bool dryRun); + void openFirmware(const QString &fileName, bool dryRun); - void loadFirmwarePart(FirmwareOSTC4& header, - QByteArray& bin, int part, - bool dryRun); + void loadFirmwarePart(FirmwareOSTC4 &header, QByteArray &bin, int part, bool dryRun); void getSignal() override; - void getAllHeader(unsigned char* pBuffer) override; - void writeAllHeader(unsigned char* pBuffer) override; - void getAllSamples(unsigned char* pBuffer) override; - void writeAllSamples(unsigned char* pBuffer) override; - void setIcons(const QString& fileName) override; + void getAllHeader(unsigned char *pBuffer) override; + void writeAllHeader(unsigned char *pBuffer) override; + void getAllSamples(unsigned char *pBuffer) override; + void writeAllSamples(unsigned char *pBuffer) override; + void setIcons(const QString &fileName) override; EXPORT QString firmwareTemplate() const override; - // EXPORT QRegExp portTemplate() const override; + // EXPORT QRegExp portTemplate() const override; EXPORT QRegularExpression portTemplate() const override; EXPORT QStringList listPorts() const override; EXPORT void upgradeFW(const QString &fileName) override; Adler32 fileChecksum; - CrcWrapper* m_crcWrapper; + CrcWrapper *m_crcWrapper; public: EXPORT OSTC4Operations();
--- a/crc_wrapper.cpp Mon Jan 12 13:55:38 2026 +0000 +++ b/crc_wrapper.cpp Mon Jan 12 13:57:24 2026 +0000 @@ -4,15 +4,13 @@ #include "crcmodel.h" } - CrcWrapper::CrcWrapper(QObject *parent) : QObject(parent) {} - void CrcWrapper::init(p_cm_t p_cm) { - cm_ini(p_cm); + cm_ini(p_cm); } void CrcWrapper::cm_next(p_cm_t p_cm, int ch) @@ -22,44 +20,39 @@ uint32_t CrcWrapper::CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words) { - cm_t crc_model; - uint32_t word_to_do; - uint8_t byte_to_do; - int i; + cm_t crc_model; + uint32_t word_to_do; + uint8_t byte_to_do; + int i; // Values for the STM32F generator. - crc_model.cm_width = 32; // 32-bit CRC - crc_model.cm_poly = 0x04C11DB7; // CRC-32 polynomial - crc_model.cm_init = 0xFFFFFFFF; // CRC initialized to 1's - crc_model.cm_refin = FALSE; // CRC calculated MSB first - crc_model.cm_refot = FALSE; // Final result is not bit-reversed - crc_model.cm_xorot = 0x00000000; // Final result XOR'ed with this + crc_model.cm_width = 32; // 32-bit CRC + crc_model.cm_poly = 0x04C11DB7; // CRC-32 polynomial + crc_model.cm_init = 0xFFFFFFFF; // CRC initialized to 1's + crc_model.cm_refin = FALSE; // CRC calculated MSB first + crc_model.cm_refot = FALSE; // Final result is not bit-reversed + crc_model.cm_xorot = 0x00000000; // Final result XOR'ed with this cm_ini(&crc_model); - while (words--) - { + while (words--) { // The STM32F10x hardware does 32-bit words at a time!!! word_to_do = *buffer++; // Do all bytes in the 32-bit word. - for (i = 0; i < sizeof(word_to_do); i++) - { + for (i = 0; i < sizeof(word_to_do); i++) { // We calculate a *byte* at a time. If the CRC is MSB first we // do the next MS byte and vica-versa. - if (crc_model.cm_refin == FALSE) - { + if (crc_model.cm_refin == FALSE) { // MSB first. Do the next MS byte. byte_to_do = (uint8_t) ((word_to_do & 0xFF000000) >> 24); word_to_do <<= 8; - } - else - { + } else { // LSB first. Do the next LS byte. byte_to_do = (uint8_t) (word_to_do & 0x000000FF); @@ -74,4 +67,3 @@ return (cm_crc(&crc_model)); } -
--- a/crc_wrapper.h Mon Jan 12 13:55:38 2026 +0000 +++ b/crc_wrapper.h Mon Jan 12 13:57:24 2026 +0000 @@ -13,11 +13,9 @@ explicit CrcWrapper(QObject *parent = nullptr); void init(p_cm_t p_cm); - void cm_next(p_cm_t p_cm,int ch); + void cm_next(p_cm_t p_cm, int ch); uint32_t CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words); - - }; #endif // CRC_WRAPPER_H
--- a/crcmodel.h Mon Jan 12 13:55:38 2026 +0000 +++ b/crcmodel.h Mon Jan 12 13:57:24 2026 +0000 @@ -101,12 +101,9 @@ /* */ /******************************************************************************/ - - #ifndef CRC_MODEL_H #define CRC_MODEL_H - #ifdef __cplusplus extern "C" { #endif @@ -120,12 +117,12 @@ #include <stdbool.h> -typedef unsigned long ulong; -typedef unsigned char * p_ubyte_; +typedef unsigned long ulong; +typedef unsigned char *p_ubyte_; #ifndef TRUE #define FALSE 0 -#define TRUE 1 +#define TRUE 1 #endif /* Change to the second definition if you don't have prototypes. */ @@ -145,16 +142,16 @@ /* model algorithm. Most of the fields are model parameters which must be */ /* set before the first initializing call to cm_ini. */ typedef struct - { - int cm_width; /* Parameter: Width in bits [8,32]. */ - ulong cm_poly; /* Parameter: The algorithm's polynomial. */ - ulong cm_init; /* Parameter: Initial register value. */ - bool cm_refin; /* Parameter: Reflect input bytes? */ - bool cm_refot; /* Parameter: Reflect output CRC? */ - ulong cm_xorot; /* Parameter: XOR this to output CRC. */ +{ + int cm_width; /* Parameter: Width in bits [8,32]. */ + ulong cm_poly; /* Parameter: The algorithm's polynomial. */ + ulong cm_init; /* Parameter: Initial register value. */ + bool cm_refin; /* Parameter: Reflect input bytes? */ + bool cm_refot; /* Parameter: Reflect output CRC? */ + ulong cm_xorot; /* Parameter: XOR this to output CRC. */ - ulong cm_reg; /* Context: Context during execution. */ - } cm_t; + ulong cm_reg; /* Context: Context during execution. */ +} cm_t; typedef cm_t *p_cm_t; /******************************************************************************/ @@ -167,10 +164,10 @@ /* Initializes the argument CRC model instance. */ /* All parameter fields must be set before calling this. */ -void cm_nxt P_((p_cm_t p_cm,int ch)); +void cm_nxt P_((p_cm_t p_cm, int ch)); /* Processes a single message byte [0,255]. */ -void cm_blk P_((p_cm_t p_cm,p_ubyte_ blk_adr,ulong blk_len)); +void cm_blk P_((p_cm_t p_cm, p_ubyte_ blk_adr, ulong blk_len)); /* Processes a block of message bytes. */ ulong cm_crc P_((p_cm_t p_cm)); @@ -183,7 +180,7 @@ /* The following function can be used to calculate a CRC lookup table. */ /* It can also be used at run-time to create or check static tables. */ -ulong cm_tab P_((p_cm_t p_cm,int index)); +ulong cm_tab P_((p_cm_t p_cm, int index)); /* Returns the i'th entry for the lookup table for the specified algorithm. */ /* The function examines the fields cm_width, cm_poly, cm_refin, and the */ /* argument table index in the range [0,255] and returns the table entry in */
--- a/ostc45_icon.cpp Mon Jan 12 13:55:38 2026 +0000 +++ b/ostc45_icon.cpp Mon Jan 12 13:57:24 2026 +0000 @@ -1,9 +1,7 @@ #include "ostc45_icon.h" - //OSTC45_Icon::OSTC45_Icon() {} - #pragma pack(push, 1) struct BMPFileHeader { @@ -17,25 +15,25 @@ struct BMPInfoHeader { uint32_t biSize; - int32_t biWidth; - int32_t biHeight; + int32_t biWidth; + int32_t biHeight; uint16_t biPlanes; uint16_t biBitCount; uint32_t biCompression; uint32_t biSizeImage; - int32_t biXPelsPerMeter; - int32_t biYPelsPerMeter; + int32_t biXPelsPerMeter; + int32_t biYPelsPerMeter; uint32_t biClrUsed; uint32_t biClrImportant; }; #pragma pack(pop) -BmpToArray::BmpToArray(const QString& filename) +BmpToArray::BmpToArray(const QString &filename) { loadBMP(filename); } -void BmpToArray::loadBMP(const QString& filename) +void BmpToArray::loadBMP(const QString &filename) { QFile file(filename); int dstY; @@ -47,12 +45,12 @@ if (!file.open(QIODevice::ReadOnly)) throw std::runtime_error("Cannot open BMP file"); - if (file.read(reinterpret_cast<char*>(&fileHeader), - sizeof(BMPFileHeader)) != sizeof(BMPFileHeader)) + if (file.read(reinterpret_cast<char *>(&fileHeader), sizeof(BMPFileHeader)) + != sizeof(BMPFileHeader)) throw std::runtime_error("Failed to read BMP file header"); - if (file.read(reinterpret_cast<char*>(&infoHeader), - sizeof(BMPInfoHeader)) != sizeof(BMPInfoHeader)) + if (file.read(reinterpret_cast<char *>(&infoHeader), sizeof(BMPInfoHeader)) + != sizeof(BMPInfoHeader)) throw std::runtime_error("Failed to read BMP info header"); if (fileHeader.bfType != 0x4D42) @@ -63,40 +61,38 @@ if (infoHeader.biCompression != 0) throw std::runtime_error("Compressed BMP not supported"); - if(infoHeader.biWidth > 800) + if (infoHeader.biWidth > 800) throw std::runtime_error("Only BMP with 800 or less horizontal pixels supported"); - if(infoHeader.biHeight > 480) + if (infoHeader.biHeight > 480) throw std::runtime_error("Only BMP with 480 or less vertical pixels supported"); // Width / Height width = infoHeader.biWidth; height = infoHeader.biHeight; - if ((int32_t)height < 0) { - height = -((int32_t)height); + if ((int32_t) height < 0) { + height = -((int32_t) height); topDown = true; } // Palette uint32_t colorCount = infoHeader.biClrUsed; - if (colorCount == 0) colorCount = 256; - if (colorCount > 256) colorCount = 256; + if (colorCount == 0) + colorCount = 256; + if (colorCount > 256) + colorCount = 256; clut.resize(colorCount); for (uint32_t i = 0; i < colorCount; ++i) - file.read(reinterpret_cast<char*>(&clut[i]), 4); + file.read(reinterpret_cast<char *>(&clut[i]), 4); // CLUT in 32-Bit transform 0x00RRGGBB clut32.resize(255, 0); - for (uint32_t i = 0; i < colorCount && i < 255; ++i) - { - clut32[i] = - (clut[i].r << 16) | - (clut[i].g << 8) | - (clut[i].b); + for (uint32_t i = 0; i < colorCount && i < 255; ++i) { + clut32[i] = (clut[i].r << 16) | (clut[i].g << 8) | (clut[i].b); } // Pixel-Data @@ -109,28 +105,20 @@ rowBuffer.resize(rowSize); - for (int y = 0; y < height; ++y) - { + for (int y = 0; y < height; ++y) { if (file.read(rowBuffer.data(), rowSize) != rowSize) throw std::runtime_error("Failed to read BMP pixel row"); - if (topDown) - { + if (topDown) { dstY = height - 1 - y; - } - else - { + } else { dstY = y; } - for (int x = 0; x < width; ++x) - { - pixelData[x * height + dstY] = - static_cast<uint8_t>(rowBuffer[x]); + for (int x = 0; x < width; ++x) { + pixelData[x * height + dstY] = static_cast<uint8_t>(rowBuffer[x]); } } - - } QByteArray BmpToArray::getTransferBytes() const { @@ -139,25 +127,21 @@ out.reserve(clut32.size() * 4 + pixelData.size()); // CLUT (32 Bit, Little Endian) - for (uint32_t color : clut32) - { - out.append(static_cast<char>( color & 0xFF)); - out.append(static_cast<char>((color >> 8) & 0xFF)); + for (uint32_t color : clut32) { + out.append(static_cast<char>(color & 0xFF)); + out.append(static_cast<char>((color >> 8) & 0xFF)); out.append(static_cast<char>((color >> 16) & 0xFF)); out.append(static_cast<char>((color >> 24) & 0xFF)); } // Pixel (8 Bit) - out.append(reinterpret_cast<const char*>(pixelData.data()), - pixelData.size()); + out.append(reinterpret_cast<const char *>(pixelData.data()), pixelData.size()); return out; } -void BmpToArray::getImageXY(uint32_t* x, uint32_t* y) +void BmpToArray::getImageXY(uint32_t *x, uint32_t *y) { *x = width; *y = height; } - -
--- a/ostc45_icon.h Mon Jan 12 13:55:38 2026 +0000 +++ b/ostc45_icon.h Mon Jan 12 13:57:24 2026 +0000 @@ -1,20 +1,21 @@ #ifndef OSTC45_ICON_H #define OSTC45_ICON_H -#include <cstdint> -#include <vector> -#include <stdexcept> -#include <iostream> +#include <QByteArray> +#include <QFile> +#include <QIODevice> #include <QString> #include <QVector> -#include <QIODevice> -#include <QFile> -#include <QByteArray> +#include <cstdint> +#include <iostream> +#include <stdexcept> +#include <vector> class BmpToArray { public: - struct CLUTEntry { + struct CLUTEntry + { uint8_t b; uint8_t g; uint8_t r; @@ -22,15 +23,15 @@ }; QByteArray getTransferBytes() const; - void getImageXY(uint32_t* x, uint32_t* y); - BmpToArray(const QString& fileName); + void getImageXY(uint32_t *x, uint32_t *y); + BmpToArray(const QString &fileName); private: - void loadBMP(const QString& filename); + void loadBMP(const QString &filename); QVector<CLUTEntry> clut; - QVector<uint8_t> pixelData; // Pixel-Indizes - QVector<uint32_t> clut32; // 32-Bit Palette + QVector<uint8_t> pixelData; // Pixel-Indizes + QVector<uint32_t> clut32; // 32-Bit Palette uint32_t width = 0; uint32_t height = 0; };
