Problem creating an array for Think City
Hi, I'm trying to create a fault/error SMS function for the vehicle_thinkcity.c The idea is making a two columns array, where the first column keeps different alarm messages available, while the second column keeps the state-variables of the corresponding error. Later on, only active errors, which has it's state-variable flag set, will be sent in the SMS (and the number of active errors). Unfortunately my code did not work, and I therefor ask you for some help. *The code is currently:* *void vehicle_thinkcity_fault_prepmsg(void)* *{* * * * rom char vehicle_thinkcity_fault_txttable[][] = * * {* * "MnyFailCel", // -> tc_bit_manyfailedcells;* * "Crash", // -> tc_bit_crash;* * "GenErr", // -> tc_bit_generalerr;* * "IsoErr", // -> tc_bit_isoerr;* * "IntIso", // -> tc_bit_intisoerr;* * "ExtIso", // -> tc_bit_extisoerr;* * "ThermIso", // -> tc_bit_thermalisoerr;* * "EmgEPO", // -> tc_bit_epoemerg;* * "ChgWaitTemp", // -> tc_bit_chgwaittemp;* * "ReachEOC", // -> tc_bit_reacheocplease;* * "WaitOkTpDcg", // -> tc_bit_waitoktmpdisch;* * "CrgWaitTp2", // -> tc_bit_chgwaitttemp2;* * "NoChgCur", // -> tc_bit_nochgcurr;* * "ChgOverVolt", // -> tc_bit_chgovervolt;* * "ChgOverCur", // -> tc_bit_chgovercurr;* * ""* * };* * * * rom char vehicle_thinkcity_fault_vartable[] = * * {* * tc_bit_manyfailedcells,* * tc_bit_crash,* * tc_bit_generalerr,* * tc_bit_isoerr,* * tc_bit_intisoerr,* * tc_bit_extisoerr,* * tc_bit_thermalisoerr,* * tc_bit_epoemerg,* * tc_bit_chgwaittemp,* * tc_bit_reacheocplease,* * tc_bit_waitoktmpdisch,* * tc_bit_chgwaitttemp2,* * tc_bit_nochgcurr,* * tc_bit_chgovervolt,* * tc_bit_chgovercurr* * };* * * * * * char *s;* * int k;* * int errcount = 0 ;* * * * * * s = strchr(net_scratchpad, 0);* * s = stp_rom(s, "Act err:");* * * * //additional info for error-print* * if (tc_pack_failedcells != 0)* * {* * s = stp_i(s, "\rFailCel:", tc_pack_failedcells);* * errcount++;* * }* * // end additional info * * * * for (k = 0; vehicle_thinkcity_fault_txttable[k][0] != 0; k++)* * {* * if (vehicle_thinkcity_fault_vartable[k] != 0)* * {* * s = stp_i(s, "\r", vehicle_thinkcity_fault_txttable[k]);* * k++;* * errcount++;* * }* * }* * s = stp_i(s, "\rTot err: ", errcount);* * * * * * * *}* Best regards Håkon
Is it possible to use the net.h net_req_notification_error() system. That can be used to send an error code, and associated data, to the server. The server applies a lookup table to convert the error code to error message (per vehicle model), and then sends the alert out as a push notification to the Apps. Regards, Mark. On 22 Aug, 2013, at 4:30 AM, Håkon Markussen <hakon.markussen@gmail.com> wrote:
Hi,
I'm trying to create a fault/error SMS function for the vehicle_thinkcity.c The idea is making a two columns array, where the first column keeps different alarm messages available, while the second column keeps the state-variables of the corresponding error. Later on, only active errors, which has it's state-variable flag set, will be sent in the SMS (and the number of active errors).
Unfortunately my code did not work, and I therefor ask you for some help.
The code is currently: void vehicle_thinkcity_fault_prepmsg(void) {
rom char vehicle_thinkcity_fault_txttable[][] = { "MnyFailCel", // -> tc_bit_manyfailedcells; "Crash", // -> tc_bit_crash; "GenErr", // -> tc_bit_generalerr; "IsoErr", // -> tc_bit_isoerr; "IntIso", // -> tc_bit_intisoerr; "ExtIso", // -> tc_bit_extisoerr; "ThermIso", // -> tc_bit_thermalisoerr; "EmgEPO", // -> tc_bit_epoemerg; "ChgWaitTemp", // -> tc_bit_chgwaittemp; "ReachEOC", // -> tc_bit_reacheocplease; "WaitOkTpDcg", // -> tc_bit_waitoktmpdisch; "CrgWaitTp2", // -> tc_bit_chgwaitttemp2; "NoChgCur", // -> tc_bit_nochgcurr; "ChgOverVolt", // -> tc_bit_chgovervolt; "ChgOverCur", // -> tc_bit_chgovercurr; "" };
rom char vehicle_thinkcity_fault_vartable[] = { tc_bit_manyfailedcells, tc_bit_crash, tc_bit_generalerr, tc_bit_isoerr, tc_bit_intisoerr, tc_bit_extisoerr, tc_bit_thermalisoerr, tc_bit_epoemerg, tc_bit_chgwaittemp, tc_bit_reacheocplease, tc_bit_waitoktmpdisch, tc_bit_chgwaitttemp2, tc_bit_nochgcurr, tc_bit_chgovervolt, tc_bit_chgovercurr };
char *s; int k; int errcount = 0 ;
s = strchr(net_scratchpad, 0); s = stp_rom(s, "Act err:");
//additional info for error-print if (tc_pack_failedcells != 0) { s = stp_i(s, "\rFailCel:", tc_pack_failedcells); errcount++; } // end additional info
for (k = 0; vehicle_thinkcity_fault_txttable[k][0] != 0; k++) { if (vehicle_thinkcity_fault_vartable[k] != 0) { s = stp_i(s, "\r", vehicle_thinkcity_fault_txttable[k]); k++; errcount++; } } s = stp_i(s, "\rTot err: ", errcount);
}
Best regards Håkon _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
participants (2)
-
Håkon Markussen -
Mark Webb-Johnson