aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2017-09-26 19:43:52 +1000
committerBen V. Brown <[email protected]>2017-09-26 19:43:52 +1000
commitfb08e8b56c23e928edad2306a51a155f6149577d (patch)
treeeec9eef34c112210173be78928b03180479f03e9
parentd726734792040a4b3dc402760af742956a468273 (diff)
downloadIronOS-fb08e8b56c23e928edad2306a51a155f6149577d.tar.gz
IronOS-fb08e8b56c23e928edad2306a51a155f6149577d.zip
Tune timer and PID rates
-rw-r--r--workspace/TS100/inc/FreeRTOSConfig.h2
-rw-r--r--workspace/TS100/src/Setup.c7
-rw-r--r--workspace/TS100/src/Translation.c9
-rw-r--r--workspace/TS100/src/main.cpp2
-rw-r--r--workspace/ts100/.cproject2
5 files changed, 14 insertions, 8 deletions
diff --git a/workspace/TS100/inc/FreeRTOSConfig.h b/workspace/TS100/inc/FreeRTOSConfig.h
index fc482351..3fa00f06 100644
--- a/workspace/TS100/inc/FreeRTOSConfig.h
+++ b/workspace/TS100/inc/FreeRTOSConfig.h
@@ -92,7 +92,7 @@
extern uint32_t SystemCoreClock;
#endif
-#define configUSE_PREEMPTION 0
+#define configUSE_PREEMPTION 1
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configUSE_IDLE_HOOK 0
diff --git a/workspace/TS100/src/Setup.c b/workspace/TS100/src/Setup.c
index 6e4fc784..3b5d41d5 100644
--- a/workspace/TS100/src/Setup.c
+++ b/workspace/TS100/src/Setup.c
@@ -29,7 +29,7 @@ static void MX_DMA_Init(void);
static void MX_GPIO_Init(void);
void Setup_HAL() {
-
+ SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_I2C1_Init();
@@ -130,7 +130,7 @@ static void MX_ADC1_Init(void) {
sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
sConfigInjected.InjectedRank = 1;
sConfigInjected.InjectedNbrOfConversion = 4;
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_71CYCLES_5;
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_55CYCLES_5;
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
sConfigInjected.AutoInjectedConv = DISABLE;
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
@@ -139,7 +139,6 @@ static void MX_ADC1_Init(void) {
sConfigInjected.InjectedRank = 2;
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
sConfigInjected.InjectedRank = 3;
- sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_55CYCLES_5;
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
sConfigInjected.InjectedRank = 4;
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
@@ -233,7 +232,7 @@ static void MX_TIM2_Init(void) {
//Timer 2 is fairly slow as its being used to run the PWM and trigger the ADC in the PWM off time.
htim2.Instance = TIM2;
- htim2.Init.Prescaler = 2000;
+ htim2.Init.Prescaler = 1500;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 120;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; //2mhz
diff --git a/workspace/TS100/src/Translation.c b/workspace/TS100/src/Translation.c
index ffb186ca..3295bdee 100644
--- a/workspace/TS100/src/Translation.c
+++ b/workspace/TS100/src/Translation.c
@@ -5,10 +5,16 @@
* Author: Ben V. Brown
*/
+
+#ifndef LANG_EN
+#define LANG_EN
+#endif
+
+#ifdef LANG_EN
const char* SettingsLongNames[12] =
{
/*These are all the help text for all the settings.*/
- /*All must start with 6 spaces so they come on screen nicely.*/
+ /*No requirements on spacing or length*/
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
"Sleep Temperature <C>",
"Sleep Timeout <Minutes>",
@@ -37,3 +43,4 @@ const char* SettingsShortNames[12] = {
"CLBLNK ",
"RESET? "
};
+#endif
diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp
index c7ebfdd3..ed7ab0a9 100644
--- a/workspace/TS100/src/main.cpp
+++ b/workspace/TS100/src/main.cpp
@@ -716,7 +716,7 @@ void startPIDTask(void const * argument) {
}
derivativeLastValue = rawTemp; //store for next loop
HAL_IWDG_Refresh(&hiwdg);
- osDelay(10); // 100 Hz temp loop
+ osDelay(100); // 10 Hz temp loop
}
}
#define MOVFilter 4
diff --git a/workspace/ts100/.cproject b/workspace/ts100/.cproject
index 7197dca0..83c86dfa 100644
--- a/workspace/ts100/.cproject
+++ b/workspace/ts100/.cproject
@@ -121,7 +121,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot;">
+ <configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot; ;arm-none-eabi-objcopy -O ihex &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.hex&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.1456567544" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.67332574" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F103T8Ux" valueType="string"/>