Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PIO] Concatenate .cpp files to prevent linking errors #3409

Merged
merged 8 commits into from
Dec 3, 2020
Merged
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ tools/vagrant/.vagrant/
tools/vagrant/build/

tools/vagrant/Custom.h

.buildcache/

tools/vagrant/pio_envlist.txt


.buildcache/

tools/vagrant/pio_envlist.txt

build_output/

**/__tmpfile.cpp
5 changes: 5 additions & 0 deletions lib/Adafruit_SGP30-1.0.5/Adafruit_SGP30.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LIB_ADAFRUIT_SGP30_1_0_5
#define LIB_ADAFRUIT_SGP30_1_0_5

/*!
* @file Adafruit_SGP30.h
*
Expand Down Expand Up @@ -77,3 +80,5 @@ class Adafruit_SGP30 {
uint8_t readlen = 0);
uint8_t generateCRC(uint8_t data[], uint8_t datalen);
};

#endif
6 changes: 5 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ extra_scripts = tools/pio/gzip-firmware.py


[extra_scripts_default]
extra_scripts = pre:tools/pio/generate-compiletime-defines.py
extra_scripts = pre:tools/pio/concat_cpp_files.py
pre:tools/pio/generate-compiletime-defines.py
tools/pio/copy_files.py
post:tools/pio/remove_concat_cpp_files.py

[common]
lib_ldf_mode = deep+
Expand All @@ -86,6 +88,8 @@ monitor_speed = 115200
targets =
extra_scripts = pre:tools/pio/pre_default_check.py
${extra_scripts_esp8266.extra_scripts}
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<*/Commands/> -<*/ControllerQueue/> -<*/PluginStructs/> -<*/WebServer/>



[env]
Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/Controller.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Controller.h"
#include "../Commands/Controller.h"


#include "../../ESPEasy_common.h"
Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/InternalCommands.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "InternalCommands.h"
#include "../Commands/InternalCommands.h"

#include "../../ESPEasy_common.h"

Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/Networks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ String Command_ETH_Wifi_Mode (struct EventStruct *event, const char* Line)
return Command_GetORSetUint8_t(event, F("NetworkMedium:"), Line, (uint8_t*)&Settings.NetworkMedium,1);
}

#endif
#endif
2 changes: 1 addition & 1 deletion src/src/Commands/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ String Command_Notifications_Notify(struct EventStruct *event, const char* Line)
}
}
return return_command_success();
}
}
2 changes: 1 addition & 1 deletion src/src/Commands/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ String Command_RTC_resetFlashWriteCounter(struct EventStruct *event, const char*
{
RTC.flashDayCounter = 0;
return return_command_success();
}
}
2 changes: 1 addition & 1 deletion src/src/Commands/SDCARD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ String Command_SD_Remove(struct EventStruct *event, const char* Line)
SD.remove((char*)fname.c_str());
return return_result(event, result);
}
#endif
#endif
8 changes: 8 additions & 0 deletions src/src/Commands/Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
#include "../Helpers/Hardware.h"
#include "../Helpers/PortStatus.h"

// Needed also here for PlatformIO's library finder as the .h file
// is in a directory which is excluded in the src_filter
#ifdef USE_SERVO
# ifdef ESP32
# include <Servo.h>
# endif // ifdef ESP32
#endif

#ifdef USE_SERVO
ServoPinMap_t ServoPinMap;
#endif // ifdef USE_SERVO
Expand Down
2 changes: 1 addition & 1 deletion src/src/Commands/i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ String Command_i2c_Scanner(struct EventStruct *event, const char* Line)
}
}
return return_see_serial(event);
}
}
2 changes: 1 addition & 1 deletion src/src/Commands/wd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ String Command_WD_Read(EventStruct *event, const char* Line)
return return_result(event, result);
}
return return_command_success();
}
}
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C004_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "../DataStructs/DeviceStruct.h"
#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C004

C004_queue_element::C004_queue_element() {}

