cleanup #ifdefs in .h files

This commit is contained in:
cyberman54 2022-02-22 13:11:46 +01:00
parent 33ee8a4b50
commit d6d2cdea92
12 changed files with 44 additions and 8 deletions

View File

@ -1,6 +1,8 @@
#ifndef _BMESENSOR_H
#define _BMESENSOR_H
#if (HAS_BME)
#include <Wire.h>
#include "globals.h"
@ -54,3 +56,5 @@ void loadState(void);
void updateState(void);
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef _DCF77_H
#define _DCF77_H
#ifdef HAS_DCF77
#include "globals.h"
#include "timekeeper.h"
@ -16,3 +18,5 @@ void DCF77_Pulse(uint8_t bit);
uint64_t DCF77_Frame(const struct tm t);
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef _GPSREAD_H
#define _GPSREAD_H
#if (HAS_GPS)
#include <TinyGPS++.h> // library for parsing NMEA data
#include <RtcDateTime.h>
#include "timekeeper.h"
@ -20,3 +22,5 @@ void gps_loop(void *pvParameters);
time_t get_gpstime(uint16_t *msec);
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef _IF482_H
#define _IF482_H
#ifdef HAS_IF482
#include "globals.h"
#include "timekeeper.h"
#include "esp_sntp.h"
@ -11,3 +13,5 @@
String IF482_Frame(time_t t);
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef _MATRIX_DISPLAY_H
#define _MATRIX_DISPLAY_H
#ifdef HAS_MATRIX_DISPLAY
#include "LEDMatrix.h"
#include "ledmatrixfonts.h"
#include "ledmatrixdisplay.h"
@ -17,3 +19,5 @@ uint8_t GetCharWidth(char cChar);
void ScrollMatrixLeft(uint8_t *buf, const uint16_t cols, const uint16_t rows);
#endif
#endif

View File

@ -1,6 +1,8 @@
#ifndef _MQTTCLIENT_H
#define _MQTTCLIENT_H
#ifdef HAS_MQTT
#include "globals.h"
#include "rcommand.h"
#include "hash.h"
@ -24,4 +26,6 @@ void NetworkEvent(WiFiEvent_t event);
esp_err_t mqtt_init(void);
void mqtt_deinit(void);
#endif
#endif // _MQTTCLIENT_H

View File

@ -3,7 +3,6 @@
#include <Arduino.h>
#include <esp_adc_cal.h>
//include <esp32-hal-adc.h>
#include <soc/adc_channel.h>
#include "i2c.h"
@ -56,7 +55,6 @@ void calibrate_voltage(void);
bool batt_sufficient(void);
#ifdef HAS_PMU
#include <axp20x.h>
extern AXP20X_Class pmu;
enum pmu_power_t { pmu_power_on, pmu_power_off, pmu_power_sleep };
@ -64,7 +62,6 @@ void AXP192_powerevent_IRQ(void);
void AXP192_power(pmu_power_t powerlevel);
void AXP192_init(void);
void AXP192_showstatus(void);
#endif // HAS_PMU
#ifdef HAS_IP5306

View File

@ -1,6 +1,8 @@
#ifndef _RTCTIME_H
#define _RTCTIME_H
#ifdef HAS_RTC
#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
@ -15,4 +17,6 @@ void sync_rtctime(void);
time_t get_rtctime(uint16_t *msec);
float get_rtctemp(void);
#endif
#endif // _RTCTIME_H

View File

@ -1,11 +1,12 @@
#ifndef _SDCARD_H
#define _SDCARD_H
#if (HAS_SDCARD)
#include "globals.h"
#include <stdio.h>
#include <SPI.h>
#if (HAS_SDCARD)
#if HAS_SDCARD == 1
#include <SD.h>
#elif HAS_SDCARD == 2
@ -13,7 +14,6 @@
#else
#error HAS_SDCARD unknown card reader value, must be either 1 or 2
#endif
#endif
#ifdef HAS_SDS011
#include "sds011read.h"
@ -65,4 +65,6 @@ bool sdcard_init(bool create = true);
void sdcard_close(void);
void sdcardWriteData(uint16_t, uint16_t, uint16_t = 0);
#endif
#endif // _SDCARD_H

View File

@ -1,10 +1,12 @@
#ifndef _SDS011READ_H
#define _SDS011READ_H
#if (HAS_SDS011)
#include <SdsDustSensor.h>
#include "globals.h"
#define SDCARD_FILE_HEADER_SDS011 ", PM10,PM25"
#define SDCARD_FILE_HEADER_SDS011 ", PM10,PM25"
// use original pins from HardwareSerial if none defined
#ifndef SDS_TX
@ -21,4 +23,7 @@ void sds011_loop();
void sds011_sleep(void);
void sds011_wakeup(void);
void sds011_store(sdsStatus_t *sds_store);
#endif
#endif // _SDS011READ_H

View File

@ -24,6 +24,8 @@ licenses. Refer to LICENSE.txt file in repository for more details.
#ifndef _SPISLAVE_H
#define _SPISLAVE_H
#ifdef HAS_SPI
#include "globals.h"
#include "rcommand.h"
@ -35,4 +37,6 @@ void spi_enqueuedata(MessageBuffer_t *message);
uint32_t spi_queuewaiting(void);
void spi_queuereset(void);
#endif
#endif // _SPISLAVE_H

View File

@ -1,10 +1,10 @@
#ifdef HAS_RTC // we have hardware RTC
#include "rtctime.h"
// Local logging tag
static const char TAG[] = __FILE__;
#ifdef HAS_RTC // we have hardware RTC
RtcDS3231<TwoWire> Rtc(Wire); // RTC hardware i2c interface
// initialize RTC