Formatted the entire codebase and added a CI check for formatting

This commit is contained in:
AlexandreRouma
2021-12-19 22:11:44 +01:00
parent 8644957881
commit ea587db0cb
161 changed files with 3302 additions and 3393 deletions

View File

@ -22,9 +22,9 @@
#include <sat_decoder.h>
#include <noaa_hrpt_decoder.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
#define CONCAT(a, b) ((std::string(a) + b).c_str())
SDRPP_MOD_INFO {
SDRPP_MOD_INFO{
/* Name: */ "weather_sat_decoder",
/* Description: */ "Weather Satellite Decoder for SDR++",
/* Author: */ "Ryzerth",
@ -34,7 +34,7 @@ SDRPP_MOD_INFO {
std::string genFileName(std::string prefix, std::string suffix) {
time_t now = time(0);
tm *ltm = localtime(&now);
tm* ltm = localtime(&now);
char buf[1024];
sprintf(buf, "%s_%02d-%02d-%02d_%02d-%02d-%02d%s", prefix.c_str(), ltm->tm_hour, ltm->tm_min, ltm->tm_sec, ltm->tm_mday, ltm->tm_mon + 1, ltm->tm_year + 1900, suffix.c_str());
return buf;
@ -59,7 +59,7 @@ public:
}
selectDecoder(decoderNames[0], false);
gui::menu.registerEntry(name, menuHandler, this, this);
}
@ -120,7 +120,7 @@ private:
std::string name;
bool enabled = true;
VFOManager::VFO* vfo;
std::map<std::string, SatDecoder*> decoders;
@ -129,7 +129,6 @@ private:
int decoderId = 0;
SatDecoder* decoder;
};
MOD_EXPORT void _INIT_() {

View File

@ -9,8 +9,8 @@
#include <gui/widgets/line_push_image.h>
#include <gui/gui.h>
#define NOAA_HRPT_VFO_SR 3000000.0f
#define NOAA_HRPT_VFO_BW 2000000.0f
#define NOAA_HRPT_VFO_SR 3000000.0f
#define NOAA_HRPT_VFO_BW 2000000.0f
class NOAAHRPTDecoder : public SatDecoder {
public:
@ -19,15 +19,15 @@ public:
_name = name;
// Core DSP
demod.init(vfo->output, NOAA_HRPT_VFO_SR, 665400.0f * 2.0f, 0.02e-3, (0.06f*0.06f) / 2.0f, 32, 0.6f, (0.01f*0.01f) / 4.0f, 0.01f, 0.005);
demod.init(vfo->output, NOAA_HRPT_VFO_SR, 665400.0f * 2.0f, 0.02e-3, (0.06f * 0.06f) / 2.0f, 32, 0.6f, (0.01f * 0.01f) / 4.0f, 0.01f, 0.005);
split.init(demod.out);
split.bindStream(&dataStream);
split.bindStream(&visStream);
reshape.init(&visStream, 1024, (NOAA_HRPT_VFO_SR/30) - 1024);
reshape.init(&visStream, 1024, (NOAA_HRPT_VFO_SR / 30) - 1024);
visSink.init(&reshape.out, visHandler, this);
deframe.init(&dataStream, 11090 * 10 * 2, (uint8_t*)dsp::noaa::HRPTSyncWord, 60);
manDec.init(&deframe.out, false);
packer.init(&manDec.out);
@ -125,7 +125,7 @@ public:
compositeThread = std::thread(&NOAAHRPTDecoder::avhrrCompositeWorker, this);
};
void stop() {
compositeIn1.stopReader();
compositeIn1.stopWriter();
@ -187,7 +187,7 @@ public:
compositeIn2.clearReadStop();
compositeIn2.clearWriteStop();
};
void setVFO(VFOManager::VFO* vfo) {
_vfo = vfo;
demod.setInput(_vfo->output);
@ -196,7 +196,7 @@ public:
virtual bool canRecord() {
return false;
}
// bool startRecording(std::string recPath) {
// };
@ -208,7 +208,7 @@ public:
// bool isRecording() {
// };
void drawMenu(float menuWidth) {
ImGui::SetNextItemWidth(menuWidth);
symDiag.draw();
@ -285,7 +285,7 @@ public:
ImGui::Checkbox("Show Image", &showWindow);
};
private:
// AVHRR Data Handlers
void avhrrCompositeWorker() {
@ -294,16 +294,16 @@ private:
while (true) {
if (compositeIn1.read() < 0) { return; }
if (compositeIn2.read() < 0) { return; }
uint8_t* buf = avhrrRGBImage.acquireNextLine();
float rg, b;
for (int i = 0; i < 2048; i++) {
b = ((float)compositeIn1.readBuf[i] * 255.0f) / 1024.0f;
rg = ((float)compositeIn2.readBuf[i] * 255.0f) / 1024.0f;
buf[(i*4)] = rg;
buf[(i*4) + 1] = rg;
buf[(i*4) + 2] = b;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = rg;
buf[(i * 4) + 1] = rg;
buf[(i * 4) + 2] = b;
buf[(i * 4) + 3] = 255;
}
avhrrRGBImage.releaseNextLine();
@ -318,10 +318,10 @@ private:
float val;
for (int i = 0; i < 2048; i++) {
val = ((float)data[i] * 255.0f) / 1024.0f;
buf[(i*4)] = val;
buf[(i*4) + 1] = val;
buf[(i*4) + 2] = val;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = val;
buf[(i * 4) + 1] = val;
buf[(i * 4) + 2] = val;
buf[(i * 4) + 3] = 255;
}
_this->avhrr1Image.releaseNextLine();
@ -335,10 +335,10 @@ private:
float val;
for (int i = 0; i < 2048; i++) {
val = ((float)data[i] * 255.0f) / 1024.0f;
buf[(i*4)] = val;
buf[(i*4) + 1] = val;
buf[(i*4) + 2] = val;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = val;
buf[(i * 4) + 1] = val;
buf[(i * 4) + 2] = val;
buf[(i * 4) + 3] = 255;
}
_this->avhrr2Image.releaseNextLine();
@ -352,10 +352,10 @@ private:
float val;
for (int i = 0; i < 2048; i++) {
val = ((float)data[i] * 255.0f) / 1024.0f;
buf[(i*4)] = val;
buf[(i*4) + 1] = val;
buf[(i*4) + 2] = val;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = val;
buf[(i * 4) + 1] = val;
buf[(i * 4) + 2] = val;
buf[(i * 4) + 3] = 255;
}
_this->avhrr3Image.releaseNextLine();
}
@ -366,10 +366,10 @@ private:
float val;
for (int i = 0; i < 2048; i++) {
val = ((float)data[i] * 255.0f) / 1024.0f;
buf[(i*4)] = val;
buf[(i*4) + 1] = val;
buf[(i*4) + 2] = val;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = val;
buf[(i * 4) + 1] = val;
buf[(i * 4) + 2] = val;
buf[(i * 4) + 3] = 255;
}
_this->avhrr4Image.releaseNextLine();
}
@ -380,10 +380,10 @@ private:
float val;
for (int i = 0; i < 2048; i++) {
val = ((float)data[i] * 255.0f) / 1024.0f;
buf[(i*4)] = val;
buf[(i*4) + 1] = val;
buf[(i*4) + 2] = val;
buf[(i*4) + 3] = 255;
buf[(i * 4)] = val;
buf[(i * 4) + 1] = val;
buf[(i * 4) + 2] = val;
buf[(i * 4) + 3] = 255;
}
_this->avhrr5Image.releaseNextLine();
}
@ -391,102 +391,82 @@ private:
// HIRS Data Handlers
static void hirs1Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs2Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs3Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs4Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs5Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs6Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs7Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs8Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs9Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs10Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs11Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs12Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs13Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs14Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs15Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs16Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs17Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs18Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs19Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs20Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void visHandler(float* data, int count, void* ctx) {
@ -568,5 +548,4 @@ private:
std::thread compositeThread;
bool showWindow = false;
};

View File

@ -10,7 +10,7 @@ public:
virtual void setVFO(VFOManager::VFO* vfo) = 0;
virtual bool canRecord() = 0;
virtual bool startRecording(std::string recPath) { return false; };
virtual void stopRecording() { };
virtual void stopRecording(){};
virtual bool isRecording() { return false; };
virtual void drawMenu(float menuWidth) = 0;
};