Removed dead code. Added more doxygen documentation.

Fri, 29 Nov 2019 14:26:37 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 29 Nov 2019 14:26:37 +0100
changeset 44
e52d11b8f252
parent 43
70c99c2084dc
child 45
61a106fd9d9e

Removed dead code. Added more doxygen documentation.

main/task_adc.c file | annotate | diff | comparison | revisions
main/task_adc.h file | annotate | diff | comparison | revisions
main/task_ds18b20.c file | annotate | diff | comparison | revisions
main/task_ds18b20.h file | annotate | diff | comparison | revisions
main/task_mqtt.c file | annotate | diff | comparison | revisions
main/task_mqtt.h file | annotate | diff | comparison | revisions
main/task_user.c file | annotate | diff | comparison | revisions
main/task_user.h file | annotate | diff | comparison | revisions
main/task_wifi.c file | annotate | diff | comparison | revisions
main/task_wifi.h file | annotate | diff | comparison | revisions
--- a/main/task_adc.c	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_adc.c	Fri Nov 29 14:26:37 2019 +0100
@@ -12,10 +12,10 @@
 #define NO_OF_SAMPLES   	128          			///< Multisampling
 
 
-#define PRESSURE_1		(CONFIG_PRESSURE_1)
-#define PRESSURE_2      	(CONFIG_PRESSURE_2)
-#define PRESSURE_3      	(CONFIG_PRESSURE_3)
-#define BATT_CHANNEL		(CONFIG_BATT_CHANNEL)
+#define PRESSURE_1		(CONFIG_PRESSURE_1)		///< ADC channel pressure sensor 1
+#define PRESSURE_2      	(CONFIG_PRESSURE_2)		///< ADC channel pressure sensor 2
+#define PRESSURE_3      	(CONFIG_PRESSURE_3)		///< ADC channel pressure sensor 3
+#define BATT_CHANNEL		(CONFIG_BATT_CHANNEL)		///< ADC channel half battery voltage
 
 
 static const char		*TAG = "task_adc";
--- a/main/task_adc.h	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_adc.h	Fri Nov 29 14:26:37 2019 +0100
@@ -54,8 +54,9 @@
 
 /**
  * @brief The FreeRTOS task to update the pressure sensors on request.
+ * @param pvParameters Parameters for the task.
  */
-void task_adc(void *);
+void task_adc(void *pvParameters);
 
 
 #endif
--- a/main/task_ds18b20.c	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_ds18b20.c	Fri Nov 29 14:26:37 2019 +0100
@@ -12,8 +12,8 @@
 #include "config.h"
 
 
-#define GPIO_DS18B20_BUS	(CONFIG_ONE_WIRE_BUS)
-#define DS18B20_RESOLUTION	(DS18B20_RESOLUTION_12_BIT)
+#define GPIO_DS18B20_BUS	(CONFIG_ONE_WIRE_BUS)		///< GPIO pin for the one-wire bus.
+#define DS18B20_RESOLUTION	(DS18B20_RESOLUTION_12_BIT)	///< Desired DS18B20 resolution.
 
 
 static const char		*TAG = "task_ds18b20";
--- a/main/task_ds18b20.h	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_ds18b20.h	Fri Nov 29 14:26:37 2019 +0100
@@ -17,7 +17,7 @@
 #define	DS18B20_ERR_CRC			1			///< CRC read error
 #define	DS18B20_ERR_READ		2			///< Generic read error
 
-#define	DS18B20_MAX			4
+#define	DS18B20_MAX			4			///< Maximum number of DS18B20 sensors.
 
 /**
  * @brief Structure for a temperature sensor.
@@ -56,8 +56,9 @@
 
 /**
  * @brief The FreeRTOS task to update the DS18B20 temperature sensors on request.
+ * @param pvParameters Parameters for the task.
  */
-void task_ds18b20(void *);
+void task_ds18b20(void *pvParameters);
 
 
 #endif
--- a/main/task_mqtt.c	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_mqtt.c	Fri Nov 29 14:26:37 2019 +0100
@@ -54,6 +54,10 @@
 
 
 
