diff --git a/reference/speeduino.ini b/reference/speeduino.ini index a9f824e1..63c4393d 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -127,7 +127,7 @@ #define PIN_OUT16inv = "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" #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_inv255 = $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT10inv, "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "blank" + #define CAN_ADDRESS_HEX_inv255 = $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT16inv, $PIN_OUT10inv, "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" #define CAN_ADDRESS_HEX_00XX = "INVALID", "0x001", "0x002", "0x003", "0x004", "0x005", "0x006", "0x007", "0x008", "0x009", "0x00A", "0x00B", "0x00C", "0x00D", "0x00E", "0x00F", "0x010", "0x011", "0x012", "0x013", "0x014", "0x015", "0x016", "0x017", "0x018", "0x019", "0x01A", "0x01B", "0x01C", "0x01D", "0x01E", "0x01F", "0x020", "0x021", "0x022", "0x023", "0x024", "0x025", "0x026", "0x027", "0x028", "0x029", "0x02A", "0x02B", "0x02C", "0x02D", "0x02E", "0x02F", "0x030", "0x031", "0x032", "0x033", "0x034", "0x035", "0x036", "0x037", "0x038", "0x039", "0x03A", "0x03B", "0x03C", "0x03D", "0x03E", "0x03F", "0x040", "0x041", "0x042", "0x043", "0x044", "0x045", "0x046", "0x047", "0x048", "0x049", "0x04A", "0x04B", "0x04C", "0x04D", "0x04E", "0x04F", "0x050", "0x051", "0x052", "0x053", "0x054", "0x055", "0x056", "0x057", "0x058", "0x059", "0x05A", "0x05B", "0x05C", "0x05D", "0x05E", "0x05F" ,"0x060", "0x061", "0x062", "0x063", "0x064", "0x065", "0x066", "0x067", "0x068", "0x069", "0x06A", "0x06B", "0x06C", "0x06D", "0x06E", "0x06F", "0x070", "0x071", "0x072", "0x073", "0x074", "0x075", "0x076", "0x077", "0x078", "0x079", "0x07A", "0x07B", "0x07C", "0x07D", "0x07E", "0x07F", "0x080", "0x081", "0x082", "0x083", "0x084", "0x085", "0x086", "0x087", "0x088", "0x089", "0x08A", "0x08B", "0x08C", "0x08D", "0x08E", "0x08F" ,"0x090", "0x091", "0x092", "0x093", "0x094", "0x095", "0x096", "0x097", "0x098", "0x099", "0x09A", "0x09B", "0x09C", "0x09D", "0x09E", "0x09F", "0x0A0", "0x0A1", "0x0A2", "0x0A3", "0x0A4", "0x0A5", "0x0A6", "0x0A7", "0x0A8", "0x0A9", "0x0AA", "0x0AB", "0x0AC", "0x0AD", "0x0AE", "0x0AF", "0x0B0", "0x0B1", "0x0B2", "0x0B3", "0x0B4", "0x0B5", "0x0B6", "0x0B7", "0x0B8", "0x0B9", "0x0BA", "0x0BB", "0x0BC", "0x0BD", "0x0BE", "0x0BF" ,"0x0C0", "0x0C1", "0x0C2", "0x0C3", "0x0C4", "0x0C5", "0x0C6", "0x0C7", "0x0C8", "0x0C9", "0x0CA", "0x0CB", "0x0CC", "0x0CD", "0x0CE", "0x0CF", "0x0D0", "0x0D1", "0x0D2", "0x0D3", "0x0D4", "0x0D5", "0x0D6", "0x0D7", "0x0D8", "0x0D9", "0x0DA", "0x0DB", "0x0DC", "0x0DD", "0x0DE", "0x0DF", "0x0E0", "0x0E1", "0x0E2", "0x0E3", "0x0E4", "0x0E5", "0x0E6", "0x0E7", "0x0E8", "0x0E9", "0x0EA", "0x0EB", "0x0EC", "0x0ED", "0x0EE", "0x0EF" ,"0x0F0", "0x0F1", "0x0F2", "0x0F3", "0x0F4", "0x0F5", "0x0F6", "0x0F7", "0x0F8", "0x0F9", "0x0FA", "0x0FB", "0x0FC", "0x0FD", "0x0FE", "0x0FF" #define CAN_ADDRESS_HEX_01XX = "0x100", "0x101", "0x102", "0x103", "0x104", "0x105", "0x106", "0x107", "0x108", "0x109", "0x10A", "0x10B", "0x10C", "0x10D", "0x10E", "0x10F", "0x110", "0x111", "0x112", "0x113", "0x114", "0x115", "0x116", "0x117", "0x118", "0x119", "0x11A", "0x11B", "0x11C", "0x11D", "0x11E", "0x11F", "0x120", "0x121", "0x122", "0x123", "0x124", "0x125", "0x126", "0x127", "0x128", "0x129", "0x12A", "0x12B", "0x12C", "0x12D", "0x12E", "0x12F", "0x130", "0x131", "0x132", "0x133", "0x134", "0x135", "0x136", "0x137", "0x138", "0x139", "0x13A", "0x13B", "0x13C", "0x13D", "0x13E", "0x13F", "0x140", "0x141", "0x142", "0x143", "0x144", "0x145", "0x146", "0x147", "0x148", "0x149", "0x14A", "0x14B", "0x14C", "0x14D", "0x14E", "0x14F", "0x150", "0x151", "0x152", "0x153", "0x154", "0x155", "0x156", "0x157", "0x158", "0x159", "0x15A", "0x15B", "0x15C", "0x15D", "0x15E", "0x15F" ,"0x160", "0x161", "0x162", "0x163", "0x164", "0x165", "0x166", "0x167", "0x168", "0x169", "0x16A", "0x16B", "0x16C", "0x16D", "0x16E", "0x16F", "0x170", "0x171", "0x172", "0x173", "0x174", "0x175", "0x176", "0x177", "0x178", "0x179", "0x17A", "0x17B", "0x17C", "0x17D", "0x17E", "0x17F", "0x180", "0x181", "0x182", "0x183", "0x184", "0x185", "0x186", "0x187", "0x188", "0x189", "0x18A", "0x18B", "0x18C", "0x18D", "0x18E", "0x18F" ,"0x190", "0x191", "0x192", "0x193", "0x194", "0x195", "0x196", "0x197", "0x198", "0x199", "0x19A", "0x19B", "0x19C", "0x19D", "0x19E", "0x19F", "0x1A0", "0x1A1", "0x1A2", "0x1A3", "0x1A4", "0x1A5", "0x1A6", "0x1A7", "0x1A8", "0x1A9", "0x1AA", "0x1AB", "0x1AC", "0x1AD", "0x1AE", "0x1AF", "0x1B0", "0x1B1", "0x1B2", "0x1B3", "0x1B4", "0x1B5", "0x1B6", "0x1B7", "0x1B8", "0x1B9", "0x1BA", "0x1BB", "0x1BC", "0x1BD", "0x1BE", "0x1BF" ,"0x1C0", "0x1C1", "0x1C2", "0x1C3", "0x1C4", "0x1C5", "0x1C6", "0x1C7", "0x1C8", "0x1C9", "0x1CA", "0x1CB", "0x1CC", "0x1CD", "0x1CE", "0x1CF", "0x1D0", "0x1D1", "0x1D2", "0x1D3", "0x1D4", "0x1D5", "0x1D6", "0x1D7", "0x1D8", "0x1D9", "0x1DA", "0x1DB", "0x1DC", "0x1DD", "0x1DE", "0x1DF", "0x1E0", "0x1E1", "0x1E2", "0x1E3", "0x1E4", "0x1E5", "0x1E6", "0x1E7", "0x1E8", "0x1E9", "0x1EA", "0x1EB", "0x1EC", "0x1ED", "0x1EE", "0x1EF" ,"0x1F0", "0x1F1", "0x1F2", "0x1F3", "0x1F4", "0x1F5", "0x1F6", "0x1F7", "0x1F8", "0x1F9", "0x1FA", "0x1FB", "0x1FC", "0x1FD", "0x1FE", "0x1FF" #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" @@ -558,58 +558,58 @@ page = 9 caninput_sel15 = bits, U16, 1, [15:15], "Off", "On" ;caninput_param_group = array , U16, 9, [ 8], "", 1, 0, 0, 65535, 0 - caninput_param_group0 = bits, U16, 3, [0:10], $CAN_ADDRESS_HEX - caninput_param_group1 = bits, U16, 5, [0:10], $CAN_ADDRESS_HEX - caninput_param_group2 = bits, U16, 7, [0:10], $CAN_ADDRESS_HEX - caninput_param_group3 = bits, U16, 9, [0:10], $CAN_ADDRESS_HEX - caninput_param_group4 = bits, U16, 11, [0:10], $CAN_ADDRESS_HEX - caninput_param_group5 = bits, U16, 13, [0:10], $CAN_ADDRESS_HEX - caninput_param_group6 = bits, U16, 15, [0:10], $CAN_ADDRESS_HEX - caninput_param_group7 = bits, U16, 17, [0:10], $CAN_ADDRESS_HEX - caninput_param_group8 = bits, U16, 19, [0:10], $CAN_ADDRESS_HEX - caninput_param_group9 = bits, U16, 21, [0:10], $CAN_ADDRESS_HEX - caninput_param_group10 = bits, U16, 23, [0:10], $CAN_ADDRESS_HEX - caninput_param_group11 = bits, U16, 25, [0:10], $CAN_ADDRESS_HEX - caninput_param_group12 = bits, U16, 27, [0:10], $CAN_ADDRESS_HEX - caninput_param_group13 = bits, U16, 29, [0:10], $CAN_ADDRESS_HEX - caninput_param_group14 = bits, U16, 31, [0:10], $CAN_ADDRESS_HEX - caninput_param_group15 = bits, U16, 33, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address0 = bits, U16, 3, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address1 = bits, U16, 5, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address2 = bits, U16, 7, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address3 = bits, U16, 9, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address4 = bits, U16, 11, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address5 = bits, U16, 13, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address6 = bits, U16, 15, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address7 = bits, U16, 17, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address8 = bits, U16, 19, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address9 = bits, U16, 21, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address10 = bits, U16, 23, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address11 = bits, U16, 25, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address12 = bits, U16, 27, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address13 = bits, U16, 29, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address14 = bits, U16, 31, [0:10], $CAN_ADDRESS_HEX + caninput_source_can_address15 = bits, U16, 33, [0:10], $CAN_ADDRESS_HEX - caninput_param_start_byte0 = bits, U08, 35, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte1 = bits, U08, 36, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte2 = bits, U08, 37, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte3 = bits, U08, 38, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte4 = bits, U08, 39, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte5 = bits, U08, 40, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte6 = bits, U08, 41, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte7 = bits, U08, 42, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte8 = bits, U08, 43, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte9 = bits, U08, 44, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte10 = bits, U08, 45, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte11 = bits, U08, 46, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte12 = bits, U08, 47, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte13 = bits, U08, 48, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte14 = bits, U08, 49, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_start_byte15 = bits, U08, 50, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte0 = bits, U08, 35, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte1 = bits, U08, 36, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte2 = bits, U08, 37, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte3 = bits, U08, 38, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte4 = bits, U08, 39, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte5 = bits, U08, 40, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte6 = bits, U08, 41, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte7 = bits, U08, 42, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte8 = bits, U08, 43, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte9 = bits, U08, 44, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte10 = bits, U08, 45, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte11 = bits, U08, 46, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte12 = bits, U08, 47, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte13 = bits, U08, 48, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte14 = bits, U08, 49, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + caninput_source_start_byte15 = bits, U08, 50, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - caninput_param_num_bytes0 = bits, U16, 51, [0:0], "1", "2" - caninput_param_num_bytes1 = bits, U16, 51, [1:1], "1", "2" - caninput_param_num_bytes2 = bits, U16, 51, [2:2], "1", "2" - caninput_param_num_bytes3 = bits, U16, 51, [3:3], "1", "2" - caninput_param_num_bytes4 = bits, U16, 51, [4:4], "1", "2" - caninput_param_num_bytes5 = bits, U16, 51, [5:5], "1", "2" - caninput_param_num_bytes6 = bits, U16, 51, [6:6], "1", "2" - caninput_param_num_bytes7 = bits, U16, 51, [7:7], "1", "2" - caninput_param_num_bytes8 = bits, U16, 51, [8:8], "1", "2" - caninput_param_num_bytes9 = bits, U16, 51, [9:9], "1", "2" - caninput_param_num_bytes10 = bits, U16, 51, [10:10], "1", "2" - caninput_param_num_bytes11 = bits, U16, 51, [11:11], "1", "2" - caninput_param_num_bytes12 = bits, U16, 51, [12:12], "1", "2" - caninput_param_num_bytes13 = bits, U16, 51, [13:13], "1", "2" - caninput_param_num_bytes14 = bits, U16, 51, [14:14], "1", "2" - caninput_param_num_bytes15 = bits, U16, 51, [15:15], "1", "2" + caninput_source_num_bytes0 = bits, U16, 51, [0:0], "1", "2" + caninput_source_num_bytes1 = bits, U16, 51, [1:1], "1", "2" + caninput_source_num_bytes2 = bits, U16, 51, [2:2], "1", "2" + caninput_source_num_bytes3 = bits, U16, 51, [3:3], "1", "2" + caninput_source_num_bytes4 = bits, U16, 51, [4:4], "1", "2" + caninput_source_num_bytes5 = bits, U16, 51, [5:5], "1", "2" + caninput_source_num_bytes6 = bits, U16, 51, [6:6], "1", "2" + caninput_source_num_bytes7 = bits, U16, 51, [7:7], "1", "2" + caninput_source_num_bytes8 = bits, U16, 51, [8:8], "1", "2" + caninput_source_num_bytes9 = bits, U16, 51, [9:9], "1", "2" + caninput_source_num_bytes10 = bits, U16, 51, [10:10], "1", "2" + caninput_source_num_bytes11 = bits, U16, 51, [11:11], "1", "2" + caninput_source_num_bytes12 = bits, U16, 51, [12:12], "1", "2" + caninput_source_num_bytes13 = bits, U16, 51, [13:13], "1", "2" + caninput_source_num_bytes14 = bits, U16, 51, [14:14], "1", "2" + caninput_source_num_bytes15 = bits, U16, 51, [15:15], "1", "2" unused10_53 = scalar, U08, 53, "", 1, 0, 0, 255, 0 unused10_54 = scalar, U08, 54, "", 1, 0, 0, 255, 0 @@ -629,26 +629,26 @@ page = 9 canoutput_param_start_byte3 = bits, U08, 83, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" canoutput_param_start_byte4 = bits, U08, 84, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" canoutput_param_start_byte5 = bits, U08, 85, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - canoutput_param_start_byte6 = bits, U08, 86, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - canoutput_param_start_byte7 = bits, U08, 87, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" - canoutput_param_num_bytes0 = bits, U08, 88, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes1 = bits, U08, 89, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes2 = bits, U08, 90, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes3 = bits, U08, 91, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes4 = bits, U08, 92, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes5 = bits, U08, 93, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes6 = bits, U08, 94, [0:1], "INVALID", "1", "2", "INVALID" - canoutput_param_num_bytes7 = bits, U08, 95, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_start_byte6 = bits, U08, 86, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + canoutput_param_start_byte7 = bits, U08, 87, [0:2], "0", "1", "2", "3", "4", "5", "6", "7" + canoutput_param_num_bytes0 = bits, U08, 88, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes1 = bits, U08, 89, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes2 = bits, U08, 90, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes3 = bits, U08, 91, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes4 = bits, U08, 92, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes5 = bits, U08, 93, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes6 = bits, U08, 94, [0:1], "INVALID", "1", "2", "INVALID" + canoutput_param_num_bytes7 = bits, U08, 95, [0:1], "INVALID", "1", "2", "INVALID" unused10_96 = scalar, U08, 96, "", 1, 0, 0, 255, 0 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 - 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 + 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_101 = scalar, U16, 101, "", 1, 0, 0, 255, 0 @@ -878,7 +878,7 @@ menuDialog = main #if CAN_COMMANDS subMenu = can_serial3IO, "Canbus/Secondary Serial IO Interface" subMenu = std_separator - subMenu = Canin_config, "Canbus Input Configuration", {enable_canbus} + subMenu = Canin_config, "External Data Input Configuration", {enable_canbus} ;subMenu = std_separator ;subMenu = Canout_config, "Canbus Output Configuration" #else @@ -989,7 +989,7 @@ menuDialog = main #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 " - realtime_base_address = "This is the 11bit CAN address of the realtime data broadcast from the Speeduino ECU" + realtime_base_address = "This is the 11bit CAN address of the realtime data broadcast from the Speeduino ECU. This MUST be at least 0x16 greater than the true address" ;obd_address = "The 11bit Can address that the Speeduino ECU responds to for OBD2 diagnostic requests" caninput_sel0 = "This Enables CAN data input channel 0 " caninput_sel1 = "This Enables CAN data input channel 1 " @@ -999,7 +999,7 @@ menuDialog = main caninput_sel5 = "This Enables CAN data input channel 5 " caninput_sel6 = "This Enables CAN data input channel 6 " caninput_sel7 = "This Enables CAN data input channel 7 " - caninput_sel8 = "This Enables CAN data input channel 8 " + caninput_sel8 = "This Enables CAN data input channel 8 " caninput_sel9 = "This Enables CAN data input channel 9 " caninput_sel10 = "This Enables CAN data input channel 10 " caninput_sel11 = "This Enables CAN data input channel 11 " @@ -1007,54 +1007,54 @@ menuDialog = main caninput_sel13 = "This Enables CAN data input channel 13 " caninput_sel14 = "This Enables CAN data input channel 14 " caninput_sel15 = "This Enables CAN data input channel 15 " - caninput_param_group0 = "The source 11bit CAN address of the data for channel 0" - caninput_param_group1 = "The source 11bit CAN address of the data for channel 1" - caninput_param_group2 = "The source 11bit CAN address of the data for channel 2" - caninput_param_group3 = "The source 11bit CAN address of the data for channel 3" - caninput_param_group4 = "The source 11bit CAN address of the data for channel 4" - caninput_param_group5 = "The source 11bit CAN address of the data for channel 5" - caninput_param_group6 = "The source 11bit CAN address of the data for channel 6" - caninput_param_group7 = "The source 11bit CAN address of the data for channel 7" - caninput_param_group8 = "The source 11bit CAN address of the data for channel 8 " - caninput_param_group9 = "The source 11bit CAN address of the data for channel 9" - caninput_param_group10 = "The source 11bit CAN address of the data for channel 10" - caninput_param_group11 = "The source 11bit CAN address of the data for channel 11" - caninput_param_group12 = "The source 11bit CAN address of the data for channel 12" - caninput_param_group13 = "The source 11bit CAN address of the data for channel 13" - caninput_param_group14 = "The source 11bit CAN address of the data for channel 14" - caninput_param_group15 = "The source 11bit CAN address of the data for channel 15" - caninput_param_start_byte0 = "The Starting byte the data begins at for channel 0" - caninput_param_start_byte1 = "The Starting byte the data begins at for channel 1" - caninput_param_start_byte2 = "The Starting byte the data begins at for channel 2" - caninput_param_start_byte3 = "The Starting byte the data begins at for channel 3" - caninput_param_start_byte4 = "The Starting byte the data begins at for channel 4" - caninput_param_start_byte5 = "The Starting byte the data begins at for channel 5" - caninput_param_start_byte6 = "The Starting byte the data begins at for channel 6" - caninput_param_start_byte7 = "The Starting byte the data begins at for channel 7" - caninput_param_start_byte8 = "The Starting byte the data begins at for channel 8" - caninput_param_start_byte9 = "The Starting byte the data begins at for channel 9" - caninput_param_start_byte10 = "The Starting byte the data begins at for channel 10" - caninput_param_start_byte11 = "The Starting byte the data begins at for channel 11" - caninput_param_start_byte12 = "The Starting byte the data begins at for channel 12" - caninput_param_start_byte13 = "The Starting byte the data begins at for channel 13" - caninput_param_start_byte14 = "The Starting byte the data begins at for channel 14" - caninput_param_start_byte15 = "The Starting byte the data begins at for channel 15" - caninput_param_num_bytes0 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes1 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes2 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes3 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes4 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes5 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes6 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes7 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes8 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes9 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes10 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes11 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes12 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes13 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes14 = "The number of bytes the data is made from starting at selected start byte number" - caninput_param_num_bytes15 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_can_address0 = "The source 11bit CAN address of the data for channel 0" + caninput_source_can_address1 = "The source 11bit CAN address of the data for channel 1" + caninput_source_can_address2 = "The source 11bit CAN address of the data for channel 2" + caninput_source_can_address3 = "The source 11bit CAN address of the data for channel 3" + caninput_source_can_address4 = "The source 11bit CAN address of the data for channel 4" + caninput_source_can_address5 = "The source 11bit CAN address of the data for channel 5" + caninput_source_can_address6 = "The source 11bit CAN address of the data for channel 6" + caninput_source_can_address7 = "The source 11bit CAN address of the data for channel 7" + caninput_source_can_address8 = "The source 11bit CAN address of the data for channel 8 " + caninput_source_can_address9 = "The source 11bit CAN address of the data for channel 9" + caninput_source_can_address10 = "The source 11bit CAN address of the data for channel 10" + caninput_source_can_address11 = "The source 11bit CAN address of the data for channel 11" + caninput_source_can_address12 = "The source 11bit CAN address of the data for channel 12" + caninput_source_can_address13 = "The source 11bit CAN address of the data for channel 13" + caninput_source_can_address14 = "The source 11bit CAN address of the data for channel 14" + caninput_source_can_address15 = "The source 11bit CAN address of the data for channel 15" + caninput_source_start_byte0 = "The Starting byte the data begins at for channel 0" + caninput_source_start_byte1 = "The Starting byte the data begins at for channel 1" + caninput_source_start_byte2 = "The Starting byte the data begins at for channel 2" + caninput_source_start_byte3 = "The Starting byte the data begins at for channel 3" + caninput_source_start_byte4 = "The Starting byte the data begins at for channel 4" + caninput_source_start_byte5 = "The Starting byte the data begins at for channel 5" + caninput_source_start_byte6 = "The Starting byte the data begins at for channel 6" + caninput_source_start_byte7 = "The Starting byte the data begins at for channel 7" + caninput_source_start_byte8 = "The Starting byte the data begins at for channel 8" + caninput_source_start_byte9 = "The Starting byte the data begins at for channel 9" + caninput_source_start_byte10 = "The Starting byte the data begins at for channel 10" + caninput_source_start_byte11 = "The Starting byte the data begins at for channel 11" + caninput_source_start_byte12 = "The Starting byte the data begins at for channel 12" + caninput_source_start_byte13 = "The Starting byte the data begins at for channel 13" + caninput_source_start_byte14 = "The Starting byte the data begins at for channel 14" + caninput_source_start_byte15 = "The Starting byte the data begins at for channel 15" + caninput_source_num_bytes0 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes1 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes2 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes3 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes4 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes5 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes6 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes7 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes8 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes9 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes10 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes11 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes12 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes13 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes14 = "The number of bytes the data is made from starting at selected start byte number" + caninput_source_num_bytes15 = "The number of bytes the data is made from starting at selected start byte number" cmdEnableTestMode = "Click this to enable test mode. This will not be available if the engine is running" cmdStopTestMode = "Click this to disable test mode" @@ -1561,60 +1561,60 @@ menuDialog = main dialog = caninput_parameter_group, "", yAxis field = " Source CAN Address" - field = "", caninput_param_group0, { caninput_sel0 && enable_candata_in } - field = "", caninput_param_group1, { caninput_sel1 && enable_candata_in } - field = "", caninput_param_group2, { caninput_sel2 && enable_candata_in } - field = "", caninput_param_group3, { caninput_sel3 && enable_candata_in } - field = "", caninput_param_group4, { caninput_sel4 && enable_candata_in } - field = "", caninput_param_group5, { caninput_sel5 && enable_candata_in } - field = "", caninput_param_group6, { caninput_sel6 && enable_candata_in } - field = "", caninput_param_group7, { caninput_sel7 && enable_candata_in } - field = "", caninput_param_group8, { caninput_sel8 && enable_candata_in } - field = "", caninput_param_group9, { caninput_sel9 && enable_candata_in } - field = "", caninput_param_group10, { caninput_sel10 && enable_candata_in } - field = "", caninput_param_group11, { caninput_sel11 && enable_candata_in } - field = "", caninput_param_group12, { caninput_sel12 && enable_candata_in } - field = "", caninput_param_group13, { caninput_sel13 && enable_candata_in } - field = "", caninput_param_group14, { caninput_sel14 && enable_candata_in } - field = "", caninput_param_group15, { caninput_sel15 && enable_candata_in } + field = "", caninput_source_can_address0, { caninput_sel0 && enable_candata_in } + field = "", caninput_source_can_address1, { caninput_sel1 && enable_candata_in } + field = "", caninput_source_can_address2, { caninput_sel2 && enable_candata_in } + field = "", caninput_source_can_address3, { caninput_sel3 && enable_candata_in } + field = "", caninput_source_can_address4, { caninput_sel4 && enable_candata_in } + field = "", caninput_source_can_address5, { caninput_sel5 && enable_candata_in } + field = "", caninput_source_can_address6, { caninput_sel6 && enable_candata_in } + field = "", caninput_source_can_address7, { caninput_sel7 && enable_candata_in } + field = "", caninput_source_can_address8, { caninput_sel8 && enable_candata_in } + field = "", caninput_source_can_address9, { caninput_sel9 && enable_candata_in } + field = "", caninput_source_can_address10, { caninput_sel10 && enable_candata_in } + field = "", caninput_source_can_address11, { caninput_sel11 && enable_candata_in } + field = "", caninput_source_can_address12, { caninput_sel12 && enable_candata_in } + field = "", caninput_source_can_address13, { caninput_sel13 && enable_candata_in } + field = "", caninput_source_can_address14, { caninput_sel14 && enable_candata_in } + field = "", caninput_source_can_address15, { caninput_sel15 && enable_candata_in } dialog = caninput_parameter_start_byte, "", yAxis - field = " Number of Bytes" - field = "", caninput_param_start_byte0, { caninput_sel0 && enable_candata_in } - field = "", caninput_param_start_byte1, { caninput_sel1 && enable_candata_in } - field = "", caninput_param_start_byte2, { caninput_sel2 && enable_candata_in } - field = "", caninput_param_start_byte3, { caninput_sel3 && enable_candata_in } - field = "", caninput_param_start_byte4, { caninput_sel4 && enable_candata_in } - field = "", caninput_param_start_byte5, { caninput_sel5 && enable_candata_in } - field = "", caninput_param_start_byte6, { caninput_sel6 && enable_candata_in } - field = "", caninput_param_start_byte7, { caninput_sel7 && enable_candata_in } - field = "", caninput_param_start_byte8, { caninput_sel8 && enable_candata_in } - field = "", caninput_param_start_byte9, { caninput_sel9 && enable_candata_in } - field = "", caninput_param_start_byte10, { caninput_sel10 && enable_candata_in } - field = "", caninput_param_start_byte11, { caninput_sel11 && enable_candata_in } - field = "", caninput_param_start_byte12, { caninput_sel12 && enable_candata_in } - field = "", caninput_param_start_byte13, { caninput_sel13 && enable_candata_in } - field = "", caninput_param_start_byte14, { caninput_sel14 && enable_candata_in } - field = "", caninput_param_start_byte15, { caninput_sel15 && enable_candata_in } + field = " source data start byte" + field = "", caninput_source_start_byte0, { caninput_sel0 && enable_candata_in } + field = "", caninput_source_start_byte1, { caninput_sel1 && enable_candata_in } + field = "", caninput_source_start_byte2, { caninput_sel2 && enable_candata_in } + field = "", caninput_source_start_byte3, { caninput_sel3 && enable_candata_in } + field = "", caninput_source_start_byte4, { caninput_sel4 && enable_candata_in } + field = "", caninput_source_start_byte5, { caninput_sel5 && enable_candata_in } + field = "", caninput_source_start_byte6, { caninput_sel6 && enable_candata_in } + field = "", caninput_source_start_byte7, { caninput_sel7 && enable_candata_in } + field = "", caninput_source_start_byte8, { caninput_sel8 && enable_candata_in } + field = "", caninput_source_start_byte9, { caninput_sel9 && enable_candata_in } + field = "", caninput_source_start_byte10, { caninput_sel10 && enable_candata_in } + field = "", caninput_source_start_byte11, { caninput_sel11 && enable_candata_in } + field = "", caninput_source_start_byte12, { caninput_sel12 && enable_candata_in } + field = "", caninput_source_start_byte13, { caninput_sel13 && enable_candata_in } + field = "", caninput_source_start_byte14, { caninput_sel14 && enable_candata_in } + field = "", caninput_source_start_byte15, { caninput_sel15 && enable_candata_in } dialog = caninput_parameter_num_byte, "", yAxis field = "Input Parameter Number of Bytes" - field = "", caninput_param_num_bytes0, { caninput_sel0 && enable_candata_in } - field = "", caninput_param_num_bytes1, { caninput_sel1 && enable_candata_in } - field = "", caninput_param_num_bytes2, { caninput_sel3 && enable_candata_in } - field = "", caninput_param_num_bytes3, { caninput_sel3 && enable_candata_in } - field = "", caninput_param_num_bytes4, { caninput_sel4 && enable_candata_in } - field = "", caninput_param_num_bytes5, { caninput_sel5 && enable_candata_in } - field = "", caninput_param_num_bytes6, { caninput_sel6 && enable_candata_in } - field = "", caninput_param_num_bytes7, { caninput_sel7 && enable_candata_in } - field = "", caninput_param_num_bytes8, { caninput_sel8 && enable_candata_in } - field = "", caninput_param_num_bytes9, { caninput_sel9 && enable_candata_in } - field = "", caninput_param_num_bytes10, { caninput_sel10 && enable_candata_in } - field = "", caninput_param_num_bytes11, { caninput_sel11 && enable_candata_in } - field = "", caninput_param_num_bytes12, { caninput_sel12 && enable_candata_in } - field = "", caninput_param_num_bytes13, { caninput_sel13 && enable_candata_in } - field = "", caninput_param_num_bytes14, { caninput_sel14 && enable_candata_in } - field = "", caninput_param_num_bytes15, { caninput_sel15 && enable_candata_in } + field = "", caninput_source_num_bytes0, { caninput_sel0 && enable_candata_in } + field = "", caninput_source_num_bytes1, { caninput_sel1 && enable_candata_in } + field = "", caninput_source_num_bytes2, { caninput_sel3 && enable_candata_in } + field = "", caninput_source_num_bytes3, { caninput_sel3 && enable_candata_in } + field = "", caninput_source_num_bytes4, { caninput_sel4 && enable_candata_in } + field = "", caninput_source_num_bytes5, { caninput_sel5 && enable_candata_in } + field = "", caninput_source_num_bytes6, { caninput_sel6 && enable_candata_in } + field = "", caninput_source_num_bytes7, { caninput_sel7 && enable_candata_in } + field = "", caninput_source_num_bytes8, { caninput_sel8 && enable_candata_in } + field = "", caninput_source_num_bytes9, { caninput_sel9 && enable_candata_in } + field = "", caninput_source_num_bytes10, { caninput_sel10 && enable_candata_in } + field = "", caninput_source_num_bytes11, { caninput_sel11 && enable_candata_in } + field = "", caninput_source_num_bytes12, { caninput_sel12 && enable_candata_in } + field = "", caninput_source_num_bytes13, { caninput_sel13 && enable_candata_in } + field = "", caninput_source_num_bytes14, { caninput_sel14 && enable_candata_in } + field = "", caninput_source_num_bytes15, { caninput_sel15 && enable_candata_in } dialog = caninconfig_blank1,"" field = "" @@ -1628,8 +1628,8 @@ menuDialog = main panel = caninconfig_blank1 panel = caninput_parameter_num_byte - dialog = Canin_config2, "CAN Data Input" - field = "Enable CanBus data input", enable_candata_in + dialog = Canin_config2, "External Data Input" + field = "Enable External data input", enable_candata_in dialog = Canin_config, "", border topicHelp = "http://speeduino.com/wiki/index.php/Secondary_Serial_IO_interface#Read_external_analog_data" @@ -1738,7 +1738,7 @@ menuDialog = main field = "Enable CanBus/Second Serial", enable_canbus ; field = "Speeduino TsCanId", speeduino_tsCanId field = "True Canbus Address", true_address {enable_canbus} - field = "NOTE! True address + 1 to 15 are reserved for future expansion" + field = "NOTE! Realtime Datat Base Address MUST be at least 0x16 GREATER than the True Address as they are reserved for future expansion" field = "Realtime Data Base Can Address", realtime_base_address {enable_canbus} ; field = "Speeduino OBD address", obd_address diff --git a/speeduino/cancomms.h b/speeduino/cancomms.h index 36b20009..51897ccd 100644 --- a/speeduino/cancomms.h +++ b/speeduino/cancomms.h @@ -3,6 +3,8 @@ //These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages. #define veMapPage 1 +#define canpacketSize 74 + uint8_t currentcanCommand; uint8_t currentCanPage = 1;//Not the same as the speeduino config page numbers uint8_t nCanretry = 0; //no of retrys @@ -26,6 +28,6 @@ uint8_t Glow, Ghigh; void canCommand();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable. void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum); -void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2, uint16_t paramgroup); +void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2, uint16_t sourcecanAddress); #endif // CANCOMMS_H diff --git a/speeduino/cancomms.ino b/speeduino/cancomms.ino index 5075c5ca..323b6132 100644 --- a/speeduino/cancomms.ino +++ b/speeduino/cancomms.ino @@ -23,22 +23,22 @@ void canCommand() case 'G': // this is the reply command sent by the Can interface byte destcaninchannel; - if (CANSerial.available() >= 10) + if (CANSerial.available() >= 9) { - cancmdfail = CANSerial.read(); - destcaninchannel = CANSerial.read(); + cancmdfail = CANSerial.read(); //0 == fail, 1 == good. + destcaninchannel = CANSerial.read(); // the input channel that requested the data value if (cancmdfail != 0) { // read all 8 bytes of data. for (byte Gx = 0; Gx < 8; Gx++) // first two are the can address the data is from. next two are the can address the data is for.then next 1 or two bytes of data { Gdata[Gx] = CANSerial.read(); } - Glow = Gdata[(configPage10.caninput_param_start_byte[destcaninchannel]&7)]; - if ((BIT_CHECK(configPage10.caninput_param_num_bytes,destcaninchannel))) //if true then num bytes is 2 + Glow = Gdata[(configPage10.caninput_source_start_byte[destcaninchannel]&7)]; + if ((BIT_CHECK(configPage10.caninput_source_num_bytes,destcaninchannel))) //if true then num bytes is 2 { - if ((configPage10.caninput_param_start_byte[destcaninchannel]&7) < 8) //you cant have a 2 byte value starting at byte 7(8 on the list) + if ((configPage10.caninput_source_start_byte[destcaninchannel]&7) < 8) //you cant have a 2 byte value starting at byte 7(8 on the list) { - Ghigh = Gdata[((configPage10.caninput_param_start_byte[destcaninchannel]&7)+1)]; + Ghigh = Gdata[((configPage10.caninput_source_start_byte[destcaninchannel]&7)+1)]; } else{Ghigh = 0;} } @@ -52,14 +52,6 @@ void canCommand() else{} //continue as command request failed and/or data/device was not available - if (currentStatus.current_caninchannel < 15) // if channel is < 15 then we can do another one - { - currentStatus.current_caninchannel++; //inc to next channel - } - else - { - currentStatus.current_caninchannel = 0; //reset to start - } } break; @@ -135,7 +127,7 @@ void canCommand() } void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portType) { - byte fullStatus[packetSize]; + byte fullStatus[canpacketSize]; //CAN serial #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)|| defined(CORE_STM32) || defined (CORE_TEENSY) //ATmega2561 does not have Serial3 @@ -253,7 +245,7 @@ void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portTy // 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) +void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint8_t candata2, uint16_t sourcecanAddress) { switch (cmdtype) { @@ -272,8 +264,8 @@ void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint case 2: // requests via serial3 CANSerial.print("R"); //send "R" to request data from the parmagroup can address whos value is sent next CANSerial.write(candata1); //the currentStatus.current_caninchannel - CANSerial.write(lowByte(paramgroup) ); //send lsb first - CANSerial.write(highByte(paramgroup) ); + CANSerial.write(lowByte(sourcecanAddress) ); //send lsb first + CANSerial.write(highByte(sourcecanAddress) ); break; case 3: diff --git a/speeduino/globals.h b/speeduino/globals.h index 656d0d27..497098ef 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -563,9 +563,9 @@ struct config10 { byte enable_canbus:2; byte enable_candata_in:1; uint16_t caninput_sel; //bit status on/off if input is enabled - uint16_t caninput_param_group[16]; //u16 [15] array holding can address of input - uint8_t caninput_param_start_byte[16]; //u08 [15] array holds the start byte number(value of 0-7) - uint16_t caninput_param_num_bytes; //u16 bit status of the number of bytes length 1 or 2 + uint16_t caninput_source_can_address[16]; //u16 [15] array holding can address of input + uint8_t caninput_source_start_byte[16]; //u08 [15] array holds the start byte number(value of 0-7) + uint16_t caninput_source_num_bytes; //u16 bit status of the number of bytes length 1 or 2 byte unused10_53; byte unused10_54; byte enable_candata_out : 1; diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index b46a8af3..bc132f4c 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -809,56 +809,45 @@ void loop() if(eepromWritesPending == true) { writeAllConfig(); } //Check for any outstanding EEPROM writes. #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 - //if Can interface is enabled then check for serial3 requests. - if (configPage10.enable_canbus == 1) // megas only support can via secondary serial - { - if (configPage10.enable_candata_in) + //if Can interface is enabled then check for external data requests. + if (configPage10.enable_candata_in) //if external data input is enabled + { + if (configPage10.enable_canbus == 1) // megas only support can via secondary serial { - if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel bit is enabled + for (byte caninChan = 0; caninChan <16 ; caninChan++) { - sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_param_group[currentStatus.current_caninchannel]&2047)+256)); //send an R command for data from paramgroup[currentStatus.current_caninchannel] - } - else - { - if (currentStatus.current_caninchannel < 15) - { - currentStatus.current_caninchannel++; //step to next input channel if under 15 - } - else - { - currentStatus.current_caninchannel = 0; //reset input channel back to 1 - } + currentStatus.current_caninchannel = caninChan; + //currentStatus.canin[14] = currentStatus.current_caninchannel; + currentStatus.canin[13] = ((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+0x100); + if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel bit is enabled + { + sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+0x100)); + //send an R command for data from caninput_source_address[currentStatus.current_caninchannel] + } } } } + #elif defined(CORE_STM32) || defined(CORE_TEENSY) //if serial3io is enabled then check for serial3 requests. - if (configPage10.enable_candata_in) + if (configPage10.enable_candata_in) + { + for (byte caninChan = 0; caninChan <16 ; caninChan++) { + currentStatus.current_caninchannel == caninChan; if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel is enabled { if (configPage10.enable_canbus == 1) //can via secondary serial - { - sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_param_group[currentStatus.current_caninchannel]&2047)+256)); //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,currentStatus.current_caninchannel,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 < 15) - { - currentStatus.current_caninchannel++; //step to next input channel if under 15 - } - else - { - currentStatus.current_caninchannel = 0; //reset input channel back to 0 - } + { + sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+256)); //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,currentStatus.current_caninchannel,0,configPage10.caninput_source_can_address[currentStatus.current_caninchannel]); //send via localcanbus the command for data from paramgroup[currentStatus.current_caninchannel] + } } } - + } #endif vvtControl(); idleControl(); //Perform any idle related actions. Even at higher frequencies, running 4x per second is sufficient. @@ -1441,52 +1430,52 @@ void loop() } } //Ignition schedules on } //Has sync and RPM -} //loop() - -/* - This function retuns a pulsewidth time (in us) given the following: - REQ_FUEL - VE: Lookup from the main fuel table. This can either have been MAP or TPS based, depending on the algorithm used - MAP: In KPa, read from the sensor (This is used when performing a multiply of the map only. It is applicable in both Speed density and Alpha-N) - GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110) - injDT: Injector dead time. The time the injector take to open minus the time it takes to close (Both in uS) -*/ -static inline unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen) -{ - //Standard float version of the calculation - //return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen); - //Note: The MAP and TPS portions are currently disabled, we use VE and corrections only - uint16_t iVE, iCorrections; - uint16_t iMAP = 100; - uint16_t iAFR = 147; - - //100% float free version, does sacrifice a little bit of accuracy, but not much. - iVE = ((unsigned int)VE << 7) / 100; - if ( configPage1.multiplyMAP == true ) { - iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled - } - if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2)) { - iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled - } - iCorrections = (corrections << 7) / 100; - - - unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long - if ( configPage1.multiplyMAP == true ) { - intermediate = (intermediate * (unsigned long)iMAP) >> 7; - } - if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2) ) { - intermediate = (intermediate * (unsigned long)iAFR) >> 7; //EGO type must be set to wideband for this to be used - } - intermediate = (intermediate * (unsigned long)iCorrections) >> 7; - if (intermediate != 0) - { - //If intermeditate is not 0, we need to add the opening time (0 typically indicates that one of the full fuel cuts is active) - intermediate += injOpen; //Add the injector opening time - if ( intermediate > 65535) - { - intermediate = 65535; //Make sure this won't overflow when we convert to uInt. This means the maximum pulsewidth possible is 65.535mS - } - } - return (unsigned int)(intermediate); +} //loop() + +/* + This function retuns a pulsewidth time (in us) given the following: + REQ_FUEL + VE: Lookup from the main fuel table. This can either have been MAP or TPS based, depending on the algorithm used + MAP: In KPa, read from the sensor (This is used when performing a multiply of the map only. It is applicable in both Speed density and Alpha-N) + GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110) + injDT: Injector dead time. The time the injector take to open minus the time it takes to close (Both in uS) +*/ +static inline unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen) +{ + //Standard float version of the calculation + //return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen); + //Note: The MAP and TPS portions are currently disabled, we use VE and corrections only + uint16_t iVE, iCorrections; + uint16_t iMAP = 100; + uint16_t iAFR = 147; + + //100% float free version, does sacrifice a little bit of accuracy, but not much. + iVE = ((unsigned int)VE << 7) / 100; + if ( configPage1.multiplyMAP == true ) { + iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled + } + if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2)) { + iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled + } + iCorrections = (corrections << 7) / 100; + + + unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long + if ( configPage1.multiplyMAP == true ) { + intermediate = (intermediate * (unsigned long)iMAP) >> 7; + } + if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2) ) { + intermediate = (intermediate * (unsigned long)iAFR) >> 7; //EGO type must be set to wideband for this to be used + } + intermediate = (intermediate * (unsigned long)iCorrections) >> 7; + if (intermediate != 0) + { + //If intermeditate is not 0, we need to add the opening time (0 typically indicates that one of the full fuel cuts is active) + intermediate += injOpen; //Add the injector opening time + if ( intermediate > 65535) + { + intermediate = 65535; //Make sure this won't overflow when we convert to uInt. This means the maximum pulsewidth possible is 65.535mS + } + } + return (unsigned int)(intermediate); }