/** @param apc_ident pointer to the variable of the responsible member instance. If NULL the module cannot send requests! @param at_identMode either IsoAgLib::IdentModeImplement or IsoAgLib::IdentModeTractor @return true -> configuration was successfull */ bool TracPTO_c::config_base ( IdentItem_c* apc_ident, IsoAgLib::IdentMode_t at_identMode, uint16_t aui16_suppressMask) { //store old mode to decide to register or unregister from request for pgn //and set Periode for Scheduler_c IsoAgLib::IdentMode_t t_oldMode = getMode(); //call config for handling which is base data independent //if something went wrong leave function before something is configured if ( ! BaseCommon_c::config_base ( apc_ident, at_identMode, aui16_suppressMask) ) return false; ///Set time Period for Scheduler_c if (at_identMode == IsoAgLib::IdentModeTractor) mt_task.setPeriod( 100, false ); else mt_task.setPeriod( CONFIG_TIMEOUT_TRACTOR_DATA, false ); // set the member base msg value vars to NO_VAL codes mt_ptoFront.ui16_pto8DigitPerRpm = mt_ptoRear.ui16_pto8DigitPerRpm = NO_VAL_16; // set the timestamps to 0 mt_ptoFront.i32_lastPto = mt_ptoRear.i32_lastPto = 0; // un-/register to PGN if (t_oldMode == at_identMode) ; // no change, still the same mode else if (at_identMode == IsoAgLib::IdentModeTractor) { // a change from Implement mode to Tractor mode occured RegisterPgn_s s_register = getRegisterPgn(); s_register(FRONT_PTO_STATE_PGN); s_register(REAR_PTO_STATE_PGN); } else { // a change from Tractor mode to Implement mode occured UnregisterPgn_s s_unregister = getUnregisterPgn(); s_unregister(FRONT_PTO_STATE_PGN); s_unregister(REAR_PTO_STATE_PGN); } mt_ptoFront.t_ptoEngaged = mt_ptoRear.t_ptoEngaged = mt_ptoFront.t_pto1000 = mt_ptoRear.t_pto1000 = mt_ptoFront.t_ptoEconomy = mt_ptoRear.t_ptoEconomy = IsoAgLib::IsoNotAvailable; // mark as not available mt_ptoFront.ui16_ptoSetPoint8DigitPerRpm = 0; mt_ptoRear.ui16_ptoSetPoint8DigitPerRpm = 0; mt_ptoFront.t_ptoEngagementReqStatus = mt_ptoRear.t_ptoEngagementReqStatus = mt_ptoFront.t_ptoModeReqStatus = mt_ptoRear.t_ptoModeReqStatus = mt_ptoFront.t_ptoEconomyModeReqStatus = mt_ptoRear.t_ptoEconomyModeReqStatus = IsoAgLib::IsoNotAvailableReq; mt_ptoFront.t_ptoShaftSpeedLimitStatus = mt_ptoRear.t_ptoShaftSpeedLimitStatus = IsoAgLib::IsoNotAvailableLimit; return true; };
bool TracAux_c::config_base ( const IdentItem_c* apc_ident, IsoAgLib::IdentMode_t at_identMode, uint16_t aui16_suppressMask ) { //store old mode to decide to register or unregister to request for pgn IsoAgLib::IdentMode_t t_oldMode = getMode(); //call config for handling which is base data independent //if something went wrong leave function before something is configured if ( ! BaseCommon_c::config_base ( apc_ident, at_identMode, aui16_suppressMask ) ) return false; if ( at_identMode == IsoAgLib::IdentModeImplement ) { // set Time Period in ms for Scheduler_c mt_task.setPeriod( 100, false ); } else { //IdentModeTractor // set Time Period in ms for Scheduler_c mt_task.setPeriod( 1000, false ); } // un-/register to PGN if (t_oldMode == at_identMode) ; // no change, still the same mode else if (at_identMode == IsoAgLib::IdentModeTractor) { // a change from Implement mode to Tractor mode occured RegisterPgn_s s_register = getRegisterPgn(); s_register(AUX_VALVE_0_ESTIMATED_FLOW, gcui32_pgnMask16consecutive); s_register(AUX_VALVE_0_MEASURED_FLOW, gcui32_pgnMask16consecutive); s_register(AUX_VALVE_0_COMMAND, gcui32_pgnMask16consecutive); } else { // a change from Tractor mode to Implement mode occured UnregisterPgn_s s_unregister = getUnregisterPgn(); s_unregister(AUX_VALVE_0_ESTIMATED_FLOW, gcui32_pgnMask16consecutive); s_unregister(AUX_VALVE_0_MEASURED_FLOW, gcui32_pgnMask16consecutive); s_unregister(AUX_VALVE_0_COMMAND, gcui32_pgnMask16consecutive); } // set configure values mi32_lastMsgReceivedCmd = 0; for (int i = 0; i < nrOfValves; i++) { marr_auxFlag[i].ui8_estimatedActivated = false; marr_auxFlag[i].ui8_measuredActivated = false; marr_auxFlag[i].ui8_commandActivated = false; marr_valve[i].ui8_extendPortEstFlow = 125; marr_valve[i].ui8_retractPortEstFlow = 125; marr_valve[i].ui8_estFailSaveMode = IsoAgLib::IsoNotAvailableAux; marr_valve[i].ui8_estValveState = IsoAgLib::IsoNotAvailableAuxExt; marr_valve[i].ui8_extendPortMeasuredFlow = 125; marr_valve[i].ui8_retractPortMeasuredFlow = 125; marr_valve[i].ui16_extendPortPressure = 0; marr_valve[i].ui16_retractPortPressure = 0; marr_valve[i].ui8_returnPortPressure = 0; marr_valve[i].ui8_cmdPortFlow = 0; marr_valve[i].ui8_cmdFailSaveMode = IsoAgLib::IsoNotAvailableAux; marr_valve[i].ui8_cmdValveState = IsoAgLib::IsoNotAvailableAuxExt; marr_valve[i].ui8_estValveLimitStatus = IsoAgLib::IsoNotAvailableLimit; marr_valve[i].ui8_measuredValveLimitStatus = IsoAgLib::IsoNotAvailableLimit; } return true; }