diff -r b74b0e4902c3 -r ad2c8b13eb88 main/recipes.c --- a/main/recipes.c Sat Oct 20 13:23:15 2018 +0200 +++ b/main/recipes.c Sat Oct 20 17:09:48 2018 +0200 @@ -6,32 +6,38 @@ #include "config.h" -extern sButton Buttons[MAXBUTTONS]; -extern int Main_Screen; +extern sButton Buttons[MAXBUTTONS]; ///< Buttons definitions +extern int Main_Screen; ///< Current screen -bool r_UpdateRec = false; -int r_CurrentRec = 1; -int r_Records = 1; -int r_Imported = 0; -char _xml_element[10][32]; -int _xml_depth; -int _xml_mashsteps; -char _xml_add_name[64]; -int _xml_add_type; -int _xml_add_time; -int _xml_add_ramp; -float _xml_add_temp; -float _xml_tun_temp; -bool _xml_add_valid; +bool r_UpdateRec = false; ///< Update record flag +int r_CurrentRec = 1; ///< Current record +int r_Records = 1; ///< Total records +int r_Imported = 0; ///< Total imported +char _xml_element[10][32]; ///< XML element array +int _xml_depth; ///< Current depths +int _xml_mashsteps; ///< Mash steps +char _xml_add_name[64]; ///< Mash name +int _xml_add_type; ///< Mash type +int _xml_add_time; ///< Mash rest time +int _xml_add_ramp; ///< Mash ramp time +float _xml_add_temp; ///< Mash temperature +float _xml_tun_temp; ///< TUN temperature +bool _xml_add_valid; ///< Add is valid static const char *TAG = "recipes"; -char char_data_buffer[1024]; -size_t offs; -bool overflow; +char char_data_buffer[1024]; ///< Data buffer +size_t offs; ///< Offset in buffer +bool overflow; ///< Overflow in buffer +/** + * @brief Add addition to the recipe. + * @param Name The addition name. + * @param Type The addition type. + * @param Time The addition time to add. + */ void Addition_Add(char *Name, uint8_t Type, uint16_t Time) { printf("Addition_Add(%s, %d, %d)\n", Name, Type, Time); @@ -80,6 +86,9 @@ +/** + * @brief Reset the parser buffer. + */ void reset_char_data_buffer (void) { offs = 0; @@ -88,7 +97,10 @@ -void char_data (void *userData, const XML_Char *s, int len) +/** + * @brief Datahandler get bytes into the data buffer. + */ +void char_data(void *userData, const XML_Char *s, int len) { if (!overflow) { if (len + offs >= sizeof(char_data_buffer) ) { @@ -101,7 +113,9 @@ } - +/** + * @brief Process the XML parser data buffer. + */ void process_char_data_buffer (void) { bool allspace = true; @@ -215,6 +229,12 @@ +/** + * @brief Start new XML element. + * @param userData + * @param name XML element name + * @param attr XML element attribute + */ void startElement(void *userData, const char *name, const char **attr) { sprintf(_xml_element[_xml_depth], "%s", name); @@ -225,6 +245,11 @@ +/** + * @brief End XML element + * @param userData + * @param name XML element name + */ void endElement(void *userData, const char *name) { process_char_data_buffer(); @@ -325,6 +350,7 @@ } } +#if 0 printf("Recipe: %s\n", recipe.Name); printf("Code : %s\n", recipe.Code); printf("Boil time %d minutes\n", recipe.BoilTime); @@ -352,6 +378,7 @@ if (recipe.Whirlpool2) printf("Whirlpool2 %d\n", recipe.Whirlpool2); printf("SpargeTemp %5.2f\n", recipe.SpargeTemp); +#endif return 0; }