18 Commits

Author SHA1 Message Date
4efa5ae797 Update 'Jenkinsfile' 2021-10-10 23:21:02 +02:00
5e90cd39fa Update 'Jenkinsfile' 2021-10-10 23:18:13 +02:00
015028bde2 Add build step to jenkinsfile 2021-10-10 23:12:22 +02:00
4e6e5db2c3 Fix bug in jenkinsfile 2021-10-10 23:03:58 +02:00
a2bcd37800 Edir configure step in jenkinsfile 2021-10-10 23:01:31 +02:00
ed936cf9f9 Add quotes to jenkinsfile 2021-10-10 22:58:26 +02:00
e595e398d4 jenkinsfile test 2021-10-10 22:56:00 +02:00
86446e1b22 jenkinsfile test 2021-10-10 22:54:47 +02:00
b26233d5e3 jenkinsfile test 2021-10-10 22:53:20 +02:00
0ab13edced jenkinsfile test 2021-10-10 22:49:53 +02:00
2bc2c0c670 Add example jenkins file 2021-10-10 22:38:58 +02:00
aad9be9905 Add doxygen to CMake and update the config 2021-10-10 22:09:46 +02:00
6f2b6e0839 Fix code in updater.c 2021-10-10 21:04:40 +02:00
45145c1f36 Clean up systick.c 2021-10-10 21:02:39 +02:00
1722ba7e5d Clean up shell.c 2021-10-10 21:00:28 +02:00
7a44a383ff Fix style in file 2021-10-10 20:49:42 +02:00
7a2c77a83e Fix style problems in main-cycle-counter 2021-10-10 20:47:15 +02:00
c8e3bf5de2 Fix style problems in main.c 2021-10-10 20:45:59 +02:00
11 changed files with 275 additions and 248 deletions

