2017-10-25 17:43:33 -07:00
|
|
|
#ifndef CANCOMMS_H
|
|
|
|
#define CANCOMMS_H
|
|
|
|
|
Air Conditioning Control - Feature Implementation (#665)
* 19.09.2021
* Final testing of AC Control, some idle features fixed
AC control feature added, better than the existing idle-up feature (which can still be used for other things, e.g. electrical load detection). Air conditioning is locked out with coolant temp, RPM high/low, and high TPS. So the A/C automatically cuts out when driving hard.
Idle step now works correctly with closed loop PWM, open loop PWM, and closed+open loop PWM. Untested with stepper motor, but no reason it shouldn't work.
* Fixed mistakenly incremented page sizes
* Initial changes as per HWright9
-Renamed engineRunSeconds to acAfterEngineStartDelay
-Formatted large if statements better
-Fixed acStartDelay overflow bug
-Improved readability of logic
* Final fixes as per HWright9's feedback
-Add high/low RPM lockout delay, similar to the high TPM lockout delay
-General tidy-up
* Added stand-alone fan, moved config data in EEPROM
-Added additional configurable stand-alone A/C fan output, for when there is dedicated cooling fan for the A/C compressor. This is independent of the engine cooling fan logic.
-Moved config storage in EEPROM to configPage9, as noisymime's SD card logging has used the (previously unused) bytes I had used in configPage13.
-Minor bug fix - rename Aux in 1-16 to Aux in 0-15
* Revert to current master branch - as of master commit 97f8ef795a514c9a5693e85be6cdb8bdee8ef2c5
* A/C Control Re-Integrated from AC-Control-Clean-3 (@Corey-Harding). Tested & ready to merge.
Additionally, added @HazuTo25's lines into the update() routine to configure default A/C settings.
* Changed updates.ino to just set A/C to disabled
* Fix change reverted by mistake - master merge commit 73badbce8ca171faa8c58575947917829adfc1ba
* Fix remaining mistakes from previous master merge
* Remove test statements left in by mistake
* define unusedBits
* Remove test statements left in by mistake
* Increase timing granularity to 0.1s
* idleUpRPMAdder
* Remove another line put in by mistake by auto merge
* idleUpRPMFixes
* Update speeduino.ino
* Tweak A/C idle up descriptions
* Tweak A/C TS descriptors again
* Fixed alignment bug that turned page 15 config values into gobbledegook.
This had the symptom of the A/C request never triggering, because when a pin was assigned in TS (e.g. I did 27), a completely different pin would be read from config15 (in my case 22 - connecting the button to pin 22 would work in this case, even though TS was set to 27).
* Fix bit count - should be 6 to match ini file
* Increase minimum RPM lockout granularity
* Change granularity of A/C minimum RPM lockout to 10 RPM; Inline some functions for readability
* Add static inline function prototypes to auxiliaries.h as per the style guide.
* Fixed page 15 merge errors
* Style changes to suit new pinIsUsed() checks in setPinMappings()
* Add PWM Fan Control Minimum Clamp Value when A/C Compressor Engaged
* Fix comment
* Fix bug with stand-alone fan initialisation
Pin was unable to be used in prog. I/O even if fan was disabled, because it was always initialised as an output even if it was disabled. Fixed in this commit.
* Correction to Fahrenheit temperature scaling
* Move A/C updates to correct next release
Co-authored-by: shiznit304 <62686180+shiznit304@users.noreply.github.com>
Co-authored-by: Josh Stewart <josh@noisymime.org>
2022-09-06 17:23:01 -07:00
|
|
|
#define NEW_CAN_PACKET_SIZE 123
|
2017-11-01 17:19:57 -07:00
|
|
|
#define CAN_PACKET_SIZE 75
|
2017-11-01 13:17:47 -07:00
|
|
|
|
2020-05-20 22:42:02 -07:00
|
|
|
#if ( defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) )
|
|
|
|
#define CANSerial_AVAILABLE
|
2021-04-20 21:36:27 -07:00
|
|
|
extern HardwareSerial &CANSerial;
|
2017-10-25 17:43:33 -07:00
|
|
|
#elif defined(CORE_STM32)
|
2020-05-20 22:42:02 -07:00
|
|
|
#define CANSerial_AVAILABLE
|
2021-09-13 18:23:32 -07:00
|
|
|
#ifndef HAVE_HWSERIAL2 //Hack to get the code to compile on BlackPills
|
2020-02-02 18:53:40 -08:00
|
|
|
#define Serial2 Serial1
|
|
|
|
#endif
|
2020-01-23 17:32:51 -08:00
|
|
|
#if defined(STM32GENERIC) // STM32GENERIC core
|
2021-04-20 21:36:27 -07:00
|
|
|
extern SerialUART &CANSerial;
|
2017-10-25 17:43:33 -07:00
|
|
|
#else //libmaple core aka STM32DUINO
|
2021-04-20 21:36:27 -07:00
|
|
|
extern HardwareSerial &CANSerial;
|
2017-10-25 17:43:33 -07:00
|
|
|
#endif
|
|
|
|
#elif defined(CORE_TEENSY)
|
2020-05-20 22:42:02 -07:00
|
|
|
#define CANSerial_AVAILABLE
|
2021-04-20 21:36:27 -07:00
|
|
|
extern HardwareSerial &CANSerial;
|
2017-10-25 17:43:33 -07:00
|
|
|
#endif
|
|
|
|
|
2022-04-10 17:49:58 -07:00
|
|
|
void secondserial_Command();//This is the heart of the Command Line Interpreter. All that needed to be done was to make it human readable.
|
2017-10-25 17:43:33 -07:00
|
|
|
void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum);
|
2020-02-27 15:18:37 -08:00
|
|
|
void can_Command();
|
2017-11-01 13:17:47 -07:00
|
|
|
void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2, uint16_t sourcecanAddress);
|
2020-02-27 15:18:37 -08:00
|
|
|
void obd_response(uint8_t therequestedPID , uint8_t therequestedPIDlow, uint8_t therequestedPIDhigh);
|
2017-10-25 17:43:33 -07:00
|
|
|
|
2018-01-11 18:54:31 -08:00
|
|
|
#endif // CANCOMMS_H
|