improved events, allowed all modes, removed debug output
This commit is contained in:
@ -11,7 +11,6 @@ ReturnValue_t PowerController::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
sif::debug << "Rush B, no stop" << std::endl;
|
||||
return ExtendedControllerBase::initialize();
|
||||
}
|
||||
|
||||
@ -92,7 +91,6 @@ void PowerController::performControlOperation() {
|
||||
}
|
||||
case InternalState::READY: {
|
||||
if (mode != MODE_OFF) {
|
||||
sif::debug << "oh shit, now i gotta do something" << std::endl;
|
||||
calculateStateOfCharge();
|
||||
if (mode == MODE_NORMAL) {
|
||||
watchStateOfCharge();
|
||||
@ -127,7 +125,7 @@ LocalPoolDataSetBase *PowerController::getDataSetHandle(sid_t sid) {
|
||||
|
||||
ReturnValue_t PowerController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
if (mode == MODE_OFF) {
|
||||
if (mode == MODE_OFF or mode == MODE_ON or mode == MODE_NORMAL) {
|
||||
if (submode == SUBMODE_NONE) {
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
@ -251,8 +249,9 @@ ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
|
||||
ReturnValue_t PowerController::calculateCoulombCounterCharge() {
|
||||
double timeDiff = timevalOperations::toDouble(now - oldTime);
|
||||
if (timeDiff > maxAllowedTimeDiff) {
|
||||
triggerEvent(power::TIMEDELTA_OUT_OF_BOUNDS);
|
||||
sif::error << "Power Controller::Time delta too large for Coulomb Counter" << std::endl;
|
||||
triggerEvent(power::TIMEDELTA_OUT_OF_BOUNDS, static_cast<uint32_t>(timeDiff * 10));
|
||||
sif::error << "Power Controller::Time delta too large for Coulomb Counter: " << timeDiff
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
if (not pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
|
||||
@ -298,12 +297,12 @@ float PowerController::linearInterpolation(float x, float x0, float x1, float y0
|
||||
|
||||
ReturnValue_t PowerController::lookUpTableOcvIdxFinder(float voltage, uint8_t &idx) {
|
||||
if (voltage >= lookUpTableOcv[1][99]) {
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 0);
|
||||
sif::error << "Power Controller::Voltage is too high" << std::endl;
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 0, static_cast<uint32_t>(voltage * 10));
|
||||
sif::error << "Power Controller::Voltage is too high: " << voltage << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
} else if (voltage <= lookUpTableOcv[1][0]) {
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 1);
|
||||
sif::error << "Power Controller::Voltage is too low" << std::endl;
|
||||
triggerEvent(power::VOLTAGE_OUT_OF_BOUNDS, 1, static_cast<uint32_t>(voltage * 10));
|
||||
sif::error << "Power Controller::Voltage is too low: " << voltage << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
while (lookUpTableOcv[1][idx] > voltage) {
|
||||
|
Reference in New Issue
Block a user