Speeduino
Loading...
Searching...
No Matches
pages.h
Go to the documentation of this file.
1#pragma once
2#include <Arduino.h>
3#include "table3d.h"
4
9
14
15// These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
16#define veMapPage 2
17#define veSetPage 1 //Note that this and the veMapPage were swapped in Feb 2019 as the 'algorithm' field must be declared in the ini before it's used in the fuel table
18#define ignMapPage 3
19#define ignSetPage 4//Config Page 2
20#define afrMapPage 5
21#define afrSetPage 6//Config Page 3
22#define boostvvtPage 7
23#define seqFuelPage 8
24#define canbusPage 9//Config Page 9
25#define warmupPage 10 //Config Page 10
26#define fuelMap2Page 11
27#define wmiMapPage 12
28#define progOutsPage 13
29#define ignMap2Page 14
30#define boostvvtPage2 15
31
32// ============================== Per-byte page access ==========================
33
37byte getPageValue( byte pageNum,
39 );
40
44void setPageValue( byte pageNum,
46 byte value
47 );
48
49// ============================== Page Iteration ==========================
50
51// A logical TS page is actually multiple in memory entities. Allow iteration
52// over those entities.
53
54// Type of entity
56 Raw, // A block of memory
57 Table, // A 3D table
58 NoEntity, // No entity, but a valid offset
59 End // The offset was past any known entity for the page
60};
61
64 uint8_t page; // The index of the page the entity belongs to
65 uint8_t index; // The sub-index of the item within the page
66
72
74 {
75 return page==other.page
76 && index==other.index;
77 }
79 {
80 return !operator==(other);
81 }
82};
83
86 uint16_t start; // The start position of the entity, in bytes, from the start of the page
87 uint16_t size; // Size of the entity in bytes
88
94};
95
96// A entity on a logical page.
130
136
141
146
151
156
Iterate over table axis elements.
Definition table3d_axes.h:31
Iterate through a tables values, row by row.
Definition table3d_values.h:82
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:173
table_type_t
Table type identifiers. Limited compile time RTTI.
Definition table3d.h:69
@ table_type_None
Definition table3d.h:70
table_axis_iterator y_begin(const page_iterator_t &it)
Definition pages.cpp:466
page_iterator_t page_begin(byte pageNum)
Definition pages.cpp:429
table_value_iterator rows_begin(const page_iterator_t &it)
Definition pages.cpp:442
uint16_t getPageSize(byte pageNum)
Definition pages.cpp:408
page_iterator_t advance(const page_iterator_t &it)
Definition pages.cpp:434
entity_type
Definition pages.h:55
@ Raw
Definition pages.h:56
@ End
Definition pages.h:59
@ NoEntity
Definition pages.h:58
@ Table
Definition pages.h:57
table_axis_iterator x_begin(const page_iterator_t &it)
Definition pages.cpp:450
table_axis_iterator x_rbegin(const page_iterator_t &it)
Definition pages.cpp:458
uint8_t getPageCount(void)
Definition pages.cpp:403
byte getPageValue(byte pageNum, uint16_t offset)
Definition pages.cpp:420
void setPageValue(byte pageNum, uint16_t offset, byte value)
Definition pages.cpp:413
Position and size of an entity within a page.
Definition pages.h:85
uint16_t start
Definition pages.h:86
entity_page_address_t(uint16_t base, uint16_t length)
Definition pages.h:89
uint16_t size
Definition pages.h:87
The unique location of an entity within all pages.
Definition pages.h:63
uint8_t page
Definition pages.h:64
uint8_t index
Definition pages.h:65
bool operator!=(const entity_page_location_t &other) const
Definition pages.h:78
constexpr entity_page_location_t(uint8_t pageNum, uint8_t pageSubIndex)
Definition pages.h:67
bool operator==(const entity_page_location_t &other) const
Definition pages.h:73
Definition pages.h:97
entity_page_location_t location
Definition pages.h:101
entity_page_address_t address
Definition pages.h:102
entity_type type
Definition pages.h:99
table_type_t table_key
Definition pages.h:100
page_iterator_t(void *pBuffer, const entity_page_location_t &entityLocation, const entity_page_address_t &entityAddress)
Definition pages.h:113
void * pData
Definition pages.h:98
page_iterator_t(void *pTable, table_type_t key, const entity_page_location_t &entityLocation, const entity_page_address_t &entityAddress)
Definition pages.h:121
page_iterator_t(entity_type theType, const entity_page_location_t &entityLocation, const entity_page_address_t &entityAddress)
Definition pages.h:104
3D table data types and functions