summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-08-20 22:50:14 -0400
committerSolomon Peachy <pizza@shaftnet.org>2013-08-20 22:50:14 -0400
commit37024e35c5c6e7357a586b50fdfeaaf4af04584a (patch)
treecd071bc52c9d25e181fb9e7e0addb073bda40fd9
parentbc24732ba44c52392e391cd5d652a92e8316d5a9 (diff)
downloadlinuxaldl-37024e35c5c6e7357a586b50fdfeaaf4af04584a.tar.gz
linuxaldl-37024e35c5c6e7357a586b50fdfeaaf4af04584a.tar.bz2
linuxaldl-37024e35c5c6e7357a586b50fdfeaaf4af04584a.zip
major internal changes:
* Fixed indenting and whatnot across much of codebase * Add initial tables for $9A (92-94 L03/L05 Truck w/MT) * Add mask and baud rates to definition tables * Properly parse mask on cmdline Todo: * Fix GUI so it doesn't open until definition selected. * Finish cleaning up code across the board * Add bitmask field support * Add table field support * Actually this crap out..
-rw-r--r--src/linuxaldl.c201
-rw-r--r--src/linuxaldl.h75
-rw-r--r--src/linuxaldl_definitions.h39
-rw-r--r--src/linuxaldl_gui.c339
4 files changed, 319 insertions, 335 deletions
diff --git a/src/linuxaldl.c b/src/linuxaldl.c
index 23bcbc2..af24474 100644
--- a/src/linuxaldl.c
+++ b/src/linuxaldl.c
@@ -1,20 +1,20 @@
/*(C) copyright 2008, Steven Snyder, All Rights Reserved
-Steven T. Snyder, <stsnyder@ucla.edu> http://www.steventsnyder.com
+ Steven T. Snyder, <stsnyder@ucla.edu> http://www.steventsnyder.com
-LICENSING INFORMATION:
- 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.
+ LICENSING INFORMATION:
+ 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.
+ 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, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
@@ -33,20 +33,19 @@ LICENSING INFORMATION:
#include "linuxaldl_gui.h"
#include "sts_serial.h"
-
// global variables
// =================================================
linuxaldl_settings aldl_settings = {
.aldl_definition_table = aldl_definition_table,
.scan_interval = 150,
- .scan_timeout = 100
+ .scan_timeout = 100,
};
// ============================================================================
//
// linuxaldl
-// main ()
+// main ()
//
// ============================================================================
@@ -63,52 +62,54 @@ int main(int argc, const char* argv[]){
// popt option table
// -----------------
- struct poptOption aldl_opt_table[] =
- {
- { "serial",'\0',
- POPT_ARG_STRING | POPT_ARGFLAG_ONEDASH,&aldl_settings.aldlportname,0,
- "Serial port the aldl interface is on",
- "/dev/ttyUSB0" },
- { "mask",'\0',
- POPT_ARG_STRING | POPT_ARGFLAG_ONEDASH,&aldl_settings.aldldefname,0,
- "ALDL code definition to use",
- "DF"},
- POPT_AUTOHELP
- { NULL, 0, 0, NULL, 0, 0, NULL}
- };
+ struct poptOption aldl_opt_table[] = {
+ { "serial",'\0',
+ POPT_ARG_STRING | POPT_ARGFLAG_ONEDASH,&aldl_settings.aldlportname,0,
+ "Serial port the aldl interface is on",
+ "/dev/ttyUSB0" },
+ { "mask",'\0',
+ POPT_ARG_STRING | POPT_ARGFLAG_ONEDASH,&aldl_settings.aldldefname,0,
+ "ALDL code definition to use",
+ "DF"},
+ POPT_AUTOHELP
+ { NULL, 0, 0, NULL, 0, 0, NULL}
+ };
// popt context
popt_aldl = poptGetContext(NULL, argc, argv,aldl_opt_table,0);
poptSetOtherOptionHelp(popt_aldl,"[logfile.log]\nTo use GUI: linuxaldl [-serial=/dev/ttyUSB0]");
- if (argc<2) { poptPrintUsage(popt_aldl,stderr,0); return 1; }
+ if (argc < 2) { poptPrintUsage(popt_aldl,stderr,0); return 1; }
res = poptGetNextOpt(popt_aldl); // parse the command line arguments
// if no serial port selected, print usage instructions and exit
- if (aldl_settings.aldlportname == NULL)
- { poptPrintUsage(popt_aldl,stderr,0); return 1; }
+ if (aldl_settings.aldlportname == NULL) {
+ poptPrintUsage(popt_aldl,stderr,0);
+ return 1;
+ }
aldl_settings.logfilename = (char*)poptGetArg(popt_aldl);
// if no log file specified or no definition file specified
- if ((aldl_settings.logfilename == NULL || !(poptPeekArg(popt_aldl)==NULL || aldl_settings.aldldefname==NULL)))
- {
+ if (aldl_settings.logfilename == NULL ||
+ poptPeekArg(popt_aldl) != NULL ||
+ aldl_settings.aldldefname == NULL) {
guimode = 1;
- }
- else // in command line mode, choose definition using the -mask=DEF argument
- {
- // XXX suggestion: how about adding support for pre-selecting the definition at the command line?
+ } else {
+ // In command line mode, choose definition using the -mask=DEF argument
// get the aldl definition address
- aldl_settings.definition = aldl_get_definition(aldl_settings.aldldefname);
+ aldl_settings.definition = aldl_get_definition(NULL, aldl_settings.aldldefname);
// if no definition by that name exists, exit
- if (aldl_settings.definition == NULL)
- {
- fprintf(stderr,"Error: No definition with name \"%s\" found.",
- aldl_settings.aldldefname);
+ if (aldl_settings.definition == NULL) {
+ fprintf(stderr,"Error: No definition with mask \"%s\" found.",
+ aldl_settings.aldldefname);
fprintf(stderr,"Consult the documentation.\n");
fprintf(stderr," Note: definition names are case sensitive.\n");
return -1;
+ } else {
+ fprintf(stderr, "Definition \"%s\" selected.\n", aldl_settings.definition->name);
+
}
}
poptFreeContext(popt_aldl); // free the popt context
@@ -119,12 +120,13 @@ int main(int argc, const char* argv[]){
// Establish a connection to the aldl
// ===================================
- printf("Trying to connect to ALDL interface on %s...\n",aldl_settings.aldlportname);
+ printf("Trying to connect to ALDL interface on %s...\n", aldl_settings.aldlportname);
// connect to the device and set the serial port settings
- aldl_settings.faldl = serial_connect(aldl_settings.aldlportname,O_RDWR | O_NOCTTY | O_NONBLOCK,BAUDRATE);
- if (aldl_settings.faldl == -1)
- {
+ aldl_settings.faldl = serial_connect(aldl_settings.aldlportname,
+ O_RDWR | O_NOCTTY | O_NONBLOCK,
+ aldl_settings.definition->basic_baudrate);
+ if (aldl_settings.faldl == -1) {
fprintf(stderr," Couldn't open to %s\n",aldl_settings.aldlportname);
return -1;
}
@@ -134,15 +136,15 @@ int main(int argc, const char* argv[]){
// baud rate as possible. if it cannot be set; it should still work at the standard
// baud rate of 9600; the framing errors aren't excessive enough to cause problems,
// and will be caught by bad checksums.
- if (set_custom_baud_rate(aldl_settings.faldl,8192)!=0)
- {
- fprintf(stderr," Couldn't set baud rate to 8192. Using standard rate (9600).\n");
+ if (set_custom_baud_rate(aldl_settings.faldl, aldl_settings.definition->ideal_baudrate)!=0) {
+ fprintf(stderr," Couldn't set baud rate to %d. Using standard rate (%d).\n",
+ aldl_settings.definition->ideal_baudrate,
+ aldl_settings.definition->basic_baudrate);
fprintf(stderr," There may be framing errors.\n");
}
// verify the aldl
- if (verifyaldl()<0)
- {
+ if (verifyaldl()<0) {
fprintf(stderr," ALDL verification failure. No response from ECM.\n");
tcflush(aldl_settings.faldl, TCIOFLUSH);
close(aldl_settings.faldl);
@@ -150,33 +152,24 @@ int main(int argc, const char* argv[]){
}
// GUI mode if no .log file specified at the command line
- // ========================================================================
- // LOAD GUI MODE
- // ========================================================================
- if (guimode)
- {
+ if (guimode) {
// GUI mode
linuxaldl_gui(argc, (char**)argv);
- }
-
- // ========================================================================
- // COMMAND LINE MODE
- // ========================================================================
- else
- {
+ } else {
// Open the .log file for writing, create if it doesnt exist
// ------------------------------------------------------------
aldl_settings.flogfile = open(aldl_settings.logfilename,O_RDWR | O_CREAT, 0666);
- if (aldl_settings.flogfile == -1)
- {
+ if (aldl_settings.flogfile == -1) {
fprintf(stderr,"Unable to open/create %s for writing.\n",aldl_settings.logfilename);
return 0; }
printf("Opened %s for writing.\n",aldl_settings.logfilename);
// Read from the aldl
// ------------------
res = aldl_scan_and_log(aldl_settings.flogfile);
- if (res==-1) fprintf(stderr,"Error: Fatal read error occured. log file may be corrupted.\n");
- else printf("Received %d bytes from device and wrote to file: %s.\n", res,aldl_settings.logfilename);
+ if (res==-1)
+ fprintf(stderr,"Error: Fatal read error occured. log file may be corrupted.\n");
+ else
+ printf("Received %d bytes from device and wrote to file: %s.\n", res,aldl_settings.logfilename);
close(aldl_settings.flogfile);
}
@@ -212,7 +205,6 @@ int verifyaldl()
{
//XXX NOT IMPLEMENTED
return 0;
-
}
@@ -268,8 +260,7 @@ int get_mode1_message(char* inbuffer, unsigned int size)
aldl_definition* def = aldl_settings.definition;
unsigned int mode1_len = def->mode1_response_length;
- if (size < mode1_len)
- {
+ if (size < mode1_len) {
printf("Read buffer must be at least %d bytes.\n",mode1_len);
return -1;
}
@@ -293,16 +284,14 @@ int get_mode1_message(char* inbuffer, unsigned int size)
// wait for response from ECM
// read sequence, 50msec timeout
res=read_sequence(aldl_settings.faldl, inbuffer, mode1_len,
- seq, 3, 0,
- aldl_settings.scan_timeout*1000);
+ seq, 3, 0,
+ aldl_settings.scan_timeout*1000);
- if (res<0)
- {
+ if (res<0) {
fprintf(stderr,"Error receiving mode1 message: %s\n",strerror(errno));
return -1;
}
- if ((unsigned)res<mode1_len)
- {
+ if ((unsigned)res<mode1_len) {
#ifdef _LINUXALDL_DEBUG
fprintf(stderr,"MODE1 timeout occured. (Received %d/%d bytes)\n",res,mode1_len);
@@ -311,8 +300,7 @@ int get_mode1_message(char* inbuffer, unsigned int size)
}
char checksum = get_checksum(inbuffer,mode1_len-1);
- if (inbuffer[mode1_len-1]!=checksum)
- {
+ if (inbuffer[mode1_len-1]!=checksum) {
fprintf(stderr,"MODE 1 bad checksum.\n");
return -1;
}
@@ -339,8 +327,7 @@ char get_checksum(char* buffer, unsigned int len)
char acc = 0x00;
unsigned int i;
- for (i=0; i<len; i++)
- {
+ for (i=0; i<len; i++) {
//printf("%d,",buffer[i]);
//if (!(i%16)) printf("\n");
acc+=buffer[i];
@@ -353,21 +340,18 @@ char get_checksum(char* buffer, unsigned int len)
return acc;
}
-// looks up def_name in the aldl_definition_table until it finds the first
-// definition in the table with the name def_name
-// if the definition is not in the table, returns NULL
-aldl_definition* aldl_get_definition(const char* defname)
+aldl_definition* aldl_get_definition(const char* defname, const char *defmask)
{
int index = 0;
- aldl_definition* result = aldl_definition_table[0];
- if (defname == NULL)
- return NULL;
- while(result!=NULL){
- if (strcmp(defname,result->name)==0)
+ aldl_definition* result = aldl_definition_table[index];
+
+ while (result) {
+ if (defmask && !strcmp(defmask,result->mask))
break;
- index++;
- result = aldl_definition_table[index];
- }
+ if (defname && !strcmp(defname,result->name))
+ break;
+ result = aldl_definition_table[++index];
+ }
return result;
}
@@ -387,31 +371,24 @@ void aldl_update_sets(int flags)
float converted_val;
char* new_data_string=NULL;
- while (defs[i].label != NULL) // while not at the last defined byte
- {
+ while (defs[i].label != NULL) { // while not at the last defined byte
cur_def = defs+i;
// if the item is a seperator, skip it
- if (cur_def->operation == ALDL_OP_SEPERATOR)
- {
+ if (cur_def->operation == ALDL_OP_SEPERATOR) {
i++;
continue;
}
// convert the raw data to a float based on the byte definition
- if (cur_def->bits==8)
- {
+ if (cur_def->bits==8) {
converted_val = aldl_raw8_to_float(aldl_settings.data_set_raw[cur_def->byte_offset-1],
- cur_def->operation, cur_def->op_factor, cur_def->op_offset);
+ cur_def->operation, cur_def->op_factor, cur_def->op_offset);
- }
- else if (cur_def->bits==16)
- {
+ } else if (cur_def->bits==16) {
converted_val = aldl_raw16_to_float(aldl_settings.data_set_raw[cur_def->byte_offset-1],
- aldl_settings.data_set_raw[cur_def->byte_offset],
- cur_def->operation, cur_def->op_factor, cur_def->op_offset);
- }
- else
- { // other numbers of bits not supported
+ aldl_settings.data_set_raw[cur_def->byte_offset],
+ cur_def->operation, cur_def->op_factor, cur_def->op_offset);
+ } else { // other numbers of bits not supported
i++;
continue;
}
@@ -420,8 +397,7 @@ void aldl_update_sets(int flags)
aldl_settings.data_set_floats[i] = converted_val;
// convert the result to a string
- if ((flags & ALDL_UPDATE_STRINGS) && aldl_settings.data_set_strings != NULL)
- {
+ if ((flags & ALDL_UPDATE_STRINGS) && aldl_settings.data_set_strings != NULL) {
new_data_string=malloc(10); // allocate ten bytes for the string
snprintf(new_data_string,10,"%.1f",converted_val); // convert the floating point value to a string
@@ -449,8 +425,7 @@ float aldl_raw8_to_float(unsigned char val, int operation, float op_factor, floa
result = ((float)val*op_factor)+op_offset;
else if (operation == ALDL_OP_DIVIDE)
result = (op_factor/val)+op_offset;
- else
- {
+ else {
result = -999;
fprintf(stderr," aldl_raw_to_float8() error: undefined operation: %d",operation);
}
@@ -470,8 +445,7 @@ float aldl_raw16_to_float(unsigned char msb, unsigned char lsb, int operation, f
result = (result*op_factor)+op_offset;
else if (operation == ALDL_OP_DIVIDE)
result = (op_factor/result)+op_offset;
- else
- {
+ else {
result = -999.0;
fprintf(stderr," aldl_raw_to_float16() error: undefined operation: %d",operation);
}
@@ -479,4 +453,3 @@ float aldl_raw16_to_float(unsigned char msb, unsigned char lsb, int operation, f
}
-
diff --git a/src/linuxaldl.h b/src/linuxaldl.h
index fb01d18..a920f1d 100644
--- a/src/linuxaldl.h
+++ b/src/linuxaldl.h
@@ -1,8 +1,6 @@
#ifndef LINUXALDL_INCLUDED
#define LINUXALDL_INCLUDED
-
-
/*(C) copyright 2008, Steven Snyder, All Rights Reserved
Steven T. Snyder, <stsnyder@ucla.edu> http://www.steventsnyder.com
@@ -26,24 +24,20 @@ LICENSING INFORMATION:
//#define _LINUXALDL_DEBUG
#define MAX_CONNECT_ATTEMPTS 3
-#define BAUDRATE B9600
// macros
#define _ALDL_MESSAGE_MODE8 aldl_settings.definition->mode8_request,aldl_settings.definition->mode8_request_length
#define _ALDL_MESSAGE_MODE9 aldl_settings.definition->mode9_request,aldl_settings.definition->mode9_request_length
-#define __MAX_REQUEST_SIZE 16 // maximum size (bytes) of a request message
- // to send to the ECM
+#define __MAX_REQUEST_SIZE 16 /* maximum size (bytes) of a request message to send to the ECM */
#define LINUXALDL_MODE1_END_DEF {NULL,0,0,0,0,0,NULL}
-
typedef enum _ALDL_OP { ALDL_OP_MULTIPLY=0, ALDL_OP_DIVIDE=1, ALDL_OP_SEPERATOR=9} ALDL_OP_t;
#define _DEF_SEP(label) {label,0,0,ALDL_OP_SEPERATOR,0,0,NULL}
-
// ============================================================================
// ALDL DEFINITION STRUCTS
// ============================================================================
@@ -54,26 +48,24 @@ typedef enum _ALDL_OP { ALDL_OP_MULTIPLY=0, ALDL_OP_DIVIDE=1, ALDL_OP_SEPERATOR=
// byte_def_t struct
typedef struct _linuxaldl_byte_definition{
const char* label;
- unsigned int byte_offset; // the offset from the 1st byte of the data part
- // of the mode1 message
- unsigned int bits; // 8 or 16 are currently supported
-
+ unsigned int byte_offset; /* Offset from the 1st byte of the data part of the mode1 message */
+ unsigned int bits; /* 8 or 16 are currently supported */
unsigned int operation; // ALDL_OP_MULTIPLY: (X*factor)+offest
- // ALDL_OP_DIVIDE: (factor/X)+offset
- // ALDL_OP_SEPERATOR: use this for a seperator for the display,
- // not a data item. with this option no other
- // values matter except label.
- // you can also use the _DEF_SEP(label) macro like:
- // _DEF_SEP("---Basic Data---")
+ // ALDL_OP_DIVIDE: (factor/X)+offset
+ // ALDL_OP_SEPERATOR: use this for a seperator for the display,
+ // not a data item. with this option no other
+ // values matter except label.
+ // you can also use the _DEF_SEP(label) macro like:
+ // _DEF_SEP("---Basic Data---")
float op_factor; // factor for the operation
float op_offset; // offset for the operation
-
- const char* units;
+ const char* units; /* Text string */
} byte_def_t;
typedef struct _linuxaldl_definition{
+ const char* mask;
const char* name;
char mode1_request[__MAX_REQUEST_SIZE]; // the mode 1 request message, including the checksum
unsigned int mode1_request_length; // the length of the mode 1 message including the checksum
@@ -95,49 +87,44 @@ typedef struct _linuxaldl_definition{
char mode9_request[__MAX_REQUEST_SIZE]; // the mode 9 (un-silence) request message, incl checksum
unsigned int mode9_request_length; // the length of the mode 9 message including the checksum
-
+ unsigned int basic_baudrate; /* Fallback datarate */
+ unsigned int ideal_baudrate; /* Desired datarate -- 8192 or 160 */
} aldl_definition;
-
-
// looks up def_name in the aldl_definition_table until it finds the first
-// definition in the table with the name def_name
+// definition in the table with the name def_name or the mask defmask
// if the definition is not in the table, returns NULL
-aldl_definition* aldl_get_definition(const char* defname);
+aldl_definition* aldl_get_definition(const char* defname, const char *defmask);
typedef struct _linuxaldl_settings
{
+ /* Configuration fields */
const char* aldlportname; // path to aldl interface port
- int faldl; // aldl serial interface file descriptor
-
const char* logfilename; // filename for the log file
- int flogfile; // file descriptor for log file
-
- int scanning; // 1 when the timer has been set for making scans
- // 0 when not scanning
-
const char* aldldefname; // name for the ALDL definition to be used
- aldl_definition* definition; // see linuxaldl_definitions.h
+ unsigned int scan_interval; // msec between scan requests
+ unsigned int scan_timeout; // msec to timeout on scan request.
+ // note that read-sequence takes timeout in usec. // usec = msec*1000
- aldl_definition** aldl_definition_table; // array of pointers to data definitions.
- // this table is allocated in linuxaldl_definitions.h
- // and its value assigned upon the initialization of
- // the global "aldl_settings" variable
+ /* Data definitions */
+ aldl_definition** aldl_definition_table; // array of pointers to data definitions. (see linuxaldl_definitions.h)
+
+ /* Runtime stuff */
+ int faldl; // aldl serial interface file descriptor
+ int flogfile; // file descriptor for log file
+ int scanning; // 1 when the timer has been set for making scans, otherwise 0.
+ aldl_definition* definition; // see linuxaldl_definitions.h
- char* data_set_raw; // the current/most recent set of data from a mode1 message.
- // this is allocated when a definition is selected
+ char* data_set_raw; // the current/most recent set of data from a mode1 message.
+ // this is allocated when a definition is selected
char** data_set_strings; // pointer to array of data set in string format.
- // allocated when a definition is selected in the GUI
+ // allocated when a definition is selected in the GUI
float* data_set_floats; // data set in float format
- // allocated when a definition is selected in the GUI
+ // allocated when a definition is selected in the GUI
- unsigned int scan_interval; // msec between scan requests
- unsigned int scan_timeout; // msec to timeout on scan request.
- // note that read-sequence takes timeout in usec.
- // usec = msec*1000
} linuxaldl_settings;
// function prototypes
diff --git a/src/linuxaldl_definitions.h b/src/linuxaldl_definitions.h
index 867d964..c211c90 100644
--- a/src/linuxaldl_definitions.h
+++ b/src/linuxaldl_definitions.h
@@ -22,6 +22,7 @@ LICENSING INFORMATION:
#include <string.h>
#include "linuxaldl.h"
+#include "sts_serial.h"
// ===================================================================
// WRITING A DEFINITION FOR LINUXALDL
// ===================================================================
@@ -93,12 +94,44 @@ byte_def_t aldl_DF_mode1[]= {
LINUXALDL_MODE1_END_DEF
};
-aldl_definition aldl_DF = { "91-93 3.4 DOHC LQ1 ($DF)",
+byte_def_t aldl_9A_mode1[]= {
+ /* Label, offset, bits, operation, opfactor, opoffset, units */
+ _DEF_SEP("---Basic Data---"),
+ {"Engine RPM", 7, 8, 0, 25.0, 0.0, "RPM"}, /* NTRPMX */
+ {"Vehicle Speed", 5, 8, 0, 1.0, 0.0, "MPH"}, /* FILTMPH */
+ {"Throttle Position", 22, 8, 0, 0.39216, 0.0, "%"}, /* NTPSLD */
+ _DEF_SEP("----Fuel----"),
+ {"Integrator", 9, 8, 0, 1.0, 0.0, "counts"}, /* INT */
+ {"Narrowband O2", 10, 8, 0, 4.425, 0.0, "mV"}, /* ADO2A */
+ {"BLM", 18, 8, 0, 1.0, 0.0, "counts"}, /* BLM */
+ _DEF_SEP("--Ignition--"),
+ {"Knock Events", 17, 8, 0, 1.0, 0.0, "counts"}, /* OLDPA3 */
+ _DEF_SEP("--Accessory Data--"),
+ {"PROM ID", 1, 16, 0, 1.0, 0.0, "ID"}, /* PROMIDA + PROMIDB */
+ {"TPS Voltage", 8, 8, 0, 0.019608, 0.0, "volts"}, /* ADTHROT */
+ {"IAC Steps", 3, 8, 0, 1.0, 0.0, "steps"}, /* ISSPNP */
+ {"MAP Voltage", 6, 8, 0, 0.019608, 0.0, "volts"}, /* ADMAP */
+ {"Battery Voltage", 15, 8, 0, 0.1, 0.0, "volts"}, /* ADBAT */
+ {"O2 Cross-Count", 19, 8, 0, 1.0, 0.0, "counts"}, /* ALDLCNTR */
+ {"Fuel Pump Relay Volts", 20, 8, 0, 0.1, 0.0, "volts"}, /* PPSWVLT */
+ {"Desired Idle Speed", 21, 8, 0, 12.5, 0.0, "RPM"}, /* DESSPD */
+ LINUXALDL_MODE1_END_DEF
+};
+/* ADCOOL (table), MW2, MALFFLG1, MALFFLG2, MALFFLG3, MWAF1, MCU2IO (all bitmasks!) */
+
+aldl_definition aldl_DF = { "DF", "91-93 3.4 DOHC LQ1 ($DF)",
{0xF4, 0x57, 0x01, 0x00, 0xB4}, 5, 67, 63, 3, aldl_DF_mode1,
{0xF4, 0x56, 0x08, 0xAE}, 4,
- {0xF4, 0x56, 0x09, 0xAD}, 4
+ {0xF4, 0x56, 0x09, 0xAD}, 4,
+ B9600, 8192,
};
+aldl_definition aldl_9A = { "9A", "92-94 L03/L05 Truck (VIN H/K) w/MT ($9A)",
+ {0x00}, 0, 27, 23, 3, aldl_9A_mode1, /* Mode1 only */
+ {0x00}, 0,
+ {0x00}, 0,
+ B4800, 160,
+};
// ===========================================
// End DF code mask definition
// ===========================================
@@ -111,7 +144,7 @@ aldl_definition aldl_DF = { "91-93 3.4 DOHC LQ1 ($DF)",
// to the string given at the command line for the mask= argument.
// the gui uses this table to make the list of definitions.
// the last entry must be NULL.
-aldl_definition* aldl_definition_table[2] = { &aldl_DF, NULL };
+aldl_definition* aldl_definition_table[] = { &aldl_DF, &aldl_9A, NULL };
#endif
diff --git a/src/linuxaldl_gui.c b/src/linuxaldl_gui.c
index 9c7aebc..0f02468 100644
--- a/src/linuxaldl_gui.c
+++ b/src/linuxaldl_gui.c
@@ -1,23 +1,20 @@
-
-
-
/*(C) copyright 2008, Steven Snyder, All Rights Reserved
-Steven T. Snyder, <stsnyder@ucla.edu> http://www.steventsnyder.com
+ Steven T. Snyder, <stsnyder@ucla.edu> http://www.steventsnyder.com
-LICENSING INFORMATION:
- 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.
+ LICENSING INFORMATION:
+ 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.
+ 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, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -101,11 +98,11 @@ int linuxaldl_gui(int argc, char* argv[])
gtk_window_set_position(GTK_WINDOW (lfilew), GTK_WIN_POS_CENTER);
g_signal_connect(G_OBJECT (lfilew), "destroy", G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) lfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (lfilew)->ok_button), "clicked",
- G_CALLBACK (linuxaldl_gui_load), (gpointer) lfilew);
+ G_CALLBACK (linuxaldl_gui_load), (gpointer) lfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (lfilew)->ok_button), "clicked",
- G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) lfilew);
+ G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) lfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (lfilew)->cancel_button), "clicked",
- G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) lfilew);
+ G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) lfilew);
// stop the window from being destroyed when the X is clicked at the top right
g_signal_connect(G_OBJECT(lfilew),"delete_event", G_CALLBACK (hide_on_delete), NULL);
@@ -115,11 +112,11 @@ int linuxaldl_gui(int argc, char* argv[])
gtk_window_set_position(GTK_WINDOW (sfilew), GTK_WIN_POS_CENTER);
g_signal_connect(G_OBJECT (sfilew), "destroy", G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) sfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (sfilew)->ok_button), "clicked",
- G_CALLBACK (linuxaldl_gui_save), (gpointer) sfilew);
+ G_CALLBACK (linuxaldl_gui_save), (gpointer) sfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (sfilew)->ok_button), "clicked",
- G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) sfilew);
+ G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) sfilew);
g_signal_connect(G_OBJECT (GTK_FILE_SELECTION (sfilew)->cancel_button), "clicked",
- G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) sfilew);
+ G_CALLBACK (linuxaldl_gui_widgethide), (gpointer) sfilew);
// stop the window from being destroyed when the X is clicked at the top right
g_signal_connect(G_OBJECT(sfilew),"delete_event", G_CALLBACK (hide_on_delete), NULL);
@@ -158,14 +155,14 @@ int linuxaldl_gui(int argc, char* argv[])
// options button
button = gtk_button_new_with_label("Options");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) optionsw);
+ G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) optionsw);
gtk_container_add(GTK_CONTAINER (bbox_cmds), button);
gtk_widget_show(button);
// exit button
button = gtk_button_new_with_label("Quit");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_quit), NULL);
+ G_CALLBACK(linuxaldl_gui_quit), NULL);
gtk_container_add(GTK_CONTAINER (bbox_cmds), button);
gtk_widget_show(button);
@@ -189,21 +186,21 @@ int linuxaldl_gui(int argc, char* argv[])
// load .log file button
button = gtk_button_new_with_label("Load .log (playback)");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) lfilew);
+ G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) lfilew);
gtk_container_add(GTK_CONTAINER (bbox_settings_top), button);
gtk_widget_show(button);
// save .log file button
button = gtk_button_new_with_label("Select .log (to record)");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) sfilew);
+ G_CALLBACK(linuxaldl_gui_widgetshow), (gpointer) sfilew);
gtk_container_add(GTK_CONTAINER (bbox_settings_top), button);
gtk_widget_show(button);
// select definition
button = gtk_button_new_with_label("Select definition");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_try_choosedef), (gpointer) choosedefw);
+ G_CALLBACK(linuxaldl_gui_try_choosedef), (gpointer) choosedefw);
gtk_container_add(GTK_CONTAINER (bbox_settings_top), button);
gtk_widget_show(button);
@@ -218,7 +215,7 @@ int linuxaldl_gui(int argc, char* argv[])
// select definition
button = gtk_button_new_with_label("Show Data Readout");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_datareadout_show), (gpointer) datareadoutw);
+ G_CALLBACK(linuxaldl_gui_datareadout_show), (gpointer) datareadoutw);
gtk_container_add(GTK_CONTAINER (frame_data_control), button);
gtk_widget_show(button);
@@ -300,8 +297,8 @@ static void linuxaldl_gui_scan_interval_changed( GtkAdjustment *adj, gpointer da
g_source_remove(aldl_gui_settings.scanning_tag);
aldl_gui_settings.scanning_tag = g_timeout_add(aldl_settings.scan_interval,
- linuxaldl_gui_scan_on_interval,
- NULL);
+ linuxaldl_gui_scan_on_interval,
+ NULL);
}
}
@@ -383,8 +380,8 @@ static void linuxaldl_gui_scan( GtkWidget *widget, gpointer data)
{
// copy the data to the current data set
memcpy( aldl_settings.data_set_raw,
- inbuffer + aldl_settings.definition->mode1_data_offset,
- aldl_settings.definition->mode1_data_length);
+ inbuffer + aldl_settings.definition->mode1_data_offset,
+ aldl_settings.definition->mode1_data_length);
// update string and float representations
aldl_update_sets(ALDL_UPDATE_FLOATS|ALDL_UPDATE_STRINGS);
@@ -434,10 +431,10 @@ static void linuxaldl_gui_scan_toggle( GtkWidget *widget, gpointer data)
struct itimerval timer_value;
// if the button is down
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ {
// abort if no definition file selected, and toggle the button to off
- if (aldl_settings.definition == NULL)
+ if (aldl_settings.definition == NULL)
{
g_print("Scan aborted -- No definition file selected.\n");
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widget),FALSE);
@@ -447,13 +444,13 @@ static void linuxaldl_gui_scan_toggle( GtkWidget *widget, gpointer data)
{
g_print("Starting scan.\n");
aldl_gui_settings.scanning_tag = g_timeout_add(aldl_settings.scan_interval,
- linuxaldl_gui_scan_on_interval,
- NULL);
+ linuxaldl_gui_scan_on_interval,
+ NULL);
aldl_settings.scanning = 1;
linuxaldl_gui_scan(NULL,NULL); // perform initial scan
}
- }
+ }
else {
// button is up (turned off)
g_print("Stopping scan.\n");
@@ -528,7 +525,7 @@ static void linuxaldl_gui_save( GtkWidget *widget, GtkFileSelection *fs){
// if no definition is loaded yet, the definition loader has to write the header line.
// if no definition file selected, dont try to generate the header labels yet.
- if (aldl_settings.definition == NULL)
+ if (aldl_settings.definition == NULL)
g_warning(".csv format selected but no definition has been loaded.\n");
else
linuxaldl_gui_write_csv_header();
@@ -600,7 +597,7 @@ static void linuxaldl_gui_write_csv_line()
// write the timestamp
fprintf(aldl_gui_settings.slogfile,"%d+%f", (int)aldl_gui_settings.data_timestamp.tv_sec,
- (float)aldl_gui_settings.data_timestamp.tv_usec/1000000.0);
+ (float)aldl_gui_settings.data_timestamp.tv_usec/1000000.0);
// until at the end of the items in the definition...
for (i=0; def[i].label!=NULL; i++)
@@ -658,9 +655,9 @@ GtkWidget* linuxaldl_gui_options_new()
// scan interval adjustment
GtkWidget* interval_adj = hscale_new_with_label(aldl_settings.scan_interval,
- 50.0, 300.0, 1.0,
- G_CALLBACK(linuxaldl_gui_scan_interval_changed),
- "Scan Interval (msec)");
+ 50.0, 300.0, 1.0,
+ G_CALLBACK(linuxaldl_gui_scan_interval_changed),
+ "Scan Interval (msec)");
gtk_box_pack_start(GTK_BOX(vbox_options),interval_adj,FALSE,FALSE,0);
@@ -669,9 +666,9 @@ GtkWidget* linuxaldl_gui_options_new()
// timeout adjustment
GtkWidget* timeout_adj = hscale_new_with_label(aldl_settings.scan_timeout,
- 50.0,300.0, 1.0,
- G_CALLBACK(linuxaldl_gui_scan_timeout_changed),
- "Scan Timeout (msec)");
+ 50.0,300.0, 1.0,
+ G_CALLBACK(linuxaldl_gui_scan_timeout_changed),
+ "Scan Timeout (msec)");
gtk_box_pack_start(GTK_BOX(vbox_options),timeout_adj,FALSE,FALSE,0);
gtk_widget_show(timeout_adj);
@@ -742,128 +739,128 @@ static void linuxaldl_gui_datareadout_update(GtkWidget* widget, gpointer data)
// the linuxaldl_gui_datareadout_new function
static void linuxaldl_gui_datareadout_show(GtkWidget* widget, gpointer data)
{
- // if no definition selected, return without doing anything
- if (aldl_settings.definition == NULL)
- {
- g_print("No definition selected. Cannot show data readout. Choose a definition first.\n");
- return;
- }
- // if the Data Readout labels have been defined, no need to generate, just show the window
- if (aldl_gui_settings.data_readout_labels != NULL)
- {
- linuxaldl_gui_widgetshow(widget,data);
- return;
- }
+ // if no definition selected, return without doing anything
+ if (aldl_settings.definition == NULL)
+ {
+ g_print("No definition selected. Cannot show data readout. Choose a definition first.\n");
+ return;
+ }
+ // if the Data Readout labels have been defined, no need to generate, just show the window
+ if (aldl_gui_settings.data_readout_labels != NULL)
+ {
+ linuxaldl_gui_widgetshow(widget,data);
+ return;
+ }
- GtkWidget *vbox;
- GtkWidget *databox;
- GtkWidget *frame_main;
- byte_def_t* def = aldl_settings.definition->mode1_def;
- unsigned int i = 0, num_items=0, row=0;
+ GtkWidget *vbox;
+ GtkWidget *databox;
+ GtkWidget *frame_main;
+ byte_def_t* def = aldl_settings.definition->mode1_def;
+ unsigned int i = 0, num_items=0, row=0;
+
+ vbox = gtk_vbox_new(FALSE,0);
+ gtk_container_add(GTK_CONTAINER(data), vbox);
+ frame_main = gtk_frame_new("ALDL Data");
+ gtk_box_pack_start(GTK_BOX (vbox), frame_main, FALSE, FALSE, 0);
- vbox = gtk_vbox_new(FALSE,0);
- gtk_container_add(GTK_CONTAINER(data), vbox);
- frame_main = gtk_frame_new("ALDL Data");
- gtk_box_pack_start(GTK_BOX (vbox), frame_main, FALSE, FALSE, 0);
+ // the frame for each data seperator go in databox
+ databox = gtk_vbox_new(FALSE,0);
+ gtk_container_add(GTK_CONTAINER(frame_main), databox);
- // the frame for each data seperator go in databox
- databox = gtk_vbox_new(FALSE,0);
- gtk_container_add(GTK_CONTAINER(frame_main), databox);
+ gtk_widget_show(vbox);
+ gtk_widget_show(frame_main);
+ gtk_widget_show(databox);
- gtk_widget_show(vbox);
- gtk_widget_show(frame_main);
- gtk_widget_show(databox);
+ // Parse the Definition
- // Parse the Definition
+ // count the number of items in the definition
+ while (def[num_items].label != NULL)
+ {
+ num_items++;
+ }
- // count the number of items in the definition
- while (def[num_items].label != NULL)
- {
- num_items++;
- }
+ // allocate an array for the data label pointers.
+ // data_readout_labels[i] points to the label that
+ // contains a string representation of the value of
+ // the data element described by definition->mode1_def[i].
+ // where mode1_def[i] describes a seperator/label the value of
+ // data_readout_labels[i] is not defined.
+ // XXX need to free all the strings on exit, as well as this array..
+ aldl_gui_settings.data_readout_labels = g_malloc0((num_items)*sizeof(GtkWidget*));
+ GtkWidget *cur_vbox;
+ GtkWidget *cur_frame;
+ GtkWidget *cur_label;
+ GtkWidget *cur_table;
- // allocate an array for the data label pointers.
- // data_readout_labels[i] points to the label that
- // contains a string representation of the value of
- // the data element described by definition->mode1_def[i].
- // where mode1_def[i] describes a seperator/label the value of
- // data_readout_labels[i] is not defined.
- // XXX need to free all the strings on exit, as well as this array..
- aldl_gui_settings.data_readout_labels = g_malloc0((num_items)*sizeof(GtkWidget*));
- GtkWidget *cur_vbox;
- GtkWidget *cur_frame;
- GtkWidget *cur_label;
- GtkWidget *cur_table;
-
- // until at the end of the items in the definition
- for (i=0; def[i].label!=NULL; i++)
+ // until at the end of the items in the definition
+ for (i=0; def[i].label!=NULL; i++)
+ {
+ // if the item is a seperator
+ if (def[i].operation == ALDL_OP_SEPERATOR)
{
- // if the item is a seperator
- if (def[i].operation == ALDL_OP_SEPERATOR)
- {
- // make a new frame
- cur_frame = gtk_frame_new(def[i].label);
- gtk_box_pack_start(GTK_BOX(databox), cur_frame, FALSE, FALSE, 0);
- gtk_widget_show(cur_frame);
+ // make a new frame
+ cur_frame = gtk_frame_new(def[i].label);
+ gtk_box_pack_start(GTK_BOX(databox), cur_frame, FALSE, FALSE, 0);
+ gtk_widget_show(cur_frame);
- // make a table for the data elements in the frame
+ // make a table for the data elements in the frame
- // count how many elements there are until the next divider (or end of the definition)
- for (row=0; (def[i+row+1].label!=NULL && def[i+row+1].operation !=ALDL_OP_SEPERATOR); row++)
- { /* do nothing (just count up rows)*/ }
+ // count how many elements there are until the next divider (or end of the definition)
+ for (row=0; (def[i+row+1].label!=NULL && def[i+row+1].operation !=ALDL_OP_SEPERATOR); row++)
+ { /* do nothing (just count up rows)*/ }
- cur_table = gtk_table_new(row,3,FALSE);
+ cur_table = gtk_table_new(row,3,FALSE);
- gtk_container_add(GTK_CONTAINER(cur_frame),cur_table);
- gtk_widget_show(cur_table);
+ gtk_container_add(GTK_CONTAINER(cur_frame),cur_table);
+ gtk_widget_show(cur_table);
- // reset row to zero so it can be used when putting items in the table
- row=0;
- }
+ // reset row to zero so it can be used when putting items in the table
+ row=0;
+ }
- else // data item
- {
- // make a label for the data item's name
- cur_label = gtk_label_new(def[i].label);
- // make an alignment to align the label in the table
- GtkWidget *align = gtk_alignment_new(0.0,0.0,0.0,0.0);
-
- // add the label to the alignment, alignment to the current table
- gtk_container_add(GTK_CONTAINER(align), cur_label);
- gtk_table_attach_defaults(GTK_TABLE(cur_table), align, 0,1, row,row+1);
- gtk_widget_show(cur_label);
- gtk_widget_show(align);
-
- // make a label for the data value
- cur_label = gtk_label_new("N/A");
- // make an alignment to align the label in the table
- align = gtk_alignment_new(0.0,0.0,0.0,0.0);
- // add the label to the alignment, alignment to the current table
- gtk_container_add(GTK_CONTAINER(align), cur_label);
- gtk_table_attach(GTK_TABLE(cur_table), align, 1,2, row,row+1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 10, 0);
- gtk_widget_show(cur_label);
- gtk_widget_show(align);
-
- // register the data value label with the data displays array
- aldl_gui_settings.data_readout_labels[i] = cur_label;
-
- // make a label for the units
- cur_label = gtk_label_new(def[i].units);
- // make an alignemnt to align the label in the box
- align = gtk_alignment_new(0.0,0.0,0.0,0.0);
- // add the label to the alignment, alignment to the current table
- gtk_container_add(GTK_CONTAINER(align), cur_label);
- gtk_table_attach_defaults(GTK_TABLE(cur_table), align, 2,3, row,row+1);
- gtk_widget_show(cur_label);
- gtk_widget_show(align);
+ else // data item
+ {
+ // make a label for the data item's name
+ cur_label = gtk_label_new(def[i].label);
+ // make an alignment to align the label in the table
+ GtkWidget *align = gtk_alignment_new(0.0,0.0,0.0,0.0);
+
+ // add the label to the alignment, alignment to the current table
+ gtk_container_add(GTK_CONTAINER(align), cur_label);
+ gtk_table_attach_defaults(GTK_TABLE(cur_table), align, 0,1, row,row+1);
+ gtk_widget_show(cur_label);
+ gtk_widget_show(align);
+
+ // make a label for the data value
+ cur_label = gtk_label_new("N/A");
+ // make an alignment to align the label in the table
+ align = gtk_alignment_new(0.0,0.0,0.0,0.0);
+ // add the label to the alignment, alignment to the current table
+ gtk_container_add(GTK_CONTAINER(align), cur_label);
+ gtk_table_attach(GTK_TABLE(cur_table), align, 1,2, row,row+1,
+ GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 10, 0);
+ gtk_widget_show(cur_label);
+ gtk_widget_show(align);
+
+ // register the data value label with the data displays array
+ aldl_gui_settings.data_readout_labels[i] = cur_label;
+
+ // make a label for the units
+ cur_label = gtk_label_new(def[i].units);
+ // make an alignemnt to align the label in the box
+ align = gtk_alignment_new(0.0,0.0,0.0,0.0);
+ // add the label to the alignment, alignment to the current table
+ gtk_container_add(GTK_CONTAINER(align), cur_label);
+ gtk_table_attach_defaults(GTK_TABLE(cur_table), align, 2,3, row,row+1);
+ gtk_widget_show(cur_label);
+ gtk_widget_show(align);
- row++;
- }
+ row++;
}
+ }
- linuxaldl_gui_widgetshow(widget,data);
+ linuxaldl_gui_widgetshow(widget,data);
}
// ==================================
@@ -906,16 +903,16 @@ GtkWidget* linuxaldl_gui_choosedef_new()
// ---------------------------------------
dropdown = gtk_combo_new();
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (dropdown)->entry),
- "No Definitions");
+ "No Definitions");
// Form the entries for the combo box
GList *deflist = NULL;
g_print("Loading definitions...\n");
- g_print(" Found definitions: ");
+ g_print(" Found definitions:\n ");
while (aldl_settings.aldl_definition_table[i] != NULL)
{
if (i!=0)
- g_print(", ");
+ g_print("\n ");
g_print("%s",aldl_settings.aldl_definition_table[i]->name);
deflist = g_list_append (deflist, (gpointer) aldl_settings.aldl_definition_table[i]->name);
i++;
@@ -942,17 +939,17 @@ GtkWidget* linuxaldl_gui_choosedef_new()
// "cancel" button
button = gtk_button_new_with_label("Cancel");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_widgethide), (gpointer) defwindow);
+ G_CALLBACK(linuxaldl_gui_widgethide), (gpointer) defwindow);
gtk_container_add(GTK_CONTAINER (bbox), button);
gtk_widget_show(button);
// "select" button
button = gtk_button_new_with_label("Select");
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(linuxaldl_gui_widgethide), (gpointer) defwindow);
+ G_CALLBACK(linuxaldl_gui_widgethide), (gpointer) defwindow);
g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK (linuxaldl_gui_load_definition),
- GTK_ENTRY (GTK_COMBO (dropdown)->entry));
+ G_CALLBACK (linuxaldl_gui_load_definition),
+ GTK_ENTRY (GTK_COMBO (dropdown)->entry));
gtk_container_add(GTK_CONTAINER (bbox), button);
gtk_widget_show(button);
@@ -962,9 +959,6 @@ GtkWidget* linuxaldl_gui_choosedef_new()
return defwindow;
}
-
-
-
// this function refreshes the aldl definition in aldl_settings when the user
// presses the "select" button in the definition selection dialogue.
// data must point to a valid GtkEntry that contains the string for the definition name.
@@ -974,7 +968,7 @@ static void linuxaldl_gui_load_definition( GtkWidget *widget, gpointer data)
aldl_settings.aldldefname = gtk_entry_get_text (GTK_ENTRY (data));
// get the aldl definition address
- aldl_settings.definition = aldl_get_definition(aldl_settings.aldldefname);
+ aldl_settings.definition = aldl_get_definition(aldl_settings.aldldefname, NULL);
// if no definition by that name exists, definition will be NULL
if (aldl_settings.definition == NULL)
@@ -986,9 +980,6 @@ static void linuxaldl_gui_load_definition( GtkWidget *widget, gpointer data)
g_print("Definition \"%s\" selected:\n",aldl_settings.definition->name);
g_print(" Mode 1 message has %d data bytes.\n",aldl_settings.definition->mode1_data_length);
-
-
-
// allocate memory for the raw data array and zero it out
aldl_settings.data_set_raw = g_malloc0(aldl_settings.definition->mode1_data_length);
// allocate memory for the float array
@@ -1019,16 +1010,16 @@ static void linuxaldl_gui_load_definition( GtkWidget *widget, gpointer data)
// background activity will continue.
void quick_alert(gchar *message)
{
- GtkWidget *label, *content_area;
- GtkWidget *dialog = gtk_dialog_new_with_buttons("Alert",NULL,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT |GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_OK, GTK_RESPONSE_DELETE_EVENT, NULL);
- g_signal_connect_swapped(dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
- content_area = GTK_DIALOG(dialog)->vbox;
- label = gtk_label_new(message);
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
- gtk_box_pack_start(GTK_BOX(content_area),label,FALSE,FALSE,10);
- gtk_widget_show_all(dialog);
+ GtkWidget *label, *content_area;
+ GtkWidget *dialog = gtk_dialog_new_with_buttons("Alert",NULL,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT |GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_OK, GTK_RESPONSE_DELETE_EVENT, NULL);
+ g_signal_connect_swapped(dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+ content_area = GTK_DIALOG(dialog)->vbox;
+ label = gtk_label_new(message);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
+ gtk_box_pack_start(GTK_BOX(content_area),label,FALSE,FALSE,10);
+ gtk_widget_show_all(dialog);
}
@@ -1050,7 +1041,7 @@ GtkWidget* hscale_new_with_label(gdouble init_val, gdouble min, gdouble max, gdo
GtkObject* new_adj = gtk_adjustment_new(init_val, min, max, step, 0.0, 0.0);
g_signal_connect(G_OBJECT (new_adj), "value_changed",
- G_CALLBACK(changed), NULL);
+ G_CALLBACK(changed), NULL);
GtkWidget* new_scale = gtk_hscale_new(GTK_ADJUSTMENT(new_adj));
gtk_scale_set_value_pos( GTK_SCALE(new_scale),GTK_POS_RIGHT );