diff options
-rw-r--r-- | dummy_functions.c | 1 | ||||
-rw-r--r-- | dummy_functions.h | 1 | ||||
-rw-r--r-- | error_utils.c | 33 | ||||
-rw-r--r-- | i2c.c | 5 | ||||
-rw-r--r-- | i2c.h | 2 | ||||
-rw-r--r-- | lcd.c | 6 | ||||
-rw-r--r-- | parser.c | 9 | ||||
-rw-r--r-- | response.c | 1 | ||||
-rw-r--r-- | string_utils.c | 13 |
9 files changed, 28 insertions, 43 deletions
diff --git a/dummy_functions.c b/dummy_functions.c index 69bfa15..71b4e83 100644 --- a/dummy_functions.c +++ b/dummy_functions.c @@ -6,7 +6,6 @@ void GPIB_Set_Command_Error() {} void GPIB_Set_Query_Error() {} void GPIB_Set_Device_Dependent_Error() {} void GPIB_Set_Execution_Error() {} -void break_up_string(char* response, int n, char* r1, char* r2, char* r3) { } void Main_update_shift_registers() { } void IO_output_to_comm_bus(char* w, int n) { } //replace with real function void Error_check(void* p) { } diff --git a/dummy_functions.h b/dummy_functions.h index 27c5872..9990ec7 100644 --- a/dummy_functions.h +++ b/dummy_functions.h @@ -7,7 +7,6 @@ void GPIB_Set_Command_Error(); void GPIB_Set_Query_Error(); void GPIB_Set_Device_Dependent_Error(); void GPIB_Set_Execution_Error(); -void break_up_string(char* response, int n, char* r1, char* r2, char* r3); void Main_update_shift_registers(); void IO_output_to_comm_bus(char* w, int n); void Error_check(void*); diff --git a/error_utils.c b/error_utils.c index 56d515a..68c8b93 100644 --- a/error_utils.c +++ b/error_utils.c @@ -15,8 +15,11 @@ END DESCRIPTION **********************************************************/ #include <glib/gprintf.h>
#include "globals.h"
#include "dummy_functions.h"
+#include "lcd.h"
+
/*** EndHeader */
+/* FIXME */
int Error_Screen=NO;
void set_gpib_error_flags (int error_num);
@@ -88,7 +91,7 @@ void queue_error(int error_num) /*----------------------------------------------------------------------------------------------------------*/
void queue_error_and_get_text(gchar** response, int error_num)
{
- response[0]=0;
+ *response[0]=0;
if (error_num == OK) {
return;
}
@@ -100,7 +103,7 @@ void queue_error_and_get_text(gchar** response, int error_num) /*----------------------------------------------------------------------------------------------------------*/
void queue_error_from_parser(gchar** response, int error_num)
{
- response[0]=0;
+ *response[0]=0;
if (error_num == OK) {
return;
}
@@ -128,32 +131,8 @@ void queue_error_and_display_on_LCD(int error_num); void queue_error_and_display_on_LCD(int error_num)
{
gchar* response = NULL;
- char row0[LCD_cols+1];
- char row1[LCD_cols+1];
- char row2[LCD_cols+1];
-
- char Press_Change_Message[max_output_length]; //!!!
-
- if (error_num == OK) {
- return;
- }
queue_error_and_get_text(&response, error_num);
-
- memset(row0,0,LCD_cols+1);
- memset(row1,0,LCD_cols+1);
- memset(row2,0,LCD_cols+1);
-
- Error_Screen=YES;
-
- break_up_string (response, LCD_cols, row0, row1, row2);
-
- LCD_clear();
- LCD_write(0,0,row0);
- LCD_write(1,0,row1);
- LCD_write(2,0,row2);
- LCD_write(3,0,Press_Change_Message);
-
- g_free(response);
+ LCD_display_error_message (response);
}
@@ -10,7 +10,7 @@ #define I2C_BUS "/dev/i2c-3" -int I2C_Write(gulong address, guchar value) { +void I2C_Write(gulong address, guchar value) { struct i2c_smbus_ioctl_data argswrite; @@ -21,7 +21,8 @@ int I2C_Write(gulong address, guchar value) { int device = open(I2C_BUS, O_RDWR); - if (device == -1) return device; + // FIXME? + if (device == -1) return; ioctl(device, I2C_SLAVE, address); ioctl(device, I2C_SMBUS, &argswrite); @@ -17,5 +17,5 @@ /* 6 and 7 reserved for dual-channel current monitor */ -int I2C_Write(gulong address, guchar value); +void I2C_Write(gulong address, guchar value); guchar I2C_Read(gulong address); @@ -66,7 +66,7 @@ static void break_up_string (char *in_string, int N, char **str1, char **str2, c strcpy(copy_input, in_string+copypos);
}
n = strlen(interm_str);
- for (k=n-1; k=0; k--) { //trim space
+ for ((k=n-1); (k=0); k--) { //trim space
if (*(interm_str+k)==' ') {
*(interm_str+k)=0;
} else {
@@ -96,8 +96,8 @@ static void break_up_string (char *in_string, int N, char **str1, char **str2, c void LCD_clear()
{
- char i;
- char j;
+ int i;
+ int j;
I2C_Write(PCF8574A+LCD_Port, 0x00 | LCD_ENABLE);
I2C_Write(PCF8574A+LCD_Port, 0x00);
@@ -494,12 +494,15 @@ static int Parser_get_unit(char *parameter,char *units) parameter[j]=0;
}
- if (i < strlen(parameter))
+ if (i < strlen(parameter)) {
if ( (parameter[i]=='e' && parameter[i+1]=='-')
- || (parameter[i]=='e' && parameter[i+1]=='+') )
+ || (parameter[i]=='e' && parameter[i+1]=='+') ) {
for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {}
- else if (parameter[i]=='e' && isdigit(parameter[i+1]) )
+ }
+ else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) {
for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {}
+ }
+ }
/* suck out spaces */
while ( (i<strlen(parameter)) && (isspace(parameter[i])) ) {
@@ -2,6 +2,7 @@ #include "socket-common.h" #include "lcd.h" #include "i2c.h" +#include "signalobject.h" #include "parser.h" #include <string.h> #include <stdlib.h> diff --git a/string_utils.c b/string_utils.c index b5ec2c2..31ef0ff 100644 --- a/string_utils.c +++ b/string_utils.c @@ -210,12 +210,15 @@ int String_is_it_numeric(char *parameter) parameter[j]=0;
}
- if (i < strlen(parameter))
- if ( (parameter[i]=='e' && parameter[i+1]=='-')
- || (parameter[i]=='e' && parameter[i+1]=='+') )
+ if (i < strlen(parameter)) {
+ if ( (parameter[i]=='e' && parameter[i+1]=='-')
+ || (parameter[i]=='e' && parameter[i+1]=='+') ) {
for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {}
- else if (parameter[i]=='e' && isdigit(parameter[i+1]) )
+ }
+ else if (parameter[i]=='e' && isdigit(parameter[i+1]) ) {
for (i+=2; (i < strlen(parameter)) && isdigit(parameter[i]); ++i) {}
+ }
+ }
/* suck out spaces */
while ( (i<strlen(parameter)) && (isspace(parameter[i])) ) {
@@ -225,7 +228,7 @@ int String_is_it_numeric(char *parameter) parameter[j]=0;
}
- if (i = strlen(parameter)) {
+ if ((i = strlen(parameter))) {
is_number=1;
parameter[i]=0;
}
|