rusEFI
The most advanced open source ECU
efi_scaled_channel.h
Go to the documentation of this file.
1 /*
2  * @file efi_scaled_channel.h
3  * @brief Scaled channel storage for binary formats
4  *
5  * Storage of values (floating point, usually) scaled in integer storage, for transmission over the wire.
6  * This includes Tunerstudio serial/USB, and CAN.
7  *
8  * @date Feb 24, 2020
9  * @author Matthew Kennedy, (c) 2020
10  */
11 
12 #pragma once
13 
14 #include <rusefi/scaled_channel.h>
15 #include "generated_lookup_meta.h"
16 
17 // Common scaling options - use these if you can!
18 using scaled_temperature = scaled_channel<int16_t, PACK_MULT_TEMPERATURE>; // +-327 deg C at 0.01 deg resolution
19 using scaled_ms = scaled_channel<int16_t, PACK_MULT_MS>; // +- 100ms at 0.003ms precision
20 using scaled_percent = scaled_channel<int16_t, PACK_MULT_PERCENT>; // +-327% at 0.01% resolution
21 using scaled_pressure = scaled_channel<uint16_t, PACK_MULT_PRESSURE>; // 0-2000kPa (~300psi) at 0.03kPa resolution
22 using scaled_high_pressure = scaled_channel<uint16_t, PACK_MULT_HIGH_PRESSURE>; // 0-6553 bar (~95k psi) at 0.1 bar resolution
23 using scaled_angle = scaled_channel<int16_t, PACK_MULT_ANGLE>; // +-655 degrees at 0.02 degree resolution
24 using scaled_voltage = scaled_channel<uint16_t, PACK_MULT_VOLTAGE>; // 0-65v at 1mV resolution
25 using scaled_afr = scaled_channel<uint16_t, PACK_MULT_AFR>; // 0-65afr at 0.001 resolution
26 using scaled_lambda = scaled_channel<uint16_t, PACK_MULT_LAMBDA>; // 0-6.5 lambda at 0.0001 resolution
27 using scaled_fuel_mass_mg = scaled_channel<uint16_t, PACK_MULT_FUEL_MASS>; // 0 - 655.35 milligrams, 0.01mg resolution
scaled_channel< int16_t, PACK_MULT_ANGLE > scaled_angle
scaled_channel< uint16_t, PACK_MULT_HIGH_PRESSURE > scaled_high_pressure
scaled_channel< int16_t, PACK_MULT_TEMPERATURE > scaled_temperature
scaled_channel< int16_t, PACK_MULT_MS > scaled_ms
scaled_channel< uint16_t, PACK_MULT_FUEL_MASS > scaled_fuel_mass_mg
scaled_channel< uint16_t, PACK_MULT_PRESSURE > scaled_pressure
scaled_channel< uint16_t, PACK_MULT_LAMBDA > scaled_lambda
scaled_channel< int16_t, PACK_MULT_PERCENT > scaled_percent
scaled_channel< uint16_t, PACK_MULT_VOLTAGE > scaled_voltage
scaled_channel< uint16_t, PACK_MULT_AFR > scaled_afr