35
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,35 @@
pipeline {
agent any
stages {
stage('Configure') {
steps {
echo 'Configuring Cmake...'
sh '''
mkdir "build" &&
cd "build" &&
cmake "../stm-firmware"
'''
}
}
stage('Build') {
steps {
sh '''
cd "build" &&
make
'''
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
when { tag "*" }
steps {
echo 'Deploying tag...'
}
}
}
}

View File

@@ -77,6 +77,7 @@ add_compile_options(-mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -m
set(GIT_DESCRIBE "${GIT_DESCRIBE}")
add_definitions(-DBASE64_LOOKUP_TABLE_SECTION=\".ccm.bss\" -DSHELLMATTA_HELP_ALIAS=\"?\" -DGIT_VER=${GIT_DESCRIBE} -DHSE_VALUE=8000000UL -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4)
add_subdirectory(doxygen)
add_subdirectory(updater/ram-code)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

View File

@@ -0,0 +1,40 @@
find_package(Doxygen)
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColorReset "${Esc}[m")
set(ColorBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()
if (DOXYGEN_FOUND)
add_custom_target(documentation DEPENDS doxygen doxygen-pdf)
add_custom_target(doxygen
COMMAND ./build-doxygen.sh "${PROJECT_BINARY_DIR}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating documentation with Doxygen")
add_custom_target(
doxygen-pdf
COMMAND make
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/latex"
DEPENDS doxygen
)
else (DOXYGEN_FOUND)
message("${BoldMagenta}Doxygen needs to be installed to generate the doxygen documentation${ColorReset}")
message("${BoldMagenta}doxygen, documentation, doxygen-latex targets will not be available${ColorReset}")
endif (DOXYGEN_FOUND)

View File

@@ -1,4 +1,4 @@
# Doxyfile 1.9.1
# Doxyfile 1.9.2
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -93,14 +93,6 @@ ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all generated output in the proper direction.
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.
OUTPUT_TEXT_DIRECTION = None
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
@@ -258,16 +250,16 @@ TAB_SIZE = 8
# the documentation. An alias has the form:
# name=value
# For example adding
# "sideeffect=@par Side Effects:\n"
# "sideeffect=@par Side Effects:^^"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines (in the resulting output). You can put ^^ in the value part of an
# alias to insert a newline as if a physical newline was in the original file.
# When you need a literal { or } or , in the value part of an alias you have to
# escape them by means of a backslash (\), this can lead to conflicts with the
# commands \{ and \} for these it is advised to use the version @{ and @} or use
# a double escape (\\{ and \\})
# "Side Effects:". Note that you cannot put \n's in the value part of an alias
# to insert newlines (in the resulting output). You can put ^^ in the value part
# of an alias to insert a newline as if a physical newline was in the original
# file. When you need a literal { or } or , in the value part of an alias you
# have to escape them by means of a backslash (\), this can lead to conflicts
# with the commands \{ and \} for these it is advised to use the version @{ and
# @} or use a double escape (\\{ and \\})
ALIASES =
@@ -312,8 +304,8 @@ OPTIMIZE_OUTPUT_SLICE = NO
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files). For instance to make doxygen treat .inc files
@@ -466,7 +458,7 @@ LOOKUP_CACHE_SIZE = 0
# than 0 to get more control over the balance between CPU load and processing
# speed. At this moment only the input processing can be done using multiple
# threads. Since this is still an experimental feature the default is set to 1,
# which efficively disables parallel processing. Please report any issues you
# which effectively disables parallel processing. Please report any issues you
# encounter. Generating dot graphs in parallel is controlled by the
# DOT_NUM_THREADS setting.
# Minimum value: 0, maximum value: 32, default value: 1.
@@ -610,6 +602,12 @@ HIDE_SCOPE_NAMES = YES
HIDE_COMPOUND_REFERENCE= NO
# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
# will show which file needs to be included to use the class.
# The default value is: YES.
SHOW_HEADERFILE = YES
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
@@ -767,7 +765,8 @@ FILE_VERSION_FILTER =
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
# will be used as the name of the layout file.
# will be used as the name of the layout file. See also section "Changing the
# layout of pages" for information.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
@@ -813,18 +812,26 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some parameters
# in a documented function, or documenting parameters that don't exist or using
# markup commands wrongly.
# potential errors in the documentation, such as documenting some parameters in
# a documented function twice, or documenting parameters that don't exist or
# using markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
# function parameter documentation. If set to NO, doxygen will accept that some
# parameters have no documentation without warning.
# The default value is: YES.
WARN_IF_INCOMPLETE_DOC = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO, doxygen will only warn about wrong or incomplete
# parameter documentation, but not about the absence of documentation. If
# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
# value. If set to NO, doxygen will only warn about wrong parameter
# documentation, but not about the absence of documentation. If EXTRACT_ALL is
# set to YES then this flag will automatically be disabled. See also
# WARN_IF_INCOMPLETE_DOC
# The default value is: NO.
WARN_NO_PARAMDOC = NO
@@ -888,10 +895,10 @@ INPUT_ENCODING = UTF-8
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
# *.ucf, *.qsf and *.ice.
# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.c \
*.cc \
@@ -1268,7 +1275,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# this color. Hue is specified as an angle on a color-wheel, see
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
@@ -1278,7 +1285,7 @@ HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A
# in the HTML output. For a value of 0 the output will use gray-scales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1385,8 +1392,12 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see:
# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
# on Windows. In the beginning of 2021 Microsoft took the original page, with
# a.o. the download links, offline the HTML help workshop was already many years
# in maintenance mode). You can download the HTML help workshop from the web
# archives at Installation executable (see:
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
@@ -1545,16 +1556,28 @@ DISABLE_INDEX = NO
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
# further fine-tune the look of the index. As an example, the default style
# sheet generated by doxygen has an example that shows how to put an image at
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
# the same information as the tab index, you could consider setting
# DISABLE_INDEX to YES when enabling this option.
# further fine tune the look of the index (see "Fine-tuning the output"). As an
# example, the default style sheet generated by doxygen has an example that
# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
# Since the tree basically has the same information as the tab index, you could
# consider setting DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = NO
# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
# area (value NO) or if it should extend to the full height of the window (value
# YES). Setting this to YES gives a layout similar to
# https://docs.readthedocs.io with more room for contents, but less room for the
# project logo, title, and description. If either GENERATOR_TREEVIEW or
# DISABLE_INDEX is set to NO, this option has no effect.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
FULL_SIDEBAR = NO
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
@@ -1627,11 +1650,29 @@ FORMULA_MACROFILE =
USE_MATHJAX = YES
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
# Note that the different versions of MathJax have different requirements with
# regards to the different settings, so it is possible that also other MathJax
# settings have to be changed when switching between the different MathJax
# versions.
# Possible values are: MathJax_2 and MathJax_3.
# The default value is: MathJax_2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_VERSION = MathJax_2
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
# the MathJax output. For more details about the output format see MathJax
# version 2 (see:
# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
# (see:
# http://docs.mathjax.org/en/latest/web/components/output.html).
# Possible values are: HTML-CSS (which is slower, but has the best
# compatibility), NativeMML (i.e. MathML) and SVG.
# compatibility. This is the name for Mathjax version 2, for MathJax version 3
# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
# is the name for Mathjax version 3, for MathJax version 2 this will be
# translated into HTML-CSS) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
@@ -1644,15 +1685,21 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
# MathJax from https://www.mathjax.org before deployment. The default value is:
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
# for MathJax version 2 (see
# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# For example for MathJax version 3 (see
# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
# MATHJAX_EXTENSIONS = ams
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_EXTENSIONS =
@@ -1761,7 +1808,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = NO
GENERATE_LATEX = YES
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -1832,29 +1879,31 @@ PAPER_TYPE = a4
EXTRA_PACKAGES = amsmath
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
# chapter. If it is left blank doxygen will generate a standard header. See
# section "Doxygen usage" for information on how to let doxygen write the
# default header to a separate file.
# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
# the generated LaTeX document. The header should contain everything until the
# first chapter. If it is left blank doxygen will generate a standard header. It
# is highly recommended to start with a default header using
# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
# and then modify the file new_header.tex. See also section "Doxygen usage" for
# information on how to generate the default header that doxygen normally uses.
#
# Note: Only use a user-defined header if you know what you are doing! The
# following commands have a special meaning inside the header: $title,
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
# string, for the replacement values of the other commands the user is referred
# to HTML_HEADER.
# Note: Only use a user-defined header if you know what you are doing!
# Note: The header is subject to change so you typically have to regenerate the
# default header when upgrading to a newer version of doxygen. The following
# commands have a special meaning inside the header (and footer): For a
# description of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
# generated LaTeX document. The footer should contain everything after the last
# chapter. If it is left blank doxygen will generate a standard footer. See
# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for
# the generated LaTeX document. The footer should contain everything after the
# last chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
# special commands can be used inside the footer.
#
# Note: Only use a user-defined footer if you know what you are doing!
# special commands can be used inside the footer. See also section "Doxygen
# usage" for information on how to generate the default footer that doxygen
# normally uses. Note: Only use a user-defined footer if you know what you are
# doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER =
@@ -1899,8 +1948,7 @@ USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
# if errors occur, instead of asking the user for help. This option is also used
# when generating formulas in HTML.
# if errors occur, instead of asking the user for help.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1913,16 +1961,6 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = YES
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
@@ -2003,16 +2041,6 @@ RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@@ -2109,15 +2137,6 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@@ -2625,8 +2644,8 @@ GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
# files that are used to generate the various graphs.
#
# Note: This setting is not only used for dot files but also for msc and
# plantuml temporary files.
# Note: This setting is not only used for dot files but also for msc temporary
# files.
# The default value is: YES.
DOT_CLEANUP = YES

View File

@@ -74,7 +74,7 @@ void systick_wait_ms(uint32_t ms);
* @warning Use this with care in interrupts. It may lead to race conditions. It is generally safe for use in standard program flow though.
* @return Global millisecond tick.
*/
uint64_t systick_get_global_tick();
uint64_t systick_get_global_tick(void);
/**
* @brief Calculate the uptime from the current millisecond tick.

View File

@@ -1,39 +1,39 @@
/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <reflow-controller/main-cycle-counter.h>
#include <helper-macros/helper-macros.h>
static uint64_t IN_SECTION(.ccm.bss) main_cycle_counter;
void main_cycle_counter_init()
void main_cycle_counter_init(void)
{
main_cycle_counter = 0ULL;
}
void main_cycle_counter_inc()
void main_cycle_counter_inc(void)
{
main_cycle_counter++;
}
uint64_t main_cycle_counter_get()
uint64_t main_cycle_counter_get(void)
{
return main_cycle_counter;
}

View File

@@ -140,10 +140,10 @@ static bool mount_sd_card_if_avail(bool mounted)
if (res == FR_OK) {
led_set(1, 1);
return true;
}
else
} else {
return false;
}
}
return mounted;
}
@@ -202,9 +202,8 @@ static inline void setup_system(void)
settings_setup();
/* Load the overtemperature limit from eeprom if available. Otherwise the default value will be used */
if (settings_load_overtemp_limit(&tmp) == SETT_LOAD_SUCCESS) {
if (settings_load_overtemp_limit(&tmp) == SETT_LOAD_SUCCESS)
safety_controller_set_overtemp_limit(tmp);
}
handle_boot_status();
@@ -241,9 +240,8 @@ int main(void)
/* Try load the calibration. This will only succeed if there's an EEPROM */
status = settings_load_calibration(&sens, &offset);
if (!status) {
if (!status)
adc_pt1000_set_resistance_calibration(offset, sens, true);
}
shell_handle = shell_init(write_shell_callback);
shell_print_motd(shell_handle);
@@ -261,11 +259,10 @@ int main(void)
adc_pt1000_get_resistance_calibration(NULL, NULL, &cal_active);
if (!cal_active) {
status = settings_load_calibration(&sens, &offset);
if (!status) {
if (!status)
adc_pt1000_set_resistance_calibration(offset, sens, true);
}
}
}
quarter_sec_timestamp = systick_get_global_tick();
}
@@ -277,9 +274,9 @@ int main(void)
temp_profile_executer_handle();
safety_controller_handle();
if (oven_pid_get_status() == OVEN_PID_RUNNING) {
if (oven_pid_get_status() == OVEN_PID_RUNNING)
oven_pid_handle();
}
oven_driver_apply_power_level();
safety_controller_report_timing(ERR_TIMING_MAIN_LOOP);

