# HG changeset patch # User darius@Inchoate # Date 1224502878 -37800 # Node ID efd44dc4093481d63d15f302fcc535a11504785a # Parent f219538d6ea78fbe5b58ecbea43dd56f4b044812 Add macros for number system used for temperatures. Add error strings and improve comments for ROM programming. diff -r f219538d6ea7 -r efd44dc40934 1wire.c --- a/1wire.c Sun Jul 06 22:42:42 2008 +0930 +++ b/1wire.c Mon Oct 20 22:11:18 2008 +1030 @@ -48,6 +48,13 @@ static uint8_t OW_LastDiscrepancy = 0; static uint8_t OW_LastFamilyDiscrepancy = 0; +const PROGMEM char *OWProgROM_Status[] = { + "OK", + "not possible (no HW support)", + "Invalid parameters", + "module doesn't exist or didn't respond properly" +}; + /*----------------------------------------------------------------------------- * Configure the IO port as we need */ @@ -414,7 +421,7 @@ * * Returns.. * 0 if all is OK - * 1 if the programming was unsuccessful + * 1 if the programming is not possible * 2 if the parameters were invalid * 3 if the DS2502 didn't respond appropriately (also happens if the * module doesn't exist) @@ -426,7 +433,7 @@ /* Stupid programmer detection */ if (status) { - if (start + len > 3) + if (start + len > 3) return(2); } else { if (start + len > 127) diff -r f219538d6ea7 -r efd44dc40934 1wire.h --- a/1wire.h Sun Jul 06 22:42:42 2008 +0930 +++ b/1wire.h Mon Oct 20 22:11:18 2008 +1030 @@ -82,3 +82,10 @@ #define OW_TEMP_WRONG_FAM -1000 #define OW_TEMP_CRC_ERR -1001 #define OW_TEMP_NO_ROM -1002 + +/* Helpers for OWGetTemp's number system */ +#define GETWHOLE(x) ((x) / 100) +#define GETFRAC(x) ((x) - (GETWHOLE(x) * 100)) + +extern const PROGMEM char *OWProgROM_Status[]; +