diff --git a/reference/speeduino.ini b/reference/speeduino.ini index d4179924..100fde1a 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -10,7 +10,6 @@ signature = "speeduino 201704" versionInfo = "S" ; Put this in the title bar. - ;[TunerStudio] ; iniSpecVersion = 3.24 @@ -38,6 +37,7 @@ ; name = type, min, max; ; ; type List: value will be index. + tsCanId = bits, U08, [0:3], "CAN ID 0", "CAN ID 1", "CAN ID 2", "CAN ID 3", "CAN ID 4", "CAN ID 5", "CAN ID 6", "CAN ID 7", "CAN ID 8", "CAN ID 9", "CAN ID 10","CAN ID 11","CAN ID 12","CAN ID 13","CAN ID 14","INVALID" rpmhigh = scalar, U16, "rpm", 1, 0, 0, 30000, 0 rpmwarn = scalar, U16, "rpm", 1, 0, 0, 30000, 0 rpmdang = scalar, U16, "rpm", 1, 0, 0, 30000, 0 @@ -99,6 +99,7 @@ nPages = 10 burnCommand = "B" pageSize = 288, 64, 288, 64, 288, 64, 64, 160, 192, 128 +; pageIdentifier = "\$tsCanId\x01", "\$tsCanId\x02", "\$tsCanId\x03", "\$tsCanId\x04", "\$tsCanId\x05", "\$tsCanId\x06", "\$tsCanId\x07", "\$tsCanId\x08", "\$tsCanId\x09", "\$tsCanId\x0A" pageActivationDelay = 10 pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010", "P\011", "P\012" pageReadCommand = "V", "V", "V", "V", "V", "V", "V", "V", "V", "V" @@ -114,6 +115,21 @@ ;writeBlocks = off interWriteDelay = 10 +;New for TS 3.0.08ish upwards, define lists of standard I/O options + + #define tsCanId_list = "CAN ID 0", "CAN ID 1", "CAN ID 2", "CAN ID 3", "CAN ID 4", "CAN ID 5", "CAN ID 6", "CAN ID 7", "CAN ID 8", "CAN ID 9", "CAN ID 10","CAN ID 11","CAN ID 12","CAN ID 13","CAN ID 14","INVALID" + #define CAN_ADDRESS_HEX_02XX = "0x200", "0x201", "0x202", "0x203", "0x204", "0x205", "0x206", "0x207", "0x208", "0x209", "0x20A", "0x20B", "0x20C", "0x20D", "0x20E", "0x20F", "0x210", "0x211", "0x212", "0x213", "0x214", "0x215", "0x216", "0x217", "0x218", "0x219", "0x21A", "0x21B", "0x21C", "0x21D", "0x21E", "0x21F", "0x220", "0x221", "0x222", "0x223", "0x224", "0x225", "0x226", "0x227", "0x228", "0x229", "0x22A", "0x22B", "0x22C", "0x22D", "0x22E", "0x22F", "0x230", "0x231", "0x232", "0x233", "0x234", "0x235", "0x236", "0x237", "0x238", "0x239", "0x23A", "0x23B", "0x23C", "0x23D", "0x23E", "0x23F", "0x240", "0x241", "0x242", "0x243", "0x244", "0x245", "0x246", "0x247", "0x248", "0x249", "0x24A", "0x24B", "0x24C", "0x24D", "0x24E", "0x24F", "0x250", "0x251", "0x252", "0x253", "0x254", "0x255", "0x256", "0x257", "0x258", "0x259", "0x25A", "0x25B", "0x25C", "0x25D", "0x25E", "0x25F" ,"0x260", "0x261", "0x262", "0x263", "0x264", "0x265", "0x266", "0x267", "0x268", "0x269", "0x26A", "0x26B", "0x26C", "0x26D", "0x26E", "0x26F", "0x270", "0x271", "0x272", "0x273", "0x274", "0x275", "0x276", "0x277", "0x278", "0x279", "0x27A", "0x27B", "0x27C", "0x27D", "0x27E", "0x27F", "0x280", "0x281", "0x282", "0x283", "0x284", "0x285", "0x286", "0x287", "0x288", "0x289", "0x28A", "0x28B", "0x28C", "0x28D", "0x28E", "0x28F" ,"0x290", "0x291", "0x292", "0x293", "0x294", "0x295", "0x296", "0x297", "0x298", "0x299", "0x29A", "0x29B", "0x29C", "0x29D", "0x29E", "0x29F", "0x2A0", "0x2A1", "0x2A2", "0x2A3", "0x2A4", "0x2A5", "0x2A6", "0x2A7", "0x2A8", "0x2A9", "0x2AA", "0x2AB", "0x2AC", "0x2AD", "0x2AE", "0x2AF", "0x2B0", "0x2B1", "0x2B2", "0x2B3", "0x2B4", "0x2B5", "0x2B6", "0x2B7", "0x2B8", "0x2B9", "0x2BA", "0x2BB", "0x2BC", "0x2BD", "0x2BE", "0x2BF" ,"0x2C0", "0x2C1", "0x2C2", "0x2C3", "0x2C4", "0x2C5", "0x2C6", "0x2C7", "0x2C8", "0x2C9", "0x2CA", "0x2CB", "0x2CC", "0x2CD", "0x2CE", "0x2CF", "0x2D0", "0x2D1", "0x2D2", "0x2D3", "0x2D4", "0x2D5", "0x2D6", "0x2D7", "0x2D8", "0x2D9", "0x2DA", "0x2DB", "0x2DC", "0x2DD", "0x2DE", "0x2DF", "0x2E0", "0x2E1", "0x2E2", "0x2E3", "0x2E4", "0x2E5", "0x2E6", "0x2E7", "0x2E8", "0x2E9", "0x2EA", "0x2EB", "0x2EC", "0x2ED", "0x2EE", "0x2EF" ,"0x2F0", "0x2F1", "0x2F2", "0x2F3", "0x2F4", "0x2F5", "0x2F6", "0x2F7", "0x2F8", "0x2F9", "0x2FA", "0x2FB", "0x2FC", "0x2FD", "0x2FE", "0x2FF" + #define CAN_ADDRESS_HEX_03XX = "0x300", "0x301", "0x302", "0x303", "0x304", "0x305", "0x306", "0x307", "0x308", "0x309", "0x30A", "0x30B", "0x30C", "0x30D", "0x30E", "0x30F", "0x310", "0x311", "0x312", "0x313", "0x314", "0x315", "0x316", "0x317", "0x318", "0x319", "0x31A", "0x31B", "0x31C", "0x31D", "0x31E", "0x31F", "0x320", "0x321", "0x322", "0x323", "0x324", "0x325", "0x326", "0x327", "0x328", "0x329", "0x32A", "0x32B", "0x32C", "0x32D", "0x32E", "0x32F", "0x330", "0x331", "0x332", "0x333", "0x334", "0x335", "0x336", "0x337", "0x338", "0x339", "0x33A", "0x33B", "0x33C", "0x33D", "0x33E", "0x33F", "0x340", "0x341", "0x342", "0x343", "0x344", "0x345", "0x346", "0x347", "0x348", "0x349", "0x34A", "0x34B", "0x34C", "0x34D", "0x34E", "0x34F", "0x350", "0x351", "0x352", "0x353", "0x354", "0x355", "0x356", "0x357", "0x358", "0x359", "0x35A", "0x35B", "0x35C", "0x35D", "0x35E", "0x35F" ,"0x360", "0x361", "0x362", "0x363", "0x364", "0x365", "0x366", "0x367", "0x368", "0x369", "0x36A", "0x36B", "0x36C", "0x36D", "0x36E", "0x36F", "0x370", "0x371", "0x372", "0x373", "0x374", "0x375", "0x376", "0x377", "0x378", "0x379", "0x37A", "0x37B", "0x37C", "0x37D", "0x37E", "0x37F", "0x380", "0x381", "0x382", "0x383", "0x384", "0x385", "0x386", "0x387", "0x388", "0x389", "0x38A", "0x38B", "0x38C", "0x38D", "0x38E", "0x38F" ,"0x390", "0x391", "0x392", "0x393", "0x394", "0x395", "0x396", "0x397", "0x398", "0x399", "0x39A", "0x39B", "0x39C", "0x39D", "0x39E", "0x39F", "0x3A0", "0x3A1", "0x3A2", "0x3A3", "0x3A4", "0x3A5", "0x3A6", "0x3A7", "0x3A8", "0x3A9", "0x3AA", "0x3AB", "0x3AC", "0x3AD", "0x3AE", "0x3AF", "0x3B0", "0x3B1", "0x3B2", "0x3B3", "0x3B4", "0x3B5", "0x3B6", "0x3B7", "0x3B8", "0x3B9", "0x3BA", "0x3BB", "0x3BC", "0x3BD", "0x3BE", "0x3BF" ,"0x3C0", "0x3C1", "0x3C2", "0x3C3", "0x3C4", "0x3C5", "0x3C6", "0x3C7", "0x3C8", "0x3C9", "0x3CA", "0x3CB", "0x3CC", "0x3CD", "0x3CE", "0x3CF", "0x3D0", "0x3D1", "0x3D2", "0x3D3", "0x3D4", "0x3D5", "0x3D6", "0x3D7", "0x3D8", "0x3D9", "0x3DA", "0x3DB", "0x3DC", "0x3DD", "0x3DE", "0x3DF", "0x3E0", "0x3E1", "0x3E2", "0x3E3", "0x3E4", "0x3E5", "0x3E6", "0x3E7", "0x3E8", "0x3E9", "0x3EA", "0x3EB", "0x3EC", "0x3ED", "0x3EE", "0x3EF" ,"0x3F0", "0x3F1", "0x3F2", "0x3F3", "0x3F4", "0x3F5", "0x3F6", "0x3F7", "0x3F8", "0x3F9", "0x3FA", "0x3FB", "0x3FC", "0x3FD", "0x3FE", "0x3FF" + #define CAN_ADDRESS_HEX_04XX = "0x400", "0x401", "0x402", "0x403", "0x404", "0x405", "0x406", "0x407", "0x408", "0x409", "0x40A", "0x40B", "0x40C", "0x40D", "0x40E", "0x40F", "0x410", "0x411", "0x412", "0x413", "0x414", "0x415", "0x416", "0x417", "0x418", "0x419", "0x41A", "0x41B", "0x41C", "0x41D", "0x41E", "0x41F", "0x420", "0x421", "0x422", "0x423", "0x424", "0x425", "0x426", "0x427", "0x428", "0x429", "0x42A", "0x42B", "0x42C", "0x42D", "0x42E", "0x42F", "0x430", "0x431", "0x432", "0x433", "0x434", "0x435", "0x436", "0x437", "0x438", "0x439", "0x43A", "0x43B", "0x43C", "0x43D", "0x43E", "0x43F", "0x440", "0x441", "0x442", "0x443", "0x444", "0x445", "0x446", "0x447", "0x448", "0x449", "0x44A", "0x44B", "0x44C", "0x44D", "0x44E", "0x44F", "0x450", "0x451", "0x452", "0x453", "0x454", "0x455", "0x456", "0x457", "0x458", "0x459", "0x45A", "0x45B", "0x45C", "0x45D", "0x45E", "0x45F" ,"0x460", "0x461", "0x462", "0x463", "0x464", "0x465", "0x466", "0x467", "0x468", "0x469", "0x46A", "0x46B", "0x46C", "0x46D", "0x46E", "0x46F", "0x470", "0x471", "0x472", "0x473", "0x474", "0x475", "0x476", "0x477", "0x478", "0x479", "0x47A", "0x47B", "0x47C", "0x47D", "0x47E", "0x47F", "0x480", "0x481", "0x482", "0x483", "0x484", "0x485", "0x486", "0x487", "0x488", "0x489", "0x48A", "0x48B", "0x48C", "0x48D", "0x48E", "0x48F" ,"0x490", "0x491", "0x492", "0x493", "0x494", "0x495", "0x496", "0x497", "0x498", "0x499", "0x49A", "0x49B", "0x49C", "0x49D", "0x49E", "0x49F", "0x4A0", "0x4A1", "0x4A2", "0x4A3", "0x4A4", "0x4A5", "0x4A6", "0x4A7", "0x4A8", "0x4A9", "0x4AA", "0x4AB", "0x4AC", "0x4AD", "0x4AE", "0x4AF", "0x4B0", "0x4B1", "0x4B2", "0x4B3", "0x4B4", "0x4B5", "0x4B6", "0x4B7", "0x4B8", "0x4B9", "0x4BA", "0x4BB", "0x4BC", "0x4BD", "0x4BE", "0x4BF" ,"0x4C0", "0x4C1", "0x4C2", "0x4C3", "0x4C4", "0x4C5", "0x4C6", "0x4C7", "0x4C8", "0x4C9", "0x4CA", "0x4CB", "0x4CC", "0x4CD", "0x4CE", "0x4CF", "0x4D0", "0x4D1", "0x4D2", "0x4D3", "0x4D4", "0x4D5", "0x4D6", "0x4D7", "0x4D8", "0x4D9", "0x4DA", "0x4DB", "0x4DC", "0x4DD", "0x4DE", "0x4DF", "0x4E0", "0x4E1", "0x4E2", "0x4E3", "0x4E4", "0x4E5", "0x4E6", "0x4E7", "0x4E8", "0x4E9", "0x4EA", "0x4EB", "0x4EC", "0x4ED", "0x4EE", "0x4EF" ,"0x4F0", "0x4F1", "0x4F2", "0x4F3", "0x4F4", "0x4F5", "0x4F6", "0x4F7", "0x4F8", "0x4F9", "0x4FA", "0x4FB", "0x4FC", "0x4FD", "0x4FE", "0x4FF" + #define CAN_ADDRESS_HEX_05XX = "0x500", "0x501", "0x502", "0x503", "0x504", "0x505", "0x506", "0x507", "0x508", "0x509", "0x50A", "0x50B", "0x50C", "0x50D", "0x50E", "0x50F", "0x510", "0x511", "0x512", "0x513", "0x514", "0x515", "0x516", "0x517", "0x518", "0x519", "0x51A", "0x51B", "0x51C", "0x51D", "0x51E", "0x51F", "0x520", "0x521", "0x522", "0x523", "0x524", "0x525", "0x526", "0x527", "0x528", "0x529", "0x52A", "0x52B", "0x52C", "0x52D", "0x52E", "0x52F", "0x530", "0x531", "0x532", "0x533", "0x534", "0x535", "0x536", "0x537", "0x538", "0x539", "0x53A", "0x53B", "0x53C", "0x53D", "0x53E", "0x53F", "0x540", "0x541", "0x542", "0x543", "0x544", "0x545", "0x546", "0x547", "0x548", "0x549", "0x54A", "0x54B", "0x54C", "0x54D", "0x54E", "0x54F", "0x550", "0x551", "0x552", "0x553", "0x554", "0x555", "0x556", "0x557", "0x558", "0x559", "0x55A", "0x55B", "0x55C", "0x55D", "0x55E", "0x55F" ,"0x560", "0x561", "0x562", "0x563", "0x564", "0x565", "0x566", "0x567", "0x568", "0x569", "0x56A", "0x56B", "0x56C", "0x56D", "0x56E", "0x56F", "0x570", "0x571", "0x572", "0x573", "0x574", "0x575", "0x576", "0x577", "0x578", "0x579", "0x57A", "0x57B", "0x57C", "0x57D", "0x57E", "0x57F", "0x580", "0x581", "0x582", "0x583", "0x584", "0x585", "0x586", "0x587", "0x588", "0x589", "0x58A", "0x58B", "0x58C", "0x58D", "0x58E", "0x58F" ,"0x590", "0x591", "0x592", "0x593", "0x594", "0x595", "0x596", "0x597", "0x598", "0x599", "0x59A", "0x59B", "0x59C", "0x59D", "0x59E", "0x59F", "0x5A0", "0x5A1", "0x5A2", "0x5A3", "0x5A4", "0x5A5", "0x5A6", "0x5A7", "0x5A8", "0x5A9", "0x5AA", "0x5AB", "0x5AC", "0x5AD", "0x5AE", "0x5AF", "0x5B0", "0x5B1", "0x5B2", "0x5B3", "0x5B4", "0x5B5", "0x5B6", "0x5B7", "0x5B8", "0x5B9", "0x5BA", "0x5BB", "0x5BC", "0x5BD", "0x5BE", "0x5BF" ,"0x5C0", "0x5C1", "0x5C2", "0x5C3", "0x5C4", "0x5C5", "0x5C6", "0x5C7", "0x5C8", "0x5C9", "0x5CA", "0x5CB", "0x5CC", "0x5CD", "0x5CE", "0x5CF", "0x5D0", "0x5D1", "0x5D2", "0x5D3", "0x5D4", "0x5D5", "0x5D6", "0x5D7", "0x5D8", "0x5D9", "0x5DA", "0x5DB", "0x5DC", "0x5DD", "0x5DE", "0x5DF", "0x5E0", "0x5E1", "0x5E2", "0x5E3", "0x5E4", "0x5E5", "0x5E6", "0x5E7", "0x5E8", "0x5E9", "0x5EA", "0x5EB", "0x5EC", "0x5ED", "0x5EE", "0x5EF" ,"0x5F0", "0x5F1", "0x5F2", "0x5F3", "0x5F4", "0x5F5", "0x5F6", "0x5F7", "0x5F8", "0x5F9", "0x5FA", "0x5FB", "0x5FC", "0x5FD", "0x5FE", "0x5FF" + #define CAN_ADDRESS_HEX_06XX = "0x600", "0x601", "0x602", "0x603", "0x604", "0x605", "0x606", "0x607", "0x608", "0x609", "0x60A", "0x60B", "0x60C", "0x60D", "0x60E", "0x60F", "0x610", "0x611", "0x612", "0x613", "0x614", "0x615", "0x616", "0x617", "0x618", "0x619", "0x61A", "0x61B", "0x61C", "0x61D", "0x61E", "0x61F", "0x620", "0x621", "0x622", "0x623", "0x624", "0x625", "0x626", "0x627", "0x628", "0x629", "0x62A", "0x62B", "0x62C", "0x62D", "0x62E", "0x62F", "0x630", "0x631", "0x632", "0x633", "0x634", "0x635", "0x636", "0x637", "0x638", "0x639", "0x63A", "0x63B", "0x63C", "0x63D", "0x63E", "0x63F", "0x640", "0x641", "0x642", "0x643", "0x644", "0x645", "0x646", "0x647", "0x648", "0x649", "0x64A", "0x64B", "0x64C", "0x64D", "0x64E", "0x64F", "0x650", "0x651", "0x652", "0x653", "0x654", "0x655", "0x656", "0x657", "0x658", "0x659", "0x65A", "0x65B", "0x65C", "0x65D", "0x65E", "0x65F" ,"0x660", "0x661", "0x662", "0x663", "0x664", "0x665", "0x666", "0x667", "0x668", "0x669", "0x66A", "0x66B", "0x66C", "0x66D", "0x66E", "0x66F", "0x670", "0x671", "0x672", "0x673", "0x674", "0x675", "0x676", "0x677", "0x678", "0x679", "0x67A", "0x67B", "0x67C", "0x67D", "0x67E", "0x67F", "0x680", "0x681", "0x682", "0x683", "0x684", "0x685", "0x686", "0x687", "0x688", "0x689", "0x68A", "0x68B", "0x68C", "0x68D", "0x68E", "0x68F" ,"0x690", "0x691", "0x692", "0x693", "0x694", "0x695", "0x696", "0x697", "0x698", "0x699", "0x69A", "0x69B", "0x69C", "0x69D", "0x69E", "0x69F", "0x6A0", "0x6A1", "0x6A2", "0x6A3", "0x6A4", "0x6A5", "0x6A6", "0x6A7", "0x6A8", "0x6A9", "0x6AA", "0x6AB", "0x6AC", "0x6AD", "0x6AE", "0x6AF", "0x6B0", "0x6B1", "0x6B2", "0x6B3", "0x6B4", "0x6B5", "0x6B6", "0x6B7", "0x6B8", "0x6B9", "0x6BA", "0x6BB", "0x6BC", "0x6BD", "0x6BE", "0x6BF" ,"0x6C0", "0x6C1", "0x6C2", "0x6C3", "0x6C4", "0x6C5", "0x6C6", "0x6C7", "0x6C8", "0x6C9", "0x6CA", "0x6CB", "0x6CC", "0x6CD", "0x6CE", "0x6CF", "0x6D0", "0x6D1", "0x6D2", "0x6D3", "0x6D4", "0x6D5", "0x6D6", "0x6D7", "0x6D8", "0x6D9", "0x6DA", "0x6DB", "0x6DC", "0x6DD", "0x6DE", "0x6DF", "0x6E0", "0x6E1", "0x6E2", "0x6E3", "0x6E4", "0x6E5", "0x6E6", "0x6E7", "0x6E8", "0x6E9", "0x6EA", "0x6EB", "0x6EC", "0x6ED", "0x6EE", "0x6EF" ,"0x6F0", "0x6F1", "0x6F2", "0x6F3", "0x6F4", "0x6F5", "0x6F6", "0x6F7", "0x6F8", "0x6F9", "0x6FA", "0x6FB", "0x6FC", "0x6FD", "0x6FE", "0x6FF" + #define CAN_ADDRESS_HEX_07XX = "0x700", "0x701", "0x702", "0x703", "0x704", "0x705", "0x706", "0x707", "0x708", "0x709", "0x70A", "0x70B", "0x70C", "0x70D", "0x70E", "0x70F", "0x710", "0x711", "0x712", "0x713", "0x714", "0x715", "0x716", "0x717", "0x718", "0x719", "0x71A", "0x71B", "0x71C", "0x71D", "0x71E", "0x71F", "0x720", "0x721", "0x722", "0x723", "0x724", "0x725", "0x726", "0x727", "0x728", "0x729", "0x72A", "0x72B", "0x72C", "0x72D", "0x72E", "0x72F", "0x730", "0x731", "0x732", "0x733", "0x734", "0x735", "0x736", "0x737", "0x738", "0x739", "0x73A", "0x73B", "0x73C", "0x73D", "0x73E", "0x73F", "0x740", "0x741", "0x742", "0x743", "0x744", "0x745", "0x746", "0x747", "0x748", "0x749", "0x74A", "0x74B", "0x74C", "0x74D", "0x74E", "0x74F", "0x750", "0x751", "0x752", "0x753", "0x754", "0x755", "0x756", "0x757", "0x758", "0x759", "0x75A", "0x75B", "0x75C", "0x75D", "0x75E", "0x75F" ,"0x760", "0x761", "0x762", "0x763", "0x764", "0x765", "0x766", "0x767", "0x768", "0x769", "0x76A", "0x76B", "0x76C", "0x76D", "0x76E", "0x76F", "0x770", "0x771", "0x772", "0x773", "0x774", "0x775", "0x776", "0x777", "0x778", "0x779", "0x77A", "0x77B", "0x77C", "0x77D", "0x77E", "0x77F", "0x780", "0x781", "0x782", "0x783", "0x784", "0x785", "0x786", "0x787", "0x788", "0x789", "0x78A", "0x78B", "0x78C", "0x78D", "0x78E", "0x78F" ,"0x790", "0x791", "0x792", "0x793", "0x794", "0x795", "0x796", "0x797", "0x798", "0x799", "0x79A", "0x79B", "0x79C", "0x79D", "0x79E", "0x79F", "0x7A0", "0x7A1", "0x7A2", "0x7A3", "0x7A4", "0x7A5", "0x7A6", "0x7A7", "0x7A8", "0x7A9", "0x7AA", "0x7AB", "0x7AC", "0x7AD", "0x7AE", "0x7AF", "0x7B0", "0x7B1", "0x7B2", "0x7B3", "0x7B4", "0x7B5", "0x7B6", "0x7B7", "0x7B8", "0x7B9", "0x7BA", "0x7BB", "0x7BC", "0x7BD", "0x7BE", "0x7BF" ,"0x7C0", "0x7C1", "0x7C2", "0x7C3", "0x7C4", "0x7C5", "0x7C6", "0x7C7", "0x7C8", "0x7C9", "0x7CA", "0x7CB", "0x7CC", "0x7CD", "0x7CE", "0x7CF", "0x7D0", "0x7D1", "0x7D2", "0x7D3", "0x7D4", "0x7D5", "0x7D6", "0x7D7", "0x7D8", "0x7D9", "0x7DA", "0x7DB", "0x7DC", "0x7DD", "0x7DE", "0x7DF", "0x7E0", "0x7E1", "0x7E2", "0x7E3", "0x7E4", "0x7E5", "0x7E6", "0x7E7", "0x7E8", "0x7E9", "0x7EA", "0x7EB", "0x7EC", "0x7ED", "0x7EE", "0x7EF" ,"0x7F0", "0x7F1", "0x7F2", "0x7F3", "0x7F4", "0x7F5", "0x7F6", "0x7F7", "0x7F8", "0x7F9", "0x7FA", "0x7FB", "0x7FC", "0x7FD", "0x7FE", "0x7FF" + #define CAN_ADDRESS_HEX = $CAN_ADDRESS_HEX_02XX, $CAN_ADDRESS_HEX_03XX, $CAN_ADDRESS_HEX_04XX, $CAN_ADDRESS_HEX_05XX, $CAN_ADDRESS_HEX_06XX, $CAN_ADDRESS_HEX_07XX + + #define PIN_OUT10inv = "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + #define PIN_OUT16inv = "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + + ;Page 1 is the fuel map and axis bins only page = 1 ; name = bits, type, offset, bits @@ -196,7 +212,7 @@ page = 2 algorithm = bits, U08, 38, [2:2], "Speed Density", "Alpha-N" baroCorr = bits, U08, 38, [3:3], "Off", "On" injLayout = bits, U08, 38, [4:5], "Paired", "Semi-Sequential", "INVALID", "Sequential" - canEnable = bits, U08, 38, [6:6], "Disable", "Enable" + unused2-38f= bits, U08, 38, [6:6], "ONE", "INVALID" unused2-38h= bits, U08, 38, [7:7], "No", "Yes" primePulse = scalar, U08, 39, "ms", 0.1, 0.0, 0.0, 25.5, 1 @@ -524,32 +540,37 @@ page = 9 ;CANBUS control (Page 10) ;-------------------------------------------------- page = 10 - enable_candata_in = bits, U08, 0, [0:0], "Off", "On" + #if CAN_COMMANDS + enable_canbus = bits, U08, 0, [0:1], "Off", "On Via Secondary Serial", "ON via Internal CAN ", "INVALID" + #else + enable_canbus = bits, U08, 0, [0:1], "Disable", "Enable", "INVALID", "INVALID" + #endif + enable_candata_in = bits, U08, 0, [2:2], "Off", "On" caninput_sel1 = bits, U08, 1, [0:0], "Off", "On" caninput_sel2 = bits, U08, 2, [0:0], "Off", "On" - caninput_sel3 = bits, U08, 3, [0:0], "Off", "On" - caninput_sel4 = bits, U08, 4, [0:0], "Off", "On" - caninput_sel5 = bits, U08, 5, [0:0], "Off", "On" - caninput_sel6 = bits, U08, 6, [0:0], "Off", "On" - caninput_sel7 = bits, U08, 7, [0:0], "Off", "On" - caninput_sel8 = bits, U08, 8, [0:0], "Off", "On" - caninput_param_group = array , U16, 9, [ 8], "", 1, 0, 0, 65535, 0 - caninput_param_start_byte1 = bits, U08, 25, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + caninput_sel3 = bits, U08, 3, [0:0], "Off", "On" + caninput_sel4 = bits, U08, 4, [0:0], "Off", "On" + caninput_sel5 = bits, U08, 5, [0:0], "Off", "On" + caninput_sel6 = bits, U08, 6, [0:0], "Off", "On" + caninput_sel7 = bits, U08, 7, [0:0], "Off", "On" + caninput_sel8 = bits, U08, 8, [0:0], "Off", "On" + caninput_param_group = array , U16, 9, [ 8], "", 1, 0, 0, 65535, 0 + caninput_param_start_byte1 = bits, U08, 25, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" caninput_param_start_byte2 = bits, U08, 26, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" caninput_param_start_byte3 = bits, U08, 27, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" caninput_param_start_byte4 = bits, U08, 28, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" caninput_param_start_byte5 = bits, U08, 29, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" caninput_param_start_byte6 = bits, U08, 30, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" - caninput_param_start_byte7 = bits, U08, 31, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" - caninput_param_start_byte8 = bits, U08, 32, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" - caninput_param_num_bytes1 = bits, U08, 33, [0:1], "INVALID", "1", "2", "INVALID" + caninput_param_start_byte7 = bits, U08, 31, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + caninput_param_start_byte8 = bits, U08, 32, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + caninput_param_num_bytes1 = bits, U08, 33, [0:1], "INVALID", "1", "2", "INVALID" caninput_param_num_bytes2 = bits, U08, 34, [0:1], "INVALID", "1", "2", "INVALID" caninput_param_num_bytes3 = bits, U08, 35, [0:1], "INVALID", "1", "2", "INVALID" caninput_param_num_bytes4 = bits, U08, 36, [0:1], "INVALID", "1", "2", "INVALID" caninput_param_num_bytes5 = bits, U08, 37, [0:1], "INVALID", "1", "2", "INVALID" caninput_param_num_bytes6 = bits, U08, 38, [0:1], "INVALID", "1", "2", "INVALID" - caninput_param_num_bytes7 = bits, U08, 39, [0:1], "INVALID", "1", "2", "INVALID" - caninput_param_num_bytes8 = bits, U08, 40, [0:1], "INVALID", "1", "2", "INVALID" + caninput_param_num_bytes7 = bits, U08, 39, [0:1], "INVALID", "1", "2", "INVALID" + caninput_param_num_bytes8 = bits, U08, 40, [0:1], "INVALID", "1", "2", "INVALID" unused10_41 = scalar, U08, 41, "", 1, 0, 0, 255, 0 unused10_42 = scalar, U08, 42, "", 1, 0, 0, 255, 0 unused10_43 = scalar, U08, 43, "", 1, 0, 0, 255, 0 @@ -559,33 +580,32 @@ page = 10 unused10_47 = scalar, U08, 47, "", 1, 0, 0, 255, 0 unused10_48 = scalar, U08, 48, "", 1, 0, 0, 255, 0 unused10_49 = scalar, U08, 49, "", 1, 0, 0, 255, 0 - enable_candata_out = bits, U08, 50, [0:0], "Off", "On" - unused10_51 = scalar, U08, 51, "", 1, 0, 0, 255, 0 - unused10_52 = scalar, U08, 52, "", 1, 0, 0, 255, 0 - unused10_53 = scalar, U08, 53, "", 1, 0, 0, 255, 0 - unused10_54 = scalar, U08, 54, "", 1, 0, 0, 255, 0 - unused10_55 = scalar, U08, 55, "", 1, 0, 0, 255, 0 - unused10_56 = scalar, U08, 56, "", 1, 0, 0, 255, 0 - unused10_57 = scalar, U08, 57, "", 1, 0, 0, 255, 0 - unused10_58 = scalar, U08, 58, "", 1, 0, 0, 255, 0 - unused10_59 = scalar, U08, 59, "", 1, 0, 0, 255, 0 - unused10_60 = scalar, U08, 60, "", 1, 0, 0, 255, 0 - unused10_61 = scalar, U08, 61, "", 1, 0, 0, 255, 0 - unused10_62 = scalar, U08, 62, "", 1, 0, 0, 255, 0 - unused10_63 = scalar, U08, 63, "", 1, 0, 0, 255, 0 - unused10_64 = scalar, U08, 64, "", 1, 0, 0, 255, 0 - unused10_65 = scalar, U08, 65, "", 1, 0, 0, 255, 0 - unused10_66 = scalar, U08, 66, "", 1, 0, 0, 255, 0 - unused10_67 = scalar, U08, 67, "", 1, 0, 0, 255, 0 - unused10_68 = scalar, U08, 68, "", 1, 0, 0, 255, 0 - unused10_69 = scalar, U08, 69, "", 1, 0, 0, 255, 0 - unused10_70 = scalar, U08, 70, "", 1, 0, 0, 255, 0 - unused10_71 = scalar, U08, 71, "", 1, 0, 0, 255, 0 - unused10_72 = scalar, U08, 72, "", 1, 0, 0, 255, 0 - unused10_73 = scalar, U08, 73, "", 1, 0, 0, 255, 0 - unused10_74 = scalar, U08, 74, "", 1, 0, 0, 255, 0 - unused10_75 = scalar, U08, 75, "", 1, 0, 0, 255, 0 - unused10_76 = scalar, U08, 76, "", 1, 0, 0, 255, 0 + enable_candata_out = bits, U08, 50, [0:0], "Off", "On" + canoutput_sel1 = bits, U08, 51, [0:0], "Off", "On" + canoutput_sel2 = bits, U08, 52, [0:0], "Off", "On" + canoutput_sel3 = bits, U08, 53, [0:0], "Off", "On" + canoutput_sel4 = bits, U08, 54, [0:0], "Off", "On" + canoutput_sel5 = bits, U08, 55, [0:0], "Off", "On" + canoutput_sel6 = bits, U08, 56, [0:0], "Off", "On" + canoutput_sel7 = bits, U08, 57, [0:0], "Off", "On" + canoutput_sel8 = bits, U08, 58, [0:0], "Off", "On" + canoutput_param_group = array , U16, 59, [ 8], "", 1, 0, 0, 65535, 0 + canoutput_param_start_byte1 = bits, U08, 61, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte2 = bits, U08, 62, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte3 = bits, U08, 63, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte4 = bits, U08, 64, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte5 = bits, U08, 65, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte6 = bits, U08, 66, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte7 = bits, U08, 67, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_start_byte8 = bits, U08, 68, [0:2], "1", "2", "3", "4", "5", "6", "7", "8" + canoutput_param_num_bytes1 = bits, U08, 69, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes2 = bits, U08, 70, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes3 = bits, U08, 71, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes4 = bits, U08, 72, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes5 = bits, U08, 73, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes6 = bits, U08, 74, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes7 = bits, U08, 75, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes8 = bits, U08, 76, [0:1], "INVALID", "1", "2", "INVALID" unused10_77 = scalar, U08, 77, "", 1, 0, 0, 255, 0 unused10_78 = scalar, U08, 78, "", 1, 0, 0, 255, 0 unused10_79 = scalar, U08, 79, "", 1, 0, 0, 255, 0 @@ -609,13 +629,10 @@ page = 10 unused10_97 = scalar, U08, 97, "", 1, 0, 0, 255, 0 unused10_98 = scalar, U08, 98, "", 1, 0, 0, 255, 0 unused10_99 = scalar, U08, 99, "", 1, 0, 0, 255, 0 - unused10_100 = scalar, U08, 100, "", 1, 0, 0, 255, 0 - unused10_101 = scalar, U08, 101, "", 1, 0, 0, 255, 0 - unused10_102 = scalar, U08, 102, "", 1, 0, 0, 255, 0 - unused10_103 = scalar, U08, 103, "", 1, 0, 0, 255, 0 - unused10_104 = scalar, U08, 104, "", 1, 0, 0, 255, 0 - unused10_105 = scalar, U08, 105, "", 1, 0, 0, 255, 0 - unused10_106 = scalar, U08, 106, "", 1, 0, 0, 255, 0 + speeduino_tsCanId = bits, U08, 100, [0:3], $tsCanId_list + true_address = bits, U16, 101, [0:10], $CAN_ADDRESS_HEX + realtime_base_address = bits, U16, 103, [0:10], $CAN_ADDRESS_HEX + obd_address = bits, U16, 105, [0:10], $CAN_ADDRESS_HEX unused10_107 = scalar, U08, 107, "", 1, 0, 0, 255, 0 unused10_108 = scalar, U08, 108, "", 1, 0, 0, 255, 0 unused10_109 = scalar, U08, 109, "", 1, 0, 0, 255, 0 @@ -799,13 +816,15 @@ menuDialog = main subMenu = std_separator - subMenu = canIO, "Serial3 IO Interface" #if CAN_COMMANDS - subMenu = std_separator + subMenu = can_serial3IO, "Canbus/Secondary Serial IO Interface" + subMenu = std_separator subMenu = Canin_config, "Canbus Input Configuration" ;subMenu = std_separator ;subMenu = Canout_config, "Canbus Output Configuration" - #endif + #else + subMenu = serial3IO, "Secondary Serial IO Interface" + #endif menuDialog = main menu = "T&ools" @@ -904,7 +923,14 @@ menuDialog = main flatSSoftWin= "The number of RPM below the flat shift point where the softlimit will be applied (aka Soft limit window). Recommended values are 200-1000" flatSRetard = "The absolute timing (BTDC) that will be used when within the soft limit window" - canEnable = "This Enables the IO on serial3 on mega2560 processor " + #if CAN_COMMANDS + enable_canbus = "This Enables either the secondary serial port or output via internal Can module. Secondary serial is serial3 on mega2560 processor, and Serial2 on STM32 and Teensy processor " + #else + enable_canbus = "This Enables the IO on the secondary serial port. This is serial3 on mega2560 processor, and Serial2 on STM32 and Teensy processor " + #endif + speeduino_tsCanId = "This is the TsCanId that the Speeduino ECU will respond to. This should match the main controller CAN ID in project properties if it is connected directy to TunerStudio, Otherwise the device ID if connected via CAN passthrough" + true_address = "This is the 11bit Can address of the Speeduino ECU " + obd_address = "The 11bit Can address that the Speeduino ECU responds to for OBD2 diagnostic requests" caninput_sel1 = "This Enables CAN data input channel 1 " caninput_sel2 = "This Enables CAN data input channel 2 " caninput_sel3 = "This Enables CAN data input channel 3 " @@ -1049,10 +1075,7 @@ menuDialog = main dialog = tacho, "Tacho" field = "Output pin", tachoPin field = "Output speed", tachoDiv - - dialog = canIO, "CanBus interface" - field = "Enable/Disable", canEnable - + dialog = accelEnrichments_center, "" field = "TPSdot Threshold", tpsThresh field = "Accel Time", taeTime @@ -1401,7 +1424,7 @@ menuDialog = main panel = outputtestspk4 dialog = outputtest1,"Test Output Hardware" - ;topicHelp = "" + topicHelp = "http://speeduino.com/wiki/index.php/Hardware_testing_page" panel = enableoutputtestbuttons panel = outputtest_injectors panel = outputtest_spark @@ -1469,13 +1492,86 @@ menuDialog = main field = "Enable CanBus data input", enable_candata_in dialog = Canin_config, "", border - topicHelp = "file://$getProjectsDirPath()/Docs/speeduino_canbus.txt" + topicHelp = "http://speeduino.com/wiki/index.php/Secondary_Serial_IO_interface#Read_external_analog_data" panel = Canin_config2, North panel = Canin_config1, South - dialog = Canout_config, "Can Data Out" + dialog = canoutput_sel, "" + ;CAN outputs + field = "CAN Output Channel on/off" + field = "CAN Output 1", canoutput_sel1, { enable_candata_out} + field = "CAN Output 2", canoutput_sel2, { enable_candata_out } + field = "CAN Output 3", canoutput_sel3, { enable_candata_out } + field = "CAN Output 4", canoutput_sel4, { enable_candata_out } + field = "CAN Output 5", canoutput_sel5, { enable_candata_out } + field = "CAN Output 6", canoutput_sel6, { enable_candata_out } + field = "CAN Output 7", canoutput_sel7, { enable_candata_out } + field = "CAN Output 8", canoutput_sel8, { enable_candata_out } + + dialog = canoutput_parameter_group, "", yAxis + field = "Output Parameter Group" + field = "", canoutput_param_group[0], { canoutput_sel1 && enable_candata_out } + field = "", canoutput_param_group[1], { canoutput_sel2 && enable_candata_out } + field = "", canoutput_param_group[2], { canoutput_sel3 && enable_candata_out } + field = "", canoutput_param_group[3], { canoutput_sel4 && enable_candata_out } + field = "", canoutput_param_group[4], { canoutput_sel5 && enable_candata_out } + field = "", canoutput_param_group[5], { canoutput_sel6 && enable_candata_out } + field = "", canoutput_param_group[6], { canoutput_sel7 && enable_candata_out } + field = "", canoutput_param_group[7], { canoutput_sel8 && enable_candata_out } + + dialog = canoutput_parameter_start_byte, "", yAxis + field = "Output Parameter Start Byte" + field = "", canoutput_param_start_byte1, { canoutput_sel1 && enable_candata_out } + field = "", canoutput_param_start_byte2, { canoutput_sel2 && enable_candata_out } + field = "", canoutput_param_start_byte3, { canoutput_sel3 && enable_candata_out } + field = "", canoutput_param_start_byte4, { canoutput_sel4 && enable_candata_out } + field = "", canoutput_param_start_byte5, { canoutput_sel5 && enable_candata_out } + field = "", canoutput_param_start_byte6, { canoutput_sel6 && enable_candata_out } + field = "", canoutput_param_start_byte7, { canoutput_sel7 && enable_candata_out } + field = "", canoutput_param_start_byte8, { canoutput_sel8 && enable_candata_out } + + dialog = canoutput_parameter_num_byte, "", yAxis + field = "Output Parameter Number of Bytes" + field = "", canoutput_param_num_bytes1, { canoutput_sel1 && enable_candata_out } + field = "", canoutput_param_num_bytes2, { canoutput_sel2 && enable_candata_out } + field = "", canoutput_param_num_bytes3, { canoutput_sel3 && enable_candata_out } + field = "", canoutput_param_num_bytes4, { canoutput_sel4 && enable_candata_out } + field = "", canoutput_param_num_bytes5, { canoutput_sel5 && enable_candata_out } + field = "", canoutput_param_num_bytes6, { canoutput_sel6 && enable_candata_out } + field = "", canoutput_param_num_bytes7, { canoutput_sel7 && enable_candata_out } + field = "", canoutput_param_num_bytes8, { canoutput_sel8 && enable_candata_out } + + dialog = canoutconfig_blank1,"" + field = "" + + dialog = Canout_config1, "", xAxis + panel = canoutput_sel + panel = canoutconfig_blank1 + panel = canoutput_parameter_group + panel = canoutconfig_blank1 + panel = canoutput_parameter_start_byte + panel = canoutconfig_blank1 + panel = canoutput_parameter_num_byte + + dialog = Canout_config2, "CAN Data Out" field = "Enable CanBus data Output", enable_candata_out + dialog = Canout_config, "", border + topicHelp = "" + panel = Canout_config2, North + panel = Canout_config1, South + + dialog = can_serial3IO, "CanBus/Serial3 IO interface" + topicHelp = "http://speeduino.com/wiki/index.php/Secondary_Serial_IO_interface" + field = "Enable CanBus/Second Serial", enable_canbus + field = "Speeduino TsCanId", speeduino_tsCanId + field = "Realtime Data Base Can Address", realtime_base_address + field = "Speeduino OBD address", obd_address + + dialog = serial3IO, "Serial3 IO interface" + topicHelp = "http://speeduino.com/wiki/index.php/Serial3_IO_interface" + field = "Enable Second Serial", enable_canbus + ;------------------------------------------------------------------------------- ; General help text @@ -1958,7 +2054,7 @@ cmdtestspk450dc = "E\x03\x0C" deadValue = { 0 } ; Convenient unchanging value. - ochGetCommand = "r\$tsCanId\x07%2o%2c" + ochGetCommand = "r\$tsCanId\x30%2o%2c" ochBlockSize = 57 secl = scalar, U08, 0, "sec", 1.000, 0.000 diff --git a/speeduino/cancomms.ino b/speeduino/cancomms.ino index 5c88582d..87caa81b 100644 --- a/speeduino/cancomms.ino +++ b/speeduino/cancomms.ino @@ -84,7 +84,31 @@ void canCommand() Lbuffer[Lcount] = Serial3.read(); } break; + + case 'r': //New format for the optimised OutputChannels + // cmdPending = true; + byte cmd; + if (Serial.available() < 6) { return; } + Serial.read(); //Read the $tsCanId + cmd = Serial.read(); + uint16_t offset, length; + if(cmd == 0x30) //Send output channels command 0x30 is 48dec + { + byte tmp; + tmp = Serial.read(); + offset = word(Serial.read(), tmp); + tmp = Serial.read(); + length = word(Serial.read(), tmp); + sendValues(offset, length, 3); + } + else + { + //No other r/ commands should be called + } + cmdPending = false; + break; + case 'S': // send code version for (unsigned int sig = 0; sig < sizeof(displaySignature) - 1; sig++){ Serial3.write(displaySignature[sig]); @@ -104,7 +128,7 @@ void canCommand() } } -// this routine sends a request(either "0" for a "G" or "1" for a "L" to the Can interface +// this routine sends a request(either "0" for a "G" , "1" for a "L" , "2" for a "R" to the Can interface or "3" sends the request via the actual local canbus void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint8_t candata2, uint16_t paramgroup) { switch (cmdtype) @@ -125,7 +149,11 @@ void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint Serial3.print("R"); Serial3.write( lowByte(paramgroup) ); //send lsb first Serial3.write( lowByte(paramgroup >> 8) ); - break; + break; + + case 3: + //send to truecan send routine + break; } } diff --git a/speeduino/comms.h b/speeduino/comms.h index 52817a85..bd18276d 100644 --- a/speeduino/comms.h +++ b/speeduino/comms.h @@ -23,6 +23,7 @@ byte cmdGroup = 0; byte cmdValue = 0; int cmdCombined = 0; //the cmdgroup as high byte and cmdvalue as low byte byte cmdStore[8]; //array storing pre test values +byte tsCanId = 0; // current tscanid requested const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of { diff --git a/speeduino/comms.ino b/speeduino/comms.ino index d6d5bbfa..792203e7 100644 --- a/speeduino/comms.ino +++ b/speeduino/comms.ino @@ -173,11 +173,11 @@ void command() cmdPending = true; byte cmd; if (Serial.available() < 6) { return; } - Serial.read(); //Read the $tsCanId - cmd = Serial.read(); + tsCanId = Serial.read(); //Read the $tsCanId + cmd = Serial.read(); // read the command uint16_t offset, length; - if(cmd == 0x07) //Send output channels command + if(cmd == 0x30) //Send output channels command 0x30 is 48dec { byte tmp; tmp = Serial.read(); @@ -246,10 +246,24 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte portNum) { //CAN serial #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 - Serial3.write("A"); //confirm cmd type + if (offset == 0) + { + Serial3.write("A"); //confirm cmd type + } + else + { + Serial3.write("r"); //confirm cmd type + } Serial3.write(packetLength); //confirm no of byte to be sent - #elif defined(CORE_STM32) - Serial2.write("A"); //confirm cmd type + #elif defined(CORE_STM32) || defined (CORE_TEENSY) + if (offset == 0) + { + Serial2.write("A"); //confirm cmd type + } + else + { + Serial2.write("r"); //confirm cmd type + } Serial2.write(packetLength); //confirm no of byte to be sent #endif } @@ -338,6 +352,8 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte portNum) else if (portNum == 3) { Serial3.write(response, (size_t)packetLength); } #elif defined(CORE_STM32) else if (portNum == 3) { Serial2.write(response, (size_t)packetLength); } + #elif defined(CORE_TEENSY) + else if (portNum == 3) { Serial2.write(response, (size_t)packetLength); } #endif //sei(); return; diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index 083d32d5..143f5a27 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -628,7 +628,7 @@ int getRPM_4G63() //if(currentStatus.startRevolutions < 2) { return 0; } //Need at least 2 full revolutions to prevent crazy initial rpm value int tempToothAngle; unsigned long toothTime; - if(toothLastToothTime == 0 || toothLastMinusOneToothTime == 0) { return; } + if(toothLastToothTime == 0 || toothLastMinusOneToothTime == 0) { return 0; } noInterrupts(); tempToothAngle = triggerToothAngle; diff --git a/speeduino/globals.h b/speeduino/globals.h index 8192bf9a..95cde514 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -296,7 +296,7 @@ struct config1 { byte algorithm : 1; //"Speed Density", "Alpha-N" byte baroCorr : 1; byte injLayout : 2; - byte canEnable : 1; //is can interface enabled + byte unused2_38g : 1; byte unused2_38h : 1; byte primePulse; @@ -497,6 +497,7 @@ struct config4 { //Page 10 of the config mostly deals with CANBUS control //See ini file for further info (Config Page 10 in the ini) struct config10 { + byte enable_canbus:2; byte enable_candata_in:1; byte caninput_sel[8]; uint16_t caninput_param_group[8]; @@ -512,31 +513,10 @@ struct config10 { byte unused10_48; byte unused10_49; byte enable_candata_out : 1; - byte unused10_51; - byte unused10_52; - byte unused10_53; - byte unused10_54; - byte unused10_55; - byte unused10_56; - byte unused10_57; - byte unused10_58; - byte unused10_59; - byte unused10_60; - byte unused10_61; - byte unused10_62; - byte unused10_63; - byte unused10_64; - byte unused10_65; - byte unused10_66; - byte unused10_67; - byte unused10_68; - byte unused10_69; - byte unused10_70; - byte unused10_71; - byte unused10_72; - byte unused10_73; - byte unused10_74; - byte unused10_75; + byte canoutput_sel[8]; + uint16_t canoutput_param_group[8]; + uint8_t canoutput_param_start_byte[8]; + byte canoutput_param_num_bytes[8]; byte unused10_76; byte unused10_77; byte unused10_78; @@ -561,13 +541,10 @@ struct config10 { byte unused10_97; byte unused10_98; byte unused10_99; - byte unused10_100; - byte unused10_101; - byte unused10_102; - byte unused10_103; - byte unused10_104; - byte unused10_105; - byte unused10_106; + byte speeduino_tsCanId:4; //speeduino TS canid (0-14) + uint16_t true_address; //speeduino 11bit can address + uint16_t realtime_base_address; //speeduino 11 bit realtime base address + uint16_t obd_address; //speeduino OBD diagnostic address byte unused10_107; byte unused10_108; byte unused10_109; diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 5e0a4f52..fb7d6ea4 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -45,6 +45,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "storage.h" #include "scheduledIO.h" #include +#if defined (CORE_TEENSY) +#include +#endif struct config1 configPage1; struct config2 configPage2; @@ -153,7 +156,22 @@ void setup() Serial.begin(115200); #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 - if (configPage1.canEnable) { Serial3.begin(115200); } + if (configPage10.enable_canbus == 1) { Serial3.begin(115200); } +#elif defined(CORE_STM32) + if (configPage10.enable_canbus == 1) { Serial2.begin(115200); } + else if (configPage10.enable_canbus == 2) + { + //enable local can interface + } +#elif defined(CORE_TEESNY) + if (configPage10.enable_canbus == 1) { Serial2.begin(115200); } + else if (configPage10.enable_canbus == 2) + { + //enable local can interface + FlexCAN CANbus0(2500000, 0); //setup can interface to 250k + static CAN_message_t txmsg,rxmsg; + CANbus0.begin(); + } #endif //Repoint the 2D table structs to the config pages that were just loaded @@ -822,10 +840,11 @@ void loop() command(); } } + #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 - //if Can interface is enabled then check for serial3 requests. - if (configPage1.canEnable) - { + //if serial3 interface is enabled then check for serial3 requests. + if (configPage10.enable_canbus == 1) + { if ( ((mainLoopCount & 31) == 1) or (Serial3.available() > SERIAL_BUFFER_THRESHOLD) ) { if (Serial3.available() > 0) @@ -834,6 +853,43 @@ void loop() } } } + +#elif defined(CORE_STM32) + //if can or secondary serial interface is enabled then check for requests. + if (configPage10.enable_canbus == 1) //secondary serial interface enabled + { + if ( ((mainLoopCount & 31) == 1) or (Serial2.available() > SERIAL_BUFFER_THRESHOLD) ) + { + if (Serial2.available() > 0) + { + canCommand(); + } + } + } + else if (configPage10.enable_canbus == 2) // can module enabled + { + //check local can module + } +#elif defined(CORE_TEENSY) + //if can or secondary serial interface is enabled then check for requests. + if (configPage10.enable_canbus == 1) //secondary serial interface enabled + { + if ( ((mainLoopCount & 31) == 1) or (Serial2.available() > SERIAL_BUFFER_THRESHOLD) ) + { + if (Serial2.available() > 0) + { + canCommand(); + } + } + } + else if (configPage10.enable_canbus == 2) // can module enabled + { + //check local can module + // if ( ((mainLoopCount & 31) == 1) or (CANbus0.available()) + // { + // CANbus0.read(rx_msg); + // } + } #endif // if (configPage1.displayType && (mainLoopCount & 255) == 1) { updateDisplay();} //Displays currently disabled @@ -935,7 +991,7 @@ void loop() readBat(); #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 //if Can interface is enabled then check for serial3 requests. - if (configPage1.canEnable) + if (configPage10.enable_canbus == 1) // megas only support can via secondary serial { if (configPage10.enable_candata_in) { @@ -956,6 +1012,34 @@ void loop() } } } +#elif defined(CORE_STM32) || defined(CORE_TEENSY) + //if serial3io is enabled then check for serial3 requests. + if (configPage10.enable_candata_in) + { + if (configPage10.caninput_sel[currentStatus.current_caninchannel]) //if current input channel is enabled + { + if (configPage10.enable_canbus == 1) //can via secondary serial + { + sendCancommand(2,0,0,0,configPage10.caninput_param_group[currentStatus.current_caninchannel]); //send an R command for data from paramgroup[currentStatus.current_caninchannel] + } + else if (configPage10.enable_canbus == 2) // can via internal can module + { + sendCancommand(3,configPage10.speeduino_tsCanId,0,0,configPage10.caninput_param_group[currentStatus.current_caninchannel]); //send via localcanbus the command for data from paramgroup[currentStatus.current_caninchannel] + } + } + else + { + if (currentStatus.current_caninchannel <= 6) + { + currentStatus.current_caninchannel++; //step to next input channel if under 9 + } + else + { + currentStatus.current_caninchannel = 0; //reset input channel back to 1 + } + } + } + #endif vvtControl(); idleControl(); //Perform any idle related actions. Even at higher frequencies, running 4x per second is sufficient.