Clean up power calls
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "BSP_Flash.h"
|
#include "BSP_Flash.h"
|
||||||
|
#include "BSP_Power.h"
|
||||||
#include "BSP_QC.h"
|
#include "BSP_QC.h"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
#include "UnitSettings.h"
|
#include "UnitSettings.h"
|
||||||
|
|||||||
27
workspace/TS100/Core/BSP/BSP_Power.h
Normal file
27
workspace/TS100/Core/BSP/BSP_Power.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "stdint.h"
|
||||||
|
/*
|
||||||
|
* BSP_Power.h -- Board Support for Power control
|
||||||
|
*
|
||||||
|
* These functions are hooks used to allow for power control
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BSP_POWER_H_
|
||||||
|
#define BSP_POWER_H_
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Called once at startup, after RToS
|
||||||
|
// This can handle negotiations for QC/PD etc
|
||||||
|
void power_probe();
|
||||||
|
|
||||||
|
// Called periodically in the movement handling thread
|
||||||
|
// Can be used to check any details for the power system
|
||||||
|
void power_check();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
20
workspace/TS100/Core/BSP/Miniware/Power.cpp
Normal file
20
workspace/TS100/Core/BSP/Miniware/Power.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include "BSP.h"
|
||||||
|
#include "BSP_Power.h"
|
||||||
|
#include "QC3.h"
|
||||||
|
void power_probe() {
|
||||||
|
// If TS80 probe for QC
|
||||||
|
// If TS100 - noop
|
||||||
|
#ifdef MODEL_TS80
|
||||||
|
startQC(systemSettings.voltageDiv);
|
||||||
|
|
||||||
|
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
|
||||||
|
systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void power_check() {
|
||||||
|
#ifdef MODEL_TS80
|
||||||
|
QC_resync();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -9,15 +9,5 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
void postRToSInit() {
|
void postRToSInit() {
|
||||||
#ifdef MODEL_TS80
|
// Any after RTos setup
|
||||||
startQC(systemSettings.voltageDiv);
|
|
||||||
while (pidTaskNotification == 0) osDelay(30); // Wait for PID to start
|
|
||||||
|
|
||||||
seekQC((systemSettings.cutoutSetting) ? 120 : 90,
|
|
||||||
systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with
|
|
||||||
|
|
||||||
#else
|
|
||||||
while (pidTaskNotification == 0) osDelay(30); // Wait for PID to start
|
|
||||||
osDelay(200); // wait for accelerometer to stabilize
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ uint32_t lastMovementTime = 0;
|
|||||||
void startMOVTask(void const *argument __unused) {
|
void startMOVTask(void const *argument __unused) {
|
||||||
OLED::setRotation(true);
|
OLED::setRotation(true);
|
||||||
postRToSInit();
|
postRToSInit();
|
||||||
|
power_probe();
|
||||||
|
while (pidTaskNotification == 0) osDelay(30); // Wait for PID to start
|
||||||
|
|
||||||
OLED::setRotation(systemSettings.OrientationMode & 1);
|
OLED::setRotation(systemSettings.OrientationMode & 1);
|
||||||
lastMovementTime = 0;
|
lastMovementTime = 0;
|
||||||
@@ -86,6 +88,6 @@ void startMOVTask(void const *argument __unused) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
osDelay(100); // Slow down update rate
|
osDelay(100); // Slow down update rate
|
||||||
QC_resync();
|
power_check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user