View File

@@ -89,7 +89,8 @@ float pid_sample(struct pid_controller *pid, float deviation)
}
/* Calculate derivative part */
pid->derivate = pid->k_deriv_t * (deviation - pid->last_in) + pid->k_inv_deriv_t * pid->derivate;
pid->derivate = pid->k_deriv_t * (deviation - pid->last_in) +
pid->k_inv_deriv_t * pid->derivate;
output += pid->derivate;
output += pid->integral;

View File

@@ -51,7 +51,6 @@
#define GIT_VER "VERSION NOT SET"
#endif
extern struct stm_uart shell_uart;
static shellmatta_instance_t shell;
static char shell_buffer[512];
static char IN_SECTION(.ccm.bss) history_buffer[512];
@@ -163,13 +162,12 @@ static shellmatta_retCode_t shell_cmd_pt1000_res(const shellmatta_handle_t han
pt1000_status = adc_pt1000_get_current_resistance(&resistance);
if (pt1000_status == 2) {
if (pt1000_status == 2)
strcat(display_status, "UNSTABLE");
} else if (pt1000_status) {
else if (pt1000_status)
strcpy(display_status, "ERROR");
} else {
else
strcpy(display_status, "VALID");
}
temp_conv_status = temp_converter_convert_resistance_to_temp(resistance, &temp);
switch (temp_conv_status) {
@@ -186,7 +184,8 @@ static shellmatta_retCode_t shell_cmd_pt1000_res(const shellmatta_handle_t han
break;
}
shellmatta_printf(handle, "PT1000 resistance: %.2f Ohm (%s%.1f °C) [%s]\r\n", resistance, temp_prefix,temp, display_status);
shellmatta_printf(handle, "PT1000 resistance: %.2f Ohm (%s%.1f °C) [%s]\r\n",
resistance, temp_prefix, temp, display_status);
return SHELLMATTA_OK;
}
@@ -342,9 +341,8 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl
do {
opt_ret = shellmatta_opt_long(handle, options, &option, &argument, &len);
if (opt_ret != SHELLMATTA_OK) {
if (opt_ret != SHELLMATTA_OK)
break;
}
switch (option) {
case 'a':
@@ -353,7 +351,7 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl
default:
break;
}
} while(1);
} while (1);
@@ -377,7 +375,11 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl
if (tryack)
safety_controller_ack_flag(flag_enum);
shellmatta_printf(handle, "\t%2lu) %-20s\t[%s]\r\n", i+1, name, (flag ? "\e[1;31mERR\e[m" : "\e[32mOK\e[m"));
shellmatta_printf(handle,
"\t%2lu) %-20s\t[%s]\r\n",
i+1,
name,
(flag ? "\e[1;31mERR\e[m" : "\e[32mOK\e[m"));
}
shellmatta_printf(handle, "\r\nAnalog Monitors\r\n"
@@ -421,7 +423,7 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl
shellmatta_printf(handle, "\t%2lu) %-20s\t", i+1, name);
if (timing_info.enabled)
shellmatta_printf(handle, "last tick: %lu ms\r\n", (unsigned long int)timing_info.delta);
shellmatta_printf(handle, "last tick: %lu ms\r\n", (unsigned long)timing_info.delta);
else
shellmatta_printf(handle, "\e[1;31mDISABLED\e[m\r\n");
}
@@ -442,11 +444,10 @@ static shellmatta_retCode_t shell_cmd_save_cal(const shellmatta_handle_t handle,
adc_pt1000_get_resistance_calibration(&offset, &sens_dev, &active);
res = settings_save_calibration(sens_dev, offset, active);
if (res) {
if (res)
shellmatta_printf(handle, "Error saving %d\r\n", res);
} else {
else
shellmatta_printf(handle, "Saved!\r\n");
}
return SHELLMATTA_OK;
}
@@ -458,7 +459,8 @@ static shellmatta_retCode_t shell_cmd_hang(const shellmatta_handle_t handle, con
(void)arguments;
(void)length;
while (1337);
while (1337)
;
return SHELLMATTA_OK;
}
@@ -577,9 +579,9 @@ static shellmatta_retCode_t shell_cmd_dump_safety_mem(const shellmatta_handle_t
}
fres = f_write(&file, buffer, used_bytes - 1, &bw);
if (fres != FR_OK) {
if (fres != FR_OK)
shellmatta_printf(handle, "Error writing to file %s\r\n", token);
}
free(buffer);
f_close(&file);
return SHELLMATTA_OK;
@@ -777,9 +779,9 @@ shellmatta_retCode_t shell_cmd_execute(const shellmatta_handle_t handle, const c
if (state->status != TPE_RUNNING) {
shellmatta_printf(handle, "Profile executed.\r\n");
running = false;
if(state->status == TPE_ABORT) {
if (state->status == TPE_ABORT)
shellmatta_printf(handle, "Profile execution aborted!\r\n");
}
return SHELLMATTA_OK;
}
@@ -875,81 +877,6 @@ shellmatta_retCode_t shell_cmd_filter_alpha(const shellmatta_handle_t handle, co
return SHELLMATTA_OK;
}
#if 0
shellmatta_retCode_t shell_cmd_hf_stream(const shellmatta_handle_t handle, const char *args, uint32_t len)
{
float *data1;
volatile int flag;
FRESULT fres;
char *strbuff;
FIL f;
const size_t buff_size = 2000UL;
uint32_t idx;
uint32_t blocks;
uint32_t remainder;
int cnt;
UINT bw;
data1 = (float *)malloc(buff_size*sizeof(float));
strbuff = (char *)malloc(1024);
if (!data1 || !strbuff) {
shellmatta_printf(handle, "Allocating memory failed!\r\n");
goto free_data;
}
fres = f_open(&f, "pt1000_hf.dat", FA_CREATE_ALWAYS | FA_WRITE);
if (fres != FR_OK) {
shellmatta_printf(handle, "Cannot open file.\r\n");
goto free_data;
}
shellmatta_printf(handle, "Acquire data...\r\n");
flag = 0;
adc_pt1000_stream_raw_value_to_memory(data1, buff_size, &flag);
while (!flag) {
safety_controller_handle();
}
shellmatta_printf(handle, "Finished. Writing file...\r\n");
blocks = buff_size / 10UL;
remainder = buff_size % 10UL;
for (idx = 0; idx < blocks; idx++) {
cnt = snprintf(strbuff, 1024, "%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n%.2f\n",
data1[idx * 10+0],
data1[idx * 10+1],
data1[idx * 10+2],
data1[idx * 10+3],
data1[idx * 10+4],
data1[idx * 10+5],
data1[idx * 10+6],
data1[idx * 10+7],
data1[idx * 10+8],
data1[idx * 10+9]);
f_write(&f, strbuff, (UINT)cnt, &bw);
safety_controller_handle();
}
for (idx = 0; idx < remainder; idx++) {
cnt = snprintf(strbuff, 1024, "%.2f\n", data1[blocks * 10 + idx]);
f_write(&f, strbuff, (UINT)cnt, &bw);
}
f_close(&f);
shellmatta_printf(handle, "Completed!\r\n");
free_data:
if (data1)
free(data1);
if (strbuff)
free(strbuff);
return SHELLMATTA_OK;
}
#endif
//typedef struct shellmatta_cmd
//{
// char *cmd; /**< command name */
@@ -1152,8 +1079,15 @@ shellmatta_handle_t shell_init(shellmatta_write_t write_func)
shellmatta_handle_t handle;
shellmatta_retCode_t ret;
ret = shellmatta_doInit(&shell, &handle, shell_buffer, sizeof(shell_buffer), history_buffer, sizeof(history_buffer),
"\e[1;32mReflow Controller>\e[m ", cmd, write_func);
ret = shellmatta_doInit(&shell,
&handle,
shell_buffer,
sizeof(shell_buffer),
history_buffer,
sizeof(history_buffer),
"\e[1;32mReflow Controller>\e[m ",
cmd,
write_func);
if (ret != SHELLMATTA_OK)
handle = NULL;

View File

@@ -40,10 +40,11 @@ void systick_setup(void)
void systick_wait_ms(uint32_t ms)
{
wait_tick_ms = 0UL;
while (wait_tick_ms < ms);
while (wait_tick_ms < ms)
;
}
uint64_t systick_get_global_tick()
uint64_t systick_get_global_tick(void)
{
uint64_t temp;
@@ -62,7 +63,6 @@ void systick_get_uptime_from_tick(uint32_t *days, uint32_t *hours, uint32_t *min
uint32_t hs;
uint32_t ds;
tick_secs = systick_get_global_tick() / 1000;
secs = tick_secs % 60;
tick_secs /= 60;
@@ -111,7 +111,7 @@ bool __attribute__((optimize("O3"))) systick_ticks_have_passed(uint64_t start_ti
*
* @warning For calling cyclic functions use separate timers/flags and don't spoil this function
*/
void __attribute__((optimize("O3"))) SysTick_Handler()
void __attribute__((optimize("O3"))) SysTick_Handler(void)
{
static uint32_t IN_SECTION(.ccm.bss) pre_tick = 0UL;

View File

@@ -1,22 +1,22 @@
/* Reflow Oven Controller
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
*
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of the Reflow Oven Controller Project.
*
* The reflow oven controller is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the reflow oven controller project.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <reflow-controller/updater/updater.h>
#include <reflow-controller/safety/safety-memory.h>