Skip to content

Commit

Permalink
Merge branch 'DEV' of github.com:collin80/GEVCU6 into DEV
Browse files Browse the repository at this point in the history
  • Loading branch information
collin80 committed Jul 6, 2017
2 parents f1827cb + 327b3a6 commit a77bd3e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
8 changes: 6 additions & 2 deletions CanHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void CanHandler::process()
if (bus->rx_avail()) {
bus->get_rx_buff(frame);

Logger::debug("CAN: dlc=%X fid=%X id=%X ide=%X rtr=%X data=%X,%X,%X,%X,%X,%X,%X,%X",
Logger::debug("CAN:%d dlc=%X fid=%X id=%X ide=%X rtr=%X data=%X,%X,%X,%X,%X,%X,%X,%X",canBusNode,
frame.length, frame.fid, frame.id, frame.extended, frame.rtr,
frame.data.bytes[0], frame.data.bytes[1], frame.data.bytes[2], frame.data.bytes[3],
frame.data.bytes[4], frame.data.bytes[5], frame.data.bytes[6], frame.data.bytes[7]);
Expand Down Expand Up @@ -298,7 +298,11 @@ void CanHandler::prepareOutputFrame(CAN_FRAME *frame, uint32_t id)
void CanHandler::CANIO(CAN_FRAME& frame) {
static CAN_FRAME CANioFrame;
int i;


Logger::warn("CANIO %d msg: %X %X %X %X %X %X %X %X %X", canBusNode,frame.id, frame.data.bytes[0],
frame.data.bytes[1],frame.data.bytes[2],frame.data.bytes[3],frame.data.bytes[4],
frame.data.bytes[5],frame.data.bytes[6],frame.data.bytes[7]);

CANioFrame.id = CAN_OUTPUTS;
CANioFrame.length = 8;
CANioFrame.extended = 0; //standard frame
Expand Down
2 changes: 2 additions & 0 deletions EVIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ void EVIC::setup() {
// register ourselves as observer of all 0x404 and 0x505 can frames from JLD505
canHandlerCar.attach(this, 0x404, 0x7ff, false);
canHandlerCar.attach(this, 0x505, 0x7ff, false);

//This is just a handy place to load the CAN_SWITCH message ID for CANIO. CANIO will not work without EVIC then.
canHandlerCar.attach(this, CAN_SWITCH, 0x7ff, false);
canHandlerEv.attach(this, CAN_SWITCH, 0x7ff, false);

Expand Down
20 changes: 10 additions & 10 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include <due_can.h>

#define CFG_BUILD_NUM 1058 //increment this every time a git commit is done.
#define CFG_VERSION "GEVCU 2016-10-13"
#define CFG_BUILD_NUM 1060 //increment this every time a git commit is done.
#define CFG_VERSION "GEVCU 2017-01-20"

/*
* SERIAL CONFIGURATION
Expand Down Expand Up @@ -76,7 +76,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* CAN BUS CONFIGURATION
*/
#define CFG_CAN0_SPEED 500 // specify the speed of the CAN0 bus (EV) in thousands.
#define CFG_CAN1_SPEED 250 // specify the speed of the CAN1 bus (Car) in thousands
#define CFG_CAN1_SPEED 500 // specify the speed of the CAN1 bus (Car) in thousands
#define CFG_CANTHROTTLE_MAX_NUM_LOST_MSG 3 // maximum number of lost messages allowed

/*
Expand All @@ -94,7 +94,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//#define USE_HARD_CODED
#define ThrottleNumPots 1 //# of pots to use by default
#define ThrottleADC1 2 //Which pin to use
#define ThrottleADC1 0 //Which pin to use
#define ThrottleADC2 1 //Which pin to use
#define ThrottleSubtype 1 //subtype 1 is a standard linear pot throttle
#define ThrottleRegenMinValue 270 //where does Regen stop (1/10 of percent)
Expand All @@ -121,18 +121,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define RPMSlewRateValue 10000 // rpm/sec the requested speed should change (speed mode)
#define TorqueSlewRateValue 6000 // 0.1Nm/sec the requested torque output should change (torque mode)
#define KilowattHrs 11000 //not currently used
#define PrechargeR 3000 //millliseconds precharge
#define PrechargeR 6000 //millliseconds precharge
#define NominalVolt 3300 //a reasonable figure for a lithium cell pack driving the DMOC (in tenths of a volt)
#define PrechargeRelay 4
#define MainContactorRelay 5
#define PrechargeRelay 0
#define MainContactorRelay 1
#define ReversePercent 50
#define CoolFan 6 //output to use for cooling fan
#define CoolOn 40 //temperature (in C) to turn on cooling fan
#define BrakeLight 255 //temperature to turn it off
#define CoolOff 35 //temperature to turn it off
#define RevLight 255 //temperature to turn it off
#define EnableIn 255//temperature to turn it off
#define ReverseIn 255 //temperature to turn it off
#define EnableIn 0//temperature to turn it off
#define ReverseIn 1 //temperature to turn it off
#define MaxRegenWatts 40000 //in actual watts, there is no scale here
#define MaxAccelWatts 150000
#define BatteryCapacity 100
Expand Down Expand Up @@ -183,7 +183,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define AUTO_ENABLE_DEV1 0x1000 //DMOC645
#define AUTO_ENABLE_DEV2 0x1031 //pot throttle
#define AUTO_ENABLE_DEV3 0x1041 //Adafruit BLE
#define AUTO_ENABLE_DEV4 0xFFFF
#define AUTO_ENABLE_DEV4 0x4400 //EVIC
#define AUTO_ENABLE_DEV5 0xFFFF
#define AUTO_ENABLE_DEV6 0xFFFF

Expand Down
3 changes: 2 additions & 1 deletion sys_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ int32_t SystemIO::getPackLowReading()
valu = getSPIADCReading(CS3, 2);
valu -= (adc_comp[6].offset * 32);
valu >>= 3;

gainTemp = (int64_t)((int64_t)valu * adc_comp[6].gain) / 16384ll;
valu = (int32_t) -gainTemp;
return valu;
Expand Down Expand Up @@ -695,7 +696,7 @@ bool SystemIO::calibrateADCGain(int adc, int32_t target, bool update)
return false;
}

if (accum < 1000) {
if (accum < 1000 && accum > -1000) {
Logger::console("Readings are too low. Try applying more voltage/current");
return false;
}
Expand Down

0 comments on commit a77bd3e

Please sign in to comment.