+/**
+ * @brief Generate the mqtt payload header.
+ * @return Allocated character string with the header.
+ */
 char *payload_header(void)
 {
     char        *tmp, buf[128];
@@ -71,6 +75,11 @@
 
 
 
+/**
+ * @brief Generate the mqtt topic base part.
+ * @param msgtype The message type part of the topic.
+ * @return The topic string allocated in memory.
+ */
 char *topic_base(char *msgtype)
 {
     char        *tmp;
@@ -84,6 +93,11 @@
 
 
 
+/**
+ * @brief The mqtt generic publish function.
+ * @param topic The topic of the mqtt message.
+ * @param payload The payload of the mqtt message.
+ */
 void publisher(char *topic, char *payload)
 {
     /*
@@ -104,6 +118,11 @@
 
 
 
+/**
+ * @brief Generate json data for the given unit.
+ * @param i The unit record number.
+ * @return The json string allocated in memory.
+ */
 char *unit_data(int i)
 {
     char	*payload = NULL;
--- a/main/task_mqtt.h	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_mqtt.h	Fri Nov 29 14:26:37 2019 +0100
@@ -42,8 +42,9 @@
 
 /**
  * @brief The FreeRTOS task to run MQTT connections.
+ * @param pvParameters Parameters for the task.
  */
-void task_mqtt(void *);
+void task_mqtt(void *pvParameters);
 
 
 #endif
--- a/main/task_user.c	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_user.c	Fri Nov 29 14:26:37 2019 +0100
@@ -50,6 +50,7 @@
 
 /**
  * @brief Seconds timer callback.
+ * @param arg Arguments for the timer.
  */
 void TimerCallback(void *arg);
 
@@ -298,7 +299,7 @@
 
 /**
  * @brief Clear the display and prepare the top of the display.
- * @format The formatted data to display at the top.
+ * @param format The formatted data to display at the top.
  */
 void screen_top(const char *format, ...)
 {
@@ -758,6 +759,7 @@
  * @param pos The new position, positive, negative or zero.
  * @param max The highest number. If already at the highest, select the lowest.
  * @param cursub The subscreen number by reference. This is updated with the new number.
+ * @param curoffset The offset in the list. This is updated with the new number.
  * @return Returns true if a new number is selected, false if nothing changed.
  */
 bool rotate_to_sub(rotary_encoder_position_t pos, int max, int *cursub, int *curoffset)
--- a/main/task_user.h	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_user.h	Fri Nov 29 14:26:37 2019 +0100
@@ -7,11 +7,11 @@
 #define	_TASK_USER_H
 
 
-#define PIN_SDA                 (CONFIG_I2C_MASTER_SDA)
-#define PIN_SCL                 (CONFIG_I2C_MASTER_SCL)
-#define ROT_ENC_A_GPIO          (CONFIG_ROT_ENC_A_GPIO)
-#define ROT_ENC_B_GPIO          (CONFIG_ROT_ENC_B_GPIO)
-#define ROT_ENC_SW_GPIO         (CONFIG_ROT_ENC_SW_GPIO)
+#define PIN_SDA                 (CONFIG_I2C_MASTER_SDA)			///< GPIO pin for I2C SDA
+#define PIN_SCL                 (CONFIG_I2C_MASTER_SCL)			///< GPIO pin for I2C SCL
+#define ROT_ENC_A_GPIO          (CONFIG_ROT_ENC_A_GPIO)			///< GPIO pin for rotary encoder A
+#define ROT_ENC_B_GPIO          (CONFIG_ROT_ENC_B_GPIO)			///< GPIO pin for rotary encoder B
+#define ROT_ENC_SW_GPIO         (CONFIG_ROT_ENC_SW_GPIO)		///< GPIO pin for rotary encoder pushbutton
 #define INACTIVITY              240                                     ///< User inactivity time
 
 #define EDIT_TYPE_TEXT          0                                       ///< Editor type is text, special chars and digits.
@@ -52,8 +52,9 @@
 
 /**
  * @brief The FreeRTOS task to run the user interface.
+ * @param pvParameters Parameters for the task.
  */
-void task_user(void *);
+void task_user(void *pvParameters);
 
 
 #endif
--- a/main/task_wifi.c	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_wifi.c	Fri Nov 29 14:26:37 2019 +0100
@@ -17,24 +17,19 @@
 wifi_config_t			*task_wifi_ConfigSTA = NULL;	///< Current STA configuration.
 WIFI_State			*wifi_state = NULL;		///< Public state for other tasks.
 
-wifi_scan_config_t scan_config = {				///< WiFi scanner configuration.
+wifi_scan_config_t scan_config = {
 	.ssid = 0,
 	.bssid = 0,
 	.channel = 0,
 	.show_hidden = false,
 	.scan_time.passive = 130				///< Beacons are usually sent every 100 mSec.
-};
+};								///< WiFi scanner configuration.
 
 uint8_t				_wifi_ssid[33];			///< Current SSID
 bool				_wifi_ScanAPs = false;		///< Scanning
 bool				_wifi_ScanDone = false;		///< Scan ready
 uint16_t			_wifi_Scanned = 0;		///< Total scanned APs.
 
-extern uint32_t			TimeSpent;			///< Counter that is increased each second.
-extern bool			System_TimeOk;
-extern time_t			now;
-extern char			strftime_buf[64];
-extern struct tm		timeinfo;
 
 const int TASK_WIFI_REQUEST_WIFI_SCAN = BIT0;			///< When set, means a client requested to scan wireless networks.
 const int TASK_WIFI_REQUEST_STA_DISCONNECT = BIT1;		///< When set, means a client requested to disconnect from currently connected AP.
@@ -50,13 +45,6 @@
 
 
 /**
- * @brief local callback function. Is called when the timesync is valid
- *        from a timeserver. Sets the global boolean System_TimeOk value. 
- * @param tv is the received time. Not used.
- */
-//void time_sync_notification_cb(struct timeval *tv);
-
-/**
  * @brief Array with AP security names
  */
 const char *apsec[] = { "Open", "WEP", "WPA", "WPA2", "WPA WPA2", "Enterprise" };
--- a/main/task_wifi.h	Tue Nov 26 11:55:46 2019 +0100
+++ b/main/task_wifi.h	Fri Nov 29 14:26:37 2019 +0100
@@ -48,8 +48,9 @@
 
 /**
  * @brief Main task for the wifi_manager
+ * @param pvParameters Parameters for the task.
  */
-void task_wifi(void *);
+void task_wifi(void *pvParameters);
 
 
 #endif

mercurial