Index: firmware/.project =================================================================== diff -u -re74b708f9537d28d676cdf4764992a9d572a5250 -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/.project (.../.project) (revision e74b708f9537d28d676cdf4764992a9d572a5250) +++ firmware/.project (.../.project) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -16,18 +16,12 @@ - - com.googlecode.cppcheclipse.Builder - - - com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.googlecode.cppcheclipse.Nature Index: firmware/.settings/com.googlecode.cppcheclipse.core.prefs =================================================================== diff -u -re74b708f9537d28d676cdf4764992a9d572a5250 -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/.settings/com.googlecode.cppcheclipse.core.prefs (.../com.googlecode.cppcheclipse.core.prefs) (revision e74b708f9537d28d676cdf4764992a9d572a5250) +++ firmware/.settings/com.googlecode.cppcheclipse.core.prefs (.../com.googlecode.cppcheclipse.core.prefs) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -8,4 +8,3 @@ eclipse.preferences.version=1 languageStandardPosix=true problems=memsetZeroBytes\=true;1;\!redundantCondition\=true;1;\!funcArgOrderDifferent\=true;1;\!sizeofsizeof\=true;1;\!invalidScanfFormatWidth\=true;2;\!deallocuse\=true;2;\!raceAfterInterlockedDecrement\=true;2;\!pointerSize\=true;1;\!IOWithoutPositioning\=true;2;\!invalidTestForOverflow\=true;1;\!uselessCallsRemove\=true;1;\!assignmentInAssert\=true;1;\!charLiteralWithCharPtrCompare\=true;1;\!literalWithCharPtrCompare\=true;1;\!assignBoolToFloat\=true;1;\!pointerAdditionResultNotNull\=true;1;\!shiftTooManyBitsSigned\=true;2;\!publicAllocationError\=true;1;\!unusedPrivateFunction\=true;1;\!wrongmathcall\=true;1;\!uninitMemberVar\=true;1;\!memleak\=true;2;\!duplInheritedMember\=true;1;\!uselessCallsEmpty\=true;1;\!operatorEq\=true;1;\!operatorEqVarError\=true;1;\!outOfBounds\=true;2;\!fflushOnInputStream\=true;0;\!variableScope\=true;1;\!throwInNoexceptFunction\=true;2;\!redundantCopyInSwitch\=true;1;\!functionStatic\=true;0;\!toomanyconfigs\=true;0;\!invalidFunctionArgBool\=true;2;\!nanInArithmeticExpression\=true;1;\!unusedAllocatedMemory\=true;1;\!constStatement\=true;1;\!va_start_subsequentCalls\=true;2;\!CastAddressToIntegerAtReturn\=true;0;\!signedCharArrayIndex\=true;1;\!zerodiv\=true;2;\!stlIfStrFind\=true;0;\!staticStringCompare\=true;1;\!incorrectLogicOperator\=true;1;\!redundantAssignment\=true;1;\!pointerOutOfBounds\=true;0;\!funcArgNamesDifferent\=true;1;\!returnTempReference\=true;2;\!invalidPrintfArgType_sint\=true;1;\!cstyleCast\=true;1;\!comparisonOfBoolWithBoolError\=true;1;\!noConstructor\=true;1;\!strncatUsage\=true;1;\!invalidScanfArgType_int\=true;1;\!derefInvalidIterator\=true;1;\!useAutoPointerArray\=true;2;\!nullPointerArithmetic\=true;2;\!initializerList\=true;1;\!sprintfOverlappingData\=true;2;\!returnReference\=true;2;\!checkCastIntToCharAndBack\=true;1;\!redundantCopyLocalConst\=true;0;\!catchExceptionByValue\=true;1;\!invalidPrintfArgType_float\=true;1;\!CastIntegerToAddressAtReturn\=true;0;\!sizeofwithsilentarraypointer\=true;1;\!boostForeachError\=true;2;\!unsafeClassCanLeak\=true;1;\!copyCtorPointerCopying\=true;1;\!duplicateBreak\=true;1;\!assertWithSideEffect\=true;1;\!unknownEvaluationOrder\=true;2;\!exceptDeallocThrow\=true;1;\!possibleBufferAccessOutOfBounds\=true;1;\!useAutoPointerContainer\=true;2;\!terminateStrncpy\=true;1;\!wrongPrintfScanfParameterPositionError\=true;1;\!missingIncludeSystem\=true;0;\!noCopyConstructor\=true;1;\!identicalConditionAfterEarlyExit\=true;1;\!mismatchingContainers\=true;2;\!unreadVariable\=true;1;\!useAutoPointerCopy\=true;1;\!uninitdata\=true;2;\!invalidFunctionArg\=true;2;\!functionConst\=true;1;\!argumentSize\=true;1;\!operatorEqToSelf\=true;1;\!invalidPrintfArgType_uint\=true;1;\!unassignedVariable\=true;1;\!invalidLengthModifierError\=true;1;\!eraseDereference\=true;2;\!stlIfFind\=true;1;\!negativeArraySize\=true;2;\!missingInclude\=true;0;\!unusedFunction\=true;1;\!invalidPointerCast\=true;0;\!uselessCallsSwap\=true;0;\!iterators\=true;2;\!returnAddressOfAutoVariable\=true;2;\!wrongPrintfScanfArgNum\=true;2;\!invalidScanfArgType_s\=true;1;\!integerOverflow\=true;2;\!autovarInvalidDeallocation\=true;2;\!ignoredReturnValue\=true;1;\!wrongPipeParameterSize\=true;2;\!arithOperationsOnVoidPointer\=true;0;\!shiftTooManyBits\=true;2;\!unsignedLessThanZero\=true;1;\!accessMoved\=true;1;\!comparisonError\=true;1;\!unusedVariable\=true;1;\!uselessAssignmentArg\=true;1;\!preprocessorErrorDirective\=true;2;\!bufferNotZeroTerminated\=true;1;\!operatorEqRetRefThis\=true;1;\!useClosedFile\=true;2;\!postfixOperator\=true;0;\!arrayIndexThenCheck\=true;1;\!nullPointerDefaultArg\=true;1;\!duplicateBranch\=true;1;\!stlcstr\=true;2;\!leakUnsafeArgAlloc\=true;1;\!nullPointerRedundantCheck\=true;1;\!mismatchSize\=true;2;\!stlOutOfBounds\=true;2;\!AssignmentIntegerToAddress\=true;0;\!returnAddressOfFunctionParameter\=true;2;\!divideSizeof\=true;1;\!uninitstring\=true;2;\!memsetValueOutOfRange\=true;1;\!mallocOnClassWarning\=true;1;\!unusedLabelSwitch\=true;1;\!comparisonOfTwoFuncsReturningBoolError\=true;1;\!commaSeparatedReturn\=true;1;\!duplicateExpression\=true;1;\!signConversion\=true;1;\!deadpointer\=true;2;\!shiftNegative\=true;2;\!stlcstrParam\=true;0;\!suspiciousCase\=true;1;\!unsafeClassDivZero\=true;1;\!stlcstrReturn\=true;0;\!clarifyStatement\=true;1;\!uselessCallsSubstr\=true;0;\!uselessCallsCompare\=true;1;\!truncLongCastReturn\=true;1;\!mallocOnClassError\=true;2;\!shiftNegativeLHS\=true;0;\!redundantCopy\=true;0;\!invalidScanfArgType_float\=true;1;\!leakReturnValNotUsed\=true;2;\!sizeofVoid\=true;0;\!exceptRethrowCopy\=true;1;\!compareBoolExpressionWithInt\=true;1;\!incrementboolean\=true;1;\!unhandledExceptionSpecification\=true;1;\!negativeMemoryAllocationSize\=true;2;\!returnLocalVariable\=true;2;\!writeReadOnlyFile\=true;2;\!stringLiteralWrite\=true;2;\!pointerLessThanZero\=true;1;\!reademptycontainer\=true;1;\!unsignedPositive\=true;1;\!virtualDestructor\=true;2;\!memsetClass\=true;2;\!ConfigurationNotChecked\=true;0;\!uninitStructMember\=true;2;\!unpreciseMathCall\=true;1;\!useInitializationList\=true;0;\!thisSubtraction\=true;1;\!sizeofwithnumericparameter\=true;1;\!suspiciousEqualityComparison\=true;1;\!operatorEqShouldBeLeftUnimplemented\=true;1;\!exceptThrowInDestructor\=true;1;\!insecureCmdLineArgs\=true;2;\!zerodivcond\=true;2;\!selfAssignment\=true;1;\!mismatchingBitAnd\=true;1;\!arrayIndexOutOfBoundsCond\=true;1;\!useAutoPointerMalloc\=true;2;\!autoVariables\=true;2;\!arrayIndexOutOfBounds\=true;2;\!redundantAssignInSwitch\=true;1;\!noExplicitConstructor\=true;1;\!sizeofCalculation\=true;1;\!invalidPointer\=true;2;\!comparisonFunctionIsAlwaysTrueOrFalse\=true;1;\!sizeofDereferencedVoidPointer\=true;0;\!oppositeInnerCondition\=true;1;\!deallocret\=true;2;\!unusedScopedObject\=true;1;\!strPlusChar\=true;2;\!AssignmentAddressToInteger\=true;0;\!uninitvar\=true;2;\!operatorEqMissingReturnStatement\=true;2;\!memleakOnRealloc\=true;2;\!floatConversionOverflow\=true;2;\!readWriteOnlyFile\=true;2;\!incorrectStringBooleanError\=true;1;\!resourceLeak\=true;2;\!deallocDealloc\=true;2;\!sizeArgumentAsChar\=true;1;\!invalidscanf\=true;1;\!knownConditionTrueFalse\=true;1;\!charBitOp\=true;1;\!unusedStructMember\=true;1;\!unknownSignCharArrayIndex\=true;0;\!memsetFloat\=true;0;\!suspiciousSemicolon\=true;1;\!pointerArithBool\=true;2;\!overlappingStrcmp\=true;1;\!stringCompare\=true;1;\!va_start_referencePassed\=true;2;\!stlBoundaries\=true;2;\!coutCerrMisusage\=true;2;\!StlMissingComparison\=true;1;\!invalidIterator1\=true;2;\!memsetClassReference\=true;2;\!unreachableCode\=true;1;\!invalidIterator2\=true;2;\!truncLongCastAssignment\=true;1;\!assignIfError\=true;1;\!incorrectStringCompare\=true;1;\!comparisonOfFuncReturningBoolError\=true;1;\!stlSize\=true;0;\!doubleFree\=true;2;\!multiplySizeof\=true;1;\!nullPointer\=true;2;\!accessForwarded\=true;1;\!redundantIfRemove\=true;1;\!copyCtorAndEqOperator\=true;1;\!badBitmaskCheck\=true;1;\!sizeofDivisionMemfunc\=true;1;\!moduloAlwaysTrueFalse\=true;1;\!selfInitialization\=true;2;\!varFuncNullUB\=true;0;\!va_start_wrongParameter\=true;1;\!negativeIndex\=true;2;\!incompleteArrayFill\=true;1;\!leakNoVarFunctionCall\=true;2;\!bitwiseOnBoolean\=true;1;\!passedByValue\=true;0;\!redundantPointerOp\=true;1;\!memsetClassFloat\=true;0;\!bufferAccessOutOfBounds\=true;2;\!invalidPrintfArgType_s\=true;1;\!duplicateExpressionTernary\=true;1;\!clarifyCalculation\=true;1;\!va_list_usedBeforeStarted\=true;2;\!invalidPrintfArgType_p\=true;1;\!unusedLabel\=true;1;\!seekOnAppendedFile\=true;1;\!pointerPositive\=true;1;\!uselessAssignmentPtrArg\=true;1;\!clarifyCondition\=true;1;\!va_end_missing\=true;2;\!assignBoolToPointer\=true;2;\!mismatchAllocDealloc\=true;2;\!invalidPrintfArgType_n\=true;1;\!multiCondition\=true;1;\! -runOnBuild=true Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -rab6ac1bb140201e5737d594b3456038ea9e4725f -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision ab6ac1bb140201e5737d594b3456038ea9e4725f) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -29,6 +29,7 @@ #include "TaskGeneral.h" #include "TaskPriority.h" #include "Timers.h" +#include "Valves.h" #include "DrainPump.h" /** @@ -211,7 +212,9 @@ // TODO - test code - remove later if ( GET_DIP_SW2_TEST() ) { - setFPGAValveStates( 0x014F ); // TODO - test code - remove later + setValveState( VPI, VALVE_STATE_OPEN ); + setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); setDrainPumpTargetSpeed( 1000 ); } #endif @@ -268,7 +271,9 @@ if ( !GET_DIP_SW2_TEST() ) { signalDrainPumpHardStop(); - setFPGAValveStates( 0x015F ); // TODO - test code - remove later + setValveState( VPI, VALVE_STATE_OPEN ); + setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VPO, VALVE_STATE_FILL_C_TO_NC ); result = DRAIN_PUMP_OFF_STATE; } #endif Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -r69a52d3eafb8667fa3163949107a9351b8eb855a -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 69a52d3eafb8667fa3163949107a9351b8eb855a) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -19,6 +19,7 @@ #include "ROPump.h" #include "TaskGeneral.h" #include "Timers.h" +#include "Valves.h" #include "ModeRecirculate.h" /** @@ -71,8 +72,10 @@ initRecirculateMode(); // TODO - set initial actuator states - setFPGAValveStates(0x014F); - // VPi open, VRc re-circ, VDr and VPo to drain + setValveState( VPI, VALVE_STATE_OPEN ); + setValveState( VRC, VALVE_STATE_RECIRC_C_TO_NC ); + setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); // UV on // Primary heater on } Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -re5c9e31c2644c7f0ca17ba81767a8ed19b99cebf -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e5c9e31c2644c7f0ca17ba81767a8ed19b99cebf) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -18,6 +18,7 @@ #include "OperationModes.h" #include "SystemComm.h" #include "Timers.h" +#include "Valves.h" #include "ModeStandby.h" /** @@ -80,6 +81,14 @@ initStandbyMode(); // TODO - set initial actuator states + setValveState( VPI, VALVE_STATE_CLOSED ); + setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); + setValveState( VRF, VALVE_STATE_R1_C_TO_NC ); + setValveState( VRI, VALVE_STATE_R2_C_TO_NC ); + setValveState( VRD, VALVE_STATE_R1_C_TO_NC ); + setValveState( VRO, VALVE_STATE_R2_C_TO_NC ); } /*********************************************************************//** Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rf5d0c90297a0716e1fb5a5c946436cccd35050e5 -r431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision f5d0c90297a0716e1fb5a5c946436cccd35050e5) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 431de35ec5d48cbcd7f6fdf9b1586616d7ac3c05) @@ -42,9 +42,9 @@ #define FPGA_PAGE_SIZE 256 #define FPGA_EXPECTED_ID 0x60 -#define FPGA_HEADER_START_ADDR 256 // TODO - update these after re-arranging w/ Randy -#define FPGA_BULK_READ_START_ADDR 262 -#define FPGA_BULK_WRITE_START_ADDR 2 +#define FPGA_HEADER_START_ADDR 0x0000 +#define FPGA_BULK_READ_START_ADDR 0x0100 +#define FPGA_BULK_WRITE_START_ADDR 0x000E #define FPGA_WRITE_CMD_BUFFER_LEN (FPGA_PAGE_SIZE+8) #define FPGA_READ_CMD_BUFFER_LEN 8 @@ -91,8 +91,8 @@ U32 fpgaCD1Temp; // Conductivity sensor 1 in the mixing area U32 fpgaCD2Temp; - U32 fpgaTPiTemp; U32 fpgaTPoTemp; + U32 fpgaTPiTemp; U32 fpgaRTDTemp; U32 fpgaTHDo; // TRo @@ -490,8 +490,8 @@ // construct read command to read 3 registers starting at address 0 fpgaReadCmdBuffer[ 0 ] = FPGA_READ_CMD_CODE; - fpgaReadCmdBuffer[ 1 ] = 0x06; // start at FPGA address 6 - fpgaReadCmdBuffer[ 2 ] = 0x00; + fpgaReadCmdBuffer[ 1 ] = GET_LSB_OF_WORD( FPGA_HEADER_START_ADDR ); + fpgaReadCmdBuffer[ 2 ] = GET_MSB_OF_WORD( FPGA_HEADER_START_ADDR ); fpgaReadCmdBuffer[ 3 ] = sizeof(FPGA_HEADER_T); crc = crc16( fpgaReadCmdBuffer, FPGA_READ_CMD_HDR_LEN ); fpgaReadCmdBuffer[ 4 ] = GET_MSB_OF_WORD( crc ); @@ -576,17 +576,17 @@ // construct bulk write command to write actuator data registers starting at address 3 (TODO - change address later) fpgaWriteCmdBuffer[ 0 ] = FPGA_WRITE_CMD_CODE; - fpgaWriteCmdBuffer[ 1 ] = 0x00; // start at FPGA address 0 - fpgaWriteCmdBuffer[ 2 ] = 0x00; + fpgaWriteCmdBuffer[ 1 ] = GET_LSB_OF_WORD( FPGA_BULK_WRITE_START_ADDR ); + fpgaWriteCmdBuffer[ 2 ] = GET_MSB_OF_WORD( FPGA_BULK_WRITE_START_ADDR ); fpgaWriteCmdBuffer[ 3 ] = sizeof(FPGA_ACTUATORS_T); memcpy( &( fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN ] ), &fpgaActuatorSetPoints, sizeof( FPGA_ACTUATORS_T ) ); crc = crc16( fpgaWriteCmdBuffer, FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) ); fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) ] = GET_MSB_OF_WORD( crc ); fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_HDR_LEN + sizeof( FPGA_ACTUATORS_T ) + 1 ] = GET_LSB_OF_WORD( crc ); // construct bulk read command to read sensor data registers starting at address 8 fpgaReadCmdBuffer[ 0 ] = FPGA_READ_CMD_CODE; - fpgaReadCmdBuffer[ 1 ] = 0x00; // start at FPGA address 0x100 (256) - fpgaReadCmdBuffer[ 2 ] = 0x01; + fpgaReadCmdBuffer[ 1 ] = GET_LSB_OF_WORD( FPGA_BULK_READ_START_ADDR ); + fpgaReadCmdBuffer[ 2 ] = GET_MSB_OF_WORD( FPGA_BULK_READ_START_ADDR ); fpgaReadCmdBuffer[ 3 ] = sizeof(DG_FPGA_SENSORS_T); crc = crc16( fpgaReadCmdBuffer, FPGA_READ_CMD_HDR_LEN ); fpgaReadCmdBuffer[ 4 ] = GET_MSB_OF_WORD( crc ); @@ -893,9 +893,9 @@ * 7 - VDr.\n * 8 - VPi.\n * 9 - VSP.\n - * 10- VR1.\n - * 11- VR2.\n - * 12..15 - reserved or unused. + * 10..11 - reserved (spare).\n + * 12- VPd.\n + * 13..15 - reserved or unused. * @details * Inputs : none * Outputs : fpgaActuatorSetPoints.fpgaValveStates