ALDL Dashboard for RPi systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

91 lines
2.9 KiB

/*
* ALDL Dashboard, common definitions
*
* (c) 2019 Solomon Peachy <pizza@shaftnet.org>
*
* The latest version of this program can be found at:
*
* http://git.shaftnet.org/cgit/users/pizza/public/aldl_pi.git
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* [http://www.gnu.org/licenses/gpl-3.0.html]
*
* SPDX-License-Identifier: GPL-3.0+
*
*/
/* API */
int readbit(void);
void delayfn(int ms);
void isrfn(void);
int thread_start(void);
void thread_shutdown(void);
extern int gotsync;
extern void (*aldl_callback)(uint8_t *data, int datalen);
int init_dash(void);
int render_dash(void);
void datalog_init(char *fname);
void datalog_close(void);
/* Decoded data stream */
struct stream_common {
uint16_t heartbeat;
uint16_t prom_id; /* PROM ID */
/* Raw data */
uint16_t mph; /* Miles per hour */
uint16_t rpm; /* Revolutions per minute */
uint16_t tp; /* Throttle Position, percent */
uint16_t iac_steps;
uint16_t idle_tgt; /* Idle target RPM */
uint16_t base_fuel; /* Base fuel correction */
uint16_t knock_count; /* Knock counter */
uint16_t corr_fuel; /* Corrective fuel multiplier */
uint16_t o2_transitions; /* O2 sensors transitions */
float battery_v; /* Battery voltage */
float fuelp_v; /* Fuel Pump Voltage */
float map_v; /* Manifold Absolute Pressure Voltage */
float tps_v; /* Throttle Position, Voltage */
float o2_v; /* O2 sensor, Voltage */
/* Derived data */
float coolant_temp_c; /* Coolant temperature */
uint16_t running; /* non-zero if engine running */
uint16_t driving; /* non-zero if moving */
uint16_t idling; /* 1 = first idle, 2 = regular */
uint32_t mil; /* Aka Check Engine Light */
uint16_t closed_loop; /* Runining in closed loop mode */
uint16_t closed_loop_idle; /* Idle in closed loop mode */
uint16_t rich_lean; /* 1 if rich, 0 for lean */
uint16_t ac_request; /* True if AC requested */
uint16_t learn_req; /* Learning Requested */
uint16_t shift_req; /* Shift requested */
uint16_t top_gear; /* In top gear */
uint16_t neutral; /* Neutral or Park */
uint16_t overspeed; /* Overspeed */
};
extern struct stream_common decoded;
/* Examples */
void aldl_a179_callback(uint8_t *data, int datalen);