C004_queue_element::C004_queue_element(const struct EventStruct *event) :
Expand All @@ -18,3 +20,5 @@ C004_queue_element::C004_queue_element(const struct EventStruct *event) :
size_t C004_queue_element::getSize() const {
return sizeof(*this) + txt.length();
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C004_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

struct EventStruct;

// #ifdef USES_C004
#ifdef USES_C004

/*********************************************************************************************\
* C004_queue_element for queueing requests for C004 ThingSpeak.
Expand All @@ -31,7 +31,7 @@ class C004_queue_element {
Sensor_VType sensorType = Sensor_VType::SENSOR_TYPE_NONE;
};

// #endif //USES_C004
#endif //USES_C004


#endif // CONTROLLERQUEUE_C004_QUEUE_ELEMENT_H
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C007_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C007

C007_queue_element::C007_queue_element() {}

C007_queue_element::C007_queue_element(const struct EventStruct *event) :
Expand All @@ -13,3 +15,5 @@ C007_queue_element::C007_queue_element(const struct EventStruct *event) :
size_t C007_queue_element::getSize() const {
return sizeof(*this);
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C007_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
struct EventStruct;


// #ifdef USES_C007
#ifdef USES_C007

/*********************************************************************************************\
* C007_queue_element for queueing requests for C007 Emoncms
Expand All @@ -29,6 +29,6 @@ class C007_queue_element {
Sensor_VType sensorType = Sensor_VType::SENSOR_TYPE_NONE;
};

// #endif //USES_C007
#endif //USES_C007

#endif // CONTROLLERQUEUE_C007_QUEUE_ELEMENT_H
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C009_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C009

C009_queue_element::C009_queue_element() {}

C009_queue_element::C009_queue_element(const struct EventStruct *event) :
Expand All @@ -18,3 +20,5 @@ size_t C009_queue_element::getSize() const {
}
return total;
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C009_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
struct EventStruct;


// #ifdef USES_C009
#ifdef USES_C009

/*********************************************************************************************\
* C009_queue_element for queueing requests for C009: FHEM HTTP.
Expand All @@ -31,7 +31,7 @@ class C009_queue_element {
Sensor_VType sensorType = Sensor_VType::SENSOR_TYPE_NONE;
};

// #endif //USES_C009
#endif //USES_C009


#endif // CONTROLLERQUEUE_C009_QUEUE_ELEMENT_H
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C011_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C011

C011_queue_element::C011_queue_element() {}

C011_queue_element::C011_queue_element(const struct EventStruct *event) :
Expand All @@ -18,3 +20,5 @@ size_t C011_queue_element::getSize() const {
total += postStr.length();
return total;
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C011_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
struct EventStruct;


// #ifdef USES_C011
#ifdef USES_C011

/*********************************************************************************************\
* C011_queue_element for queueing requests for C011: Generic HTTP Advanced.
Expand All @@ -34,7 +34,7 @@ class C011_queue_element {
Sensor_VType sensorType = Sensor_VType::SENSOR_TYPE_NONE;
};

// #endif //USES_C011
#endif //USES_C011


#endif // CONTROLLERQUEUE_C011_QUEUE_ELEMENT_H
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C015_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C015

C015_queue_element::C015_queue_element() {}

C015_queue_element::C015_queue_element(const struct EventStruct *event, byte value_count) :
Expand All @@ -24,3 +26,5 @@ size_t C015_queue_element::getSize() const {
}
return total;
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C015_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

struct EventStruct;

// #ifdef USES_C015
#ifdef USES_C015

/*********************************************************************************************\
* C015_queue_element for queueing requests for 015: Blynk
Expand Down Expand Up @@ -36,7 +36,7 @@ class C015_queue_element {
byte valueCount = 0;
};

// #endif //USES_C015
#endif //USES_C015


#endif // CONTROLLERQUEUE_C015_QUEUE_ELEMENT_H
4 changes: 3 additions & 1 deletion src/src/ControllerQueue/C016_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "../DataStructs/ESPEasy_EventStruct.h"
#include "../Globals/Plugins.h"


#ifdef USES_C016

C016_queue_element::C016_queue_element() : timestamp(0), TaskIndex(INVALID_TASK_INDEX), controller_idx(0), sensorType(
Sensor_VType::SENSOR_TYPE_NONE) {}
Expand All @@ -27,3 +27,5 @@ C016_queue_element::C016_queue_element(const struct EventStruct *event, byte val
size_t C016_queue_element::getSize() const {
return sizeof(*this);
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C016_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
struct EventStruct;


// #ifdef USES_C016
#ifdef USES_C016

/*********************************************************************************************\
* C016_queue_element for queueing requests for C016: Cached HTTP.
Expand All @@ -33,7 +33,7 @@ class C016_queue_element {
byte valueCount = 0;
};

// #endif //USES_C016
#endif //USES_C016


#endif // CONTROLLERQUEUE_C016_QUEUE_ELEMENT_H
4 changes: 4 additions & 0 deletions src/src/ControllerQueue/C017_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "../DataStructs/ESPEasy_EventStruct.h"

#ifdef USES_C017

C017_queue_element::C017_queue_element() {}

C017_queue_element::C017_queue_element(const struct EventStruct *event) :
Expand All @@ -18,3 +20,5 @@ size_t C017_queue_element::getSize() const {
}
return total;
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C017_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
struct EventStruct;


// #ifdef USES_C017
#ifdef USES_C017

/*********************************************************************************************\
* C017_queue_element for queueing requests for C017: Zabbix Trapper Protocol.
Expand All @@ -31,7 +31,7 @@ class C017_queue_element {
Sensor_VType sensorType = Sensor_VType::SENSOR_TYPE_NONE;
};

// #endif //USES_C017
#endif //USES_C017


#endif // CONTROLLERQUEUE_C017_QUEUE_ELEMENT_H
9 changes: 5 additions & 4 deletions src/src/ControllerQueue/C018_queue_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

#include "../ESPEasyCore/ESPEasy_Log.h"

#ifdef USES_PACKED_RAW_DATA
String getPackedFromPlugin(struct EventStruct *event,
uint8_t sampleSetCount);
#endif // USES_PACKED_RAW_DATA
#include "../Helpers/_CPlugin_LoRa_TTN_helper.h"

#ifdef USES_C018

C018_queue_element::C018_queue_element() {}

Expand All @@ -27,3 +26,5 @@ C018_queue_element::C018_queue_element(struct EventStruct *event, uint8_t sample
size_t C018_queue_element::getSize() const {
return sizeof(*this) + packed.length();
}

#endif
4 changes: 2 additions & 2 deletions src/src/ControllerQueue/C018_queue_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

struct EventStruct;

// #ifdef USES_C018
#ifdef USES_C018

/*********************************************************************************************\
* C018_queue_element for queueing requests for C018: TTN/RN2483
Expand All @@ -29,7 +29,7 @@ class C018_queue_element {
controllerIndex_t controller_idx = INVALID_CONTROLLER_INDEX;
};

// #endif //USES_C018
#endif //USES_C018


#endif // CONTROLLERQUEUE_C018_QUEUE_ELEMENT_H
2 changes: 1 addition & 1 deletion src/src/ControllerQueue/DelayQueueElements.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "DelayQueueElements.h"
#include "../ControllerQueue/DelayQueueElements.h"

#include "../DataStructs/ControllerSettingsStruct.h"
#include "../DataStructs/TimingStats.h"
Expand Down
Loading