From cba57a46f758cff1cb49df0b337eac82ab4453f3 Mon Sep 17 00:00:00 2001 From: Erik Andresen Date: Sun, 12 Nov 2017 09:38:10 +0100 Subject: [PATCH] Implement current reading --- avr/nano/main.c | 25 ++ avr/nano/main.hex | 634 +++++++++++++++++++++++---------------------- scripts/pyshared | 2 +- scripts/wt_node.py | 4 +- 4 files changed, 357 insertions(+), 308 deletions(-) diff --git a/avr/nano/main.c b/avr/nano/main.c index 7b62c80..78e8531 100644 --- a/avr/nano/main.c +++ b/avr/nano/main.c @@ -26,6 +26,8 @@ * 0x0A Voltage LSB * 0x0B Distance forward2 MSB * 0x0C Distance forward2 LSB + * 0x0D Current MSB + * 0x0E Current LSB * * 0x15 Distance forward1 MSB (read only) * 0x16 Distance forward1 LSB (read only) @@ -53,6 +55,7 @@ static volatile uint8_t start_dist_fwd1=0; static volatile uint8_t start_dist_fwd2=0; static volatile uint8_t start_dist_bwd=0; static volatile uint16_t voltage=0; +static volatile uint16_t current=0; static volatile uint8_t pind_pre=0; ISR(TWI_vect) @@ -141,6 +144,15 @@ ISR(TWI_vect) TWDR = tmp16; TWI_ACK; break; + case 0x0D: // Current MSB + tmp16 = current; + TWDR = tmp16>>8; + TWI_ACK; + break; + case 0x0E: // Current LSB + TWDR = tmp16; + TWI_ACK; + break; case 0x15: // Distance forward1 MSB tmp16 = dist_forward1; TWDR = tmp16>>8; @@ -232,6 +244,16 @@ static unsigned short get_voltage(void) { } +/* + * zero offset: 0.5V + * sensitivity: 133mV/A + */ +static unsigned short get_current(void) { + double volt = ReadChannel(3)*5.0171; // mV + return (volt-517.78)/0.12656; // mA +} + + ISR(INT0_vect) { static uint16_t t_start=0; uint16_t t_now = TCNT1; @@ -321,6 +343,9 @@ int main(void) { case 0x09: // voltage voltage = get_voltage(); break; + case 0x0d: // current + current = get_current(); + break; case 0xff: // Magic reg that starts the bootloader if (bootloader == 0xa5) { cli(); diff --git a/avr/nano/main.hex b/avr/nano/main.hex index 3f3fa6b..206cdf5 100644 --- a/avr/nano/main.hex +++ b/avr/nano/main.hex @@ -1,314 +1,336 @@ -:100000000C945F000C945B010C94A5010C947C0093 -:100010000C947C000C94EF010C947C000C947C00FC +:100000000C945F000C9461010C94AB010C947C0087 +:100010000C947C000C94F5010C947C000C947C00F6 :100020000C947C000C947C000C947C000C947C0060 :100030000C947C000C947C000C947C000C947C0050 -:100040000C947C000C947C000C9450020C947C006A +:100040000C947C000C947C000C9456020C947C0064 :100050000C947C000C947C000C947C000C947C0030 -:100060000C947E000C947C00E0000401E500040187 -:10007000F5000401FA000401F0000401FF0004018E -:100080000A010A010A010A010A010A010A010A0118 -:10009000F5000401FA000401FF0004010D0A537485 +:100060000C947E000C947C00E1000A01E6000A0179 +:10007000FB000A0100010A01F1000A0105010A0161 +:10008000F6000A0110011001100110011001100109 +:10009000FB000A0100010A0105010A010D0A53745F :1000A0006172740D0A0045464765666700202B2D76 :1000B0002E30313233343536373839680000112468 :1000C0001FBECFEFD8E0DEBFCDBF21E0A6E0B1E09C -:1000D00001C01D92A539B207E1F711E0A0E0B1E03F -:1000E000E8E7F3E102C005900D92A630B107D9F719 -:1000F0000E9457030C94BA090C9400001F920F92AF +:1000D00001C01D92A739B207E1F711E0A0E0B1E03D +:1000E000ECEDF4E102C005900D92A630B107D9F70E +:1000F0000E945D030C946C0A0C9400001F920F92F6 :100100000FB60F9211248F939F93AF93BF93EF93EA -:10011000FF938091B900887F803A09F486C028F463 -:10012000803641F0803861F082C0883AE1F1883B46 -:10013000D1F17DC085EC8093BC0010921F017AC084 -:1001400080911F01882339F08F3F29F58091BB00F2 -:1001500080931E0120C08091BB0080931F0180917D -:100160001F01853019F481E08093130180911F01F4 -:10017000873019F481E08093110180911F018B3049 -:1001800019F481E08093120180911F0181508093C6 -:100190001F0185EC01C085E88093BC0080911F01A0 -:1001A0008F3FE9F547C0E0911F018E2F90E0FC01E1 -:1001B0003197EA31F10570F5EC5CFF4F0C945C056A -:1001C00080911C0190911D0104C080911A019091B1 -:1001D0001B0180930C0190930D019093BB0018C0FC -:1001E00080910F0190911001F4CF809118019091AE -:1001F0001901EFCF8091140190911501EACF809100 -:10020000160190911701E5CF80910C018093BB00FE -:1002100085EC03C01092BB0085E88093BC00809100 -:100220001F018F5F80931F0105C085EC01C085ED24 -:100230008093BC00FF91EF91BF91AF919F918F91FF -:100240000F900FBE0F901F90189593E890937A002F -:1002500080937C0080917C00806480937C008091FE -:100260007A00806480937A0080917A0086FDFCCFCA -:10027000809178009091790025E080E090E03091C5 -:100280007A00306430937A0030917A0036FDFCCFEA -:100290004091780050917900840F951F215079F793 -:1002A00020917A002F7720937A0065E070E00E9419 -:1002B0002905CB0108951F920F920FB60F921124BA -:1002C0002F933F934F935F936F937F938F939F935E -:1002D000AF93BF93EF93FF9360918400709185007B -:1002E0004A9B05C070930B0160930A011DC0809169 -:1002F0000A0190910B01681B790B80E090E00E944D -:10030000570627EE3CE840E350E40E94E50620E073 -:1003100030E040E05FE30E94BC050E942806709335 -:10032000190160931801E898FF91EF91BF91AF9187 -:100330009F918F917F916F915F914F913F912F91FD -:100340000F900FBE0F901F9018951F920F920FB62F -:100350000F9211242F933F934F935F936F937F934B -:100360008F939F93AF93BF93EF93FF93609184001C -:10037000709185004B9B05C0709309016093080143 -:100380001DC08091080190910901681B790B80E0E4 -:1003900090E00E94570627EE3CE840E350E40E94BC -:1003A000E50620E030E040E05FE30E94BC050E94EB -:1003B00028067093150160931401E998FF91EF915D -:1003C000BF91AF919F918F917F916F915F914F916D -:1003D0003F912F910F900FBE0F901F9018951F9275 -:1003E0000F920FB60F9211242F933F934F935F9369 -:1003F0006F937F938F939F93AF93BF93EF93FF93ED -:10040000CF93DF931F92CDB7DEB799B199838091D7 -:100410000E01892784FF2DC06091840070918500B2 -:10042000898184FF05C0709307016093060121C094 -:100430008091060190910701681B790B80E090E0A4 -:100440000E94570627EE3CE840E350E40E94E50690 -:1004500020E030E040E05FE30E94BC050E942806F7 -:10046000709317016093160180916D008F7E8093C9 -:100470006D00898180930E010F90DF91CF91FF91E4 -:10048000EF91BF91AF919F918F917F916F915F910C -:100490004F913F912F910F900FBE0F901F90189585 -:1004A0001F920F920FB60F9211248F939F93EF9389 -:1004B000FF938091C00087FF17C0E0912201F09167 -:1004C00023018091C600808381E0E738F80730F48B -:1004D0003196F0932301E093220106C084E291E07B -:1004E0009093230180932201FF91EF919F918F912F -:1004F0000F900FBE0F901F9018959C01E1ECF0E05B -:1005000088E1808380818068808386E08093C20058 -:10051000C901A0E0B0E09C01AD0184E0220F331FCF -:10052000441F551F8A95D1F760E074E284EF90E094 -:100530000E943D05DA01C9010197A109B109892F7E -:100540009A2FAB2FBB27A7FDBA958093C5002150EA -:100550002093C40084E291E09093210180932001D4 -:10056000909323018093220108952091C00025FFDC -:10057000FCCFFC0180818093C6000895CF93DF9368 -:100580001F92CDB7DEB78983CE0101960E94B502D6 -:1005900080E090E00F90DF91CF910895CF93DF93AB -:1005A000EC01CE012196FC012081222319F00E944A -:1005B000B502F7CFDF91CF9108958091C00087FFFA -:1005C000FCCF8091C60090E008950C94DD0265EEAA -:1005D00072E08EEB92E00C945D07CF93DF93FC0109 -:1005E000E253FF4FA081B181EC01C453DF4F28815A -:1005F0003981A217B307B9F02091C00025FF13C0BD -:100600002C912093C60020813181AC0145535F4F6E -:100610002417350718F42F5F3F4F03C09C0128595A -:100620003F4F31832083E0912001F09121012091FF -:100630002201309123012E173F07B1F1EC01CC5973 -:10064000DF4FA881B98120812C93688179819C0139 -:100650002B523F4FD9013C91DB012C91321307C043 -:10066000AC014C525F4FDA012C912F5F2C939C010F -:100670002D593F4F6217730728F4DB011196B98398 -:10068000A88302C099838883B1E0E738FB0730F480 -:100690003196F0932101E093200106C084E291E0BD -:1006A0009093210180932001DF91CF9108951092C2 -:1006B0001E0180E895E20E947D020E94E70282E529 -:1006C0008093BA0085EC8093BC001092800084E097 -:1006D0008093810095E090936900809368008CE995 -:1006E00090E09F938F930E94E40783B7817F83BF3D -:1006F00078940F900F90C8E1D8E080911F0183306B -:1007000089F058F4813009F03EC080E00E94250154 -:1007100090931D0180931C0136C0893059F08F3FA2 -:10072000F1F031C081E00E94250190931B0180937C -:100730001A0129C082E00E942501BC0180E090E0FE -:100740000E94570628E431EE4AEB5FE30E94E5067B -:100750000E9428067093100160930F0114C08091CD -:100760001E01853A81F4F8946BE780E090E00E94E6 -:10077000AC09F999FECF0FB6F894A895C093600024 -:100780000FBED093600080911301882391F01092E6 -:1007900013011092190110921801529A5A9A85E386 -:1007A0008A95F1F700005A9852988CB381708CBBEF -:1007B000E89A80911101882391F010921101109212 -:1007C000150110921401539A5B9A85E38A95F1F70B -:1007D00000005B9853988CB382708CBBE99A80912F -:1007E00012018823B1F01092120110921701109299 -:1007F0001601549A5C9A85E38A95F1F700005C989B -:10080000549889B180930E0180916D00806180932E -:100810006D0083B7816083BF889583B78E7F83BF68 -:100820006CCFABE0B0E0E7E1F4E00C9466056C015E -:100830007B013A01FC0117821682838181FF03C18B -:10084000CE0101964C01F601B380F701B3FC05918E -:10085000B3FE01917F01002309F4F1C0053249F490 -:10086000B3FC0591B3FE01917F01053211F010E058 -:1008700019C0B601802F90E00E94A80753013501EE -:10088000E2CF002309F4DBC0602F70E08DEA90E036 -:100890000E945207892B49F0F701B3FC0591B3FE82 -:1008A00001917F0117FFEDCF04C0033239F00C3600 -:1008B00019F0011105C0C3C01068EECF10E1ECCFF4 -:1008C000602F70E086EA90E00E945207892B41F089 -:1008D0005301F4E0AF0EB11CB6018FE390E010C0FD -:1008E000033631F0033779F0033511F511600BC091 -:1008F000530182E0A80EB11CB601F3018081918101 -:100900000E94A807BCCF5301F2E0AF0EB11CF30167 -:1009100060807180F30110FD859110FF81913F018E -:10092000882309F4ACCFB60190E00E94A807F2CF6B -:10093000043611F0093621F5530117FF09C0F4E020 -:10094000AF0EB11CF30160817181828193810AC075 -:10095000F2E0AF0EB11CF30160817181072E000C33 -:10096000880B990B1F7E97FF08C090958095709516 -:1009700061957F4F8F4F9F4F10642AE030E030C069 -:10098000003791F040F40835A1F00F3609F057C058 -:1009900028E030E011C0053719F0083731F04FC0BA -:1009A0001F7E2AE030E008C01061146220E130E0D0 -:1009B00003C0146020E132E0530117FF09C0F4E0E6 -:1009C000AF0EB11CF301608171818281938108C0F7 -:1009D000F2E0AF0EB11CF3016081718180E090E024 -:1009E000A4010E940A08082F081916FF05C0B601C5 -:1009F0008DE290E00E94A80714FF15C0FE01E00FF1 -:100A0000F11D8081803379F0B60180E390E00E948F -:100A1000A80712FF08C01072812F90E0B601885A13 -:100A20009F4F0E94A8070150F401E00FF11D808143 -:100A3000B60190E00E94A8070111F5CF20CFF60182 -:100A40008681978102C08FEF9FEF2B96EEE00C948A -:100A50008205AA1BBB1B51E107C0AA1FBB1FA6171B -:100A6000B70710F0A61BB70B881F991F5A95A9F757 -:100A700080959095BC01CD010895052E97FB1EF43D -:100A800000940E94540557FD07D00E94990507FC69 -:100A900003D04EF40C945405509540953095219513 -:100AA0003F4F4F4F5F4F089590958095709561959A -:100AB0007F4F8F4F9F4F0895EE0FFF1F0590F491CA -:100AC000E02D09942F923F924F925F926F927F9206 -:100AD0008F929F92AF92BF92CF92DF92EF92FF924E -:100AE0000F931F93CF93DF93CDB7DEB7CA1BDB0BFA -:100AF0000FB6F894DEBF0FBECDBF09942A8839889F -:100B000048885F846E847D848C849B84AA84B984A5 -:100B1000C884DF80EE80FD800C811B81AA81B981B1 -:100B2000CE0FD11D0FB6F894DEBF0FBECDBFED01C5 -:100B30000895A1E21A2EAA1BBB1BFD010DC0AA1F1E -:100B4000BB1FEE1FFF1FA217B307E407F50720F036 -:100B5000A21BB30BE40BF50B661F771F881F991FB1 -:100B60001A9469F760957095809590959B01AC01FA -:100B7000BD01CF0108955058BB27AA270E94D30575 -:100B80000C94AB060E949D0638F00E94A40620F04B -:100B900039F49F3F19F426F40C949A060EF4E0956C -:100BA000E7FB0C949406E92F0E94BC0658F3BA1791 -:100BB000620773078407950720F079F4A6F50C9473 -:100BC000DE060EF4E0950B2EBA2FA02D0B01B90115 -:100BD00090010C01CA01A0011124FF27591B99F0B3 -:100BE000593F50F4503E68F11A16F040A22F232FBF -:100BF000342F4427585FF3CF469537952795A7950F -:100C0000F0405395C9F77EF41F16BA0B620B730BB5 -:100C1000840BBAF09150A1F0FF0FBB1F661F771F26 -:100C2000881FC2F70EC0BA0F621F731F841F48F4DB -:100C3000879577956795B795F7959E3F08F0B0CF64 -:100C40009395880F08F09927EE0F9795879508954B -:100C50000E94C40688F09F5798F0B92F9927B75182 -:100C6000B0F0E1F0660F771F881F991F1AF0BA9550 -:100C7000C9F714C0B13091F00E94DE06B1E00895CA -:100C80000C94DE06672F782F8827B85F39F0B93FBC -:100C9000CCF3869577956795B395D9F73EF4909503 -:100CA0008095709561957F4F8F4F9F4F0895E89481 -:100CB00009C097FB3EF490958095709561957F4FA4 -:100CC0008F4F9F4F9923A9F0F92F96E9BB27939552 -:100CD000F695879577956795B795F111F8CFFAF462 -:100CE000BB0F11F460FF1BC06F5F7F4F8F4F9F4F93 -:100CF00016C0882311F096E911C0772321F09EE8F1 -:100D0000872F762F05C0662371F096E8862F70E056 -:100D100060E02AF09A95660F771F881FDAF7880F30 -:100D20009695879597F9089597F99F6780E870E001 -:100D300060E008959FEF80EC089500240A94161651 -:100D4000170618060906089500240A9412161306B9 -:100D5000140605060895092E0394000C11F4882347 -:100D600052F0BB0F40F4BF2B11F460FF04C06F5F63 -:100D70007F4F8F4F9F4F089557FD9058440F551F39 -:100D800059F05F3F71F04795880F97FB991F61F00D -:100D90009F3F79F087950895121613061406551F84 -:100DA000F2CF4695F1DF08C0161617061806991FF0 -:100DB000F1CF86957105610508940895E894BB27E5 -:100DC00066277727CB0197F908950E94F8060C94BF -:100DD000AB060E949D0638F00E94A40620F09523E1 -:100DE00011F00C9494060C949A0611240C94DF06CE -:100DF0000E94BC0670F3959FC1F3950F50E0551FFC -:100E0000629FF001729FBB27F00DB11D639FAA275F -:100E1000F00DB11DAA1F649F6627B00DA11D661FAE -:100E2000829F2227B00DA11D621F739FB00DA11DCF -:100E3000621F839FA00D611D221F749F3327A00D89 -:100E4000611D231F849F600D211D822F762F6A2F25 -:100E500011249F5750409AF0F1F088234AF0EE0F8A -:100E6000FF1FBB1F661F771F881F91505040A9F7B7 -:100E70009E3F510580F00C9494060C94DF065F3F72 -:100E8000E4F3983ED4F3869577956795B795F795F3 -:100E9000E7959F5FC1F7FE2B880F911D969587956B -:100EA00097F90895FC010590061621F00020D9F766 -:100EB000C00108953197CF0108950F931F93CF93E9 -:100EC000DF93009731F46115710519F480E090E02B -:100ED0003AC08B01EC016EE070E081E090E00E948E -:100EE0006808FC01892B91F380E8838301151105C3 -:100EF00071F01387028781E8838380918B01909141 -:100F00008C01892B21F4F0938C01E0938B012097C5 -:100F1000C9F0D187C08783818260838380918D01EE -:100F200090918E01892B71F4F0938E01E0938D01E5 -:100F300080918F0190919001892B21F4F093900181 -:100F4000E0938F01CF01DF91CF911F910F91089511 -:100F50000F931F93CF93DF93FB01238121FD03C0E8 -:100F60008FEF9FEF2CC022FF16C04681578124814E -:100F700035814217530744F4A081B1819D012F5F51 -:100F80003F4F318320838C93268137812F5F3F4FE2 -:100F90003783268314C08B01EC01FB010084F185AB -:100FA000E02D0995892BE1F6D80116968D919C913B -:100FB0001797019617969C938E931697CE01DF9103 -:100FC000CF911F910F910895A0E0B0E0EAEEF7E015 -:100FD0000C947005AE01495F5F4FDA016D917D9110 -:100FE000AD010BE811E0F80182819381DC011396D9 -:100FF0002C911397286013962C930E941104D8010A -:101000001296ED91FC9113972381277F2383E4E0CF -:101010000C948C05FA01AA27283051F1203181F176 -:10102000E8946F936E7F6E5F7F4F8F4F9F4FAF4FF0 -:10103000B1E03ED0B4E03CD0670F781F891F9A1F03 -:10104000A11D680F791F8A1F911DA11D6A0F711DB7 -:10105000811D911DA11D20D009F468943F912AE0C3 -:10106000269F11243019305D3193DEF6CF010895AB -:10107000462F4770405D4193B3E00FD0C9F7F6CFDC -:10108000462F4F70405D4A3318F0495D31FD4052A4 -:10109000419302D0A9F7EACFB4E0A695979587953A -:1010A00077956795BA95C9F7009761057105089519 -:1010B0009B01AC010A2E06945795479537952795C5 -:1010C000BA95C9F7620F731F841F951FA01D08955D -:1010D0000F931F93CF93DF93869F8001879F100DFF -:1010E000969F100D1124C8010E948408EC010097FE -:1010F00029F0A80160E070E00E94A509CE01DF910F -:10110000CF911F910F9108950F931F93CF93DF936A -:101110008230910510F482E090E0E0919301F0912B -:10112000940120E030E0A0E0B0E0309719F1408178 -:1011300051810281138148175907C8F08417950718 -:1011400069F4109731F012960C93129713961C9332 -:1011500027C0009393011093940122C021153105FB -:1011600019F04217530718F49A01BD01EF01DF018E -:10117000F801DBCF21153105F9F0281B390B24309C -:10118000310580F48A819B816115710521F0FB0195 -:101190009383828304C09093940180939301FE0112 -:1011A000329644C0FE01E20FF31F819391932250C7 -:1011B0003109398328833AC02091910130919201FD -:1011C000232B41F4209102013091030130939201CD -:1011D00020939101209100013091010121153105E9 -:1011E00041F42DB73EB74091040150910501241BF5 -:1011F000350BE0919101F0919201E217F307A0F411 -:101200002E1B3F0B2817390778F0AC014E5F5F4F5C -:101210002417350748F04E0F5F1F509392014093FB -:1012200091018193919302C0E0E0F0E0CF01DF9162 -:10123000CF911F910F910895CF93DF93009709F4F9 -:1012400081C0FC01329713821282A0919301B09168 -:101250009401109781F420813181820F931F209196 -:101260009101309192012817390751F5F0939201BD -:10127000E093910167C0ED0120E030E0CE17DF0779 -:1012800040F44A815B819E0141155105F1F0EA016C -:10129000F5CFD383C28340815181840F951FC81736 -:1012A000D90759F488819981840F951F02969183FB -:1012B00080838A819B81938382832115310529F460 -:1012C000F0939401E09393013DC0E901FB83EA832D -:1012D00049915991C40FD51FEC17FD0761F4808126 -:1012E0009181840F951F0296E901998388838281F9 -:1012F00093819B838A83E0E0F0E012968D919C912C -:101300001397009719F0FD01DC01F7CF8D919C91A7 -:1013100011979D012E5F3F4F820F931F20919101E6 -:10132000309192012817390769F4309729F4109207 -:1013300094011092930102C013821282B093920121 -:10134000A0939101DF91CF910895DC0101C06D93CD -:1013500041505040E0F70895262FF999FECF1FBA6B -:1013600092BD81BD20BD0FB6F894FA9AF99A0FBECE -:0813700001960895F894FFCFE7 -:06137800000095012000B9 +:10011000FF938091B900887F803A09F48CC028F45D +:10012000803641F0803861F088C0883AE9F1883B38 +:10013000D9F183C085EC8093BC001092210180C06E +:1001400080912101882339F08F3F29F58091BB00F0 +:100150008093200120C08091BB0080932101809179 +:100160002101853019F481E08093150180912101EE +:10017000873019F481E080931301809121018B3045 +:1001800019F481E0809314018091210181508093C2 +:10019000210185EC01C085E88093BC00809121019C +:1001A0008F3F09F042C04CC0E09121018E2F90E0BA +:1001B000FC013197EA31F10598F5EC5CFF4F0C94A6 +:1001C000940580911E0190911F0104C080911C0133 +:1001D00090911D0180930C0190930D019093BB00B1 +:1001E0001DC08091110190911201F4CF80910F01F7 +:1001F00090911001EFCF80911A0190911B01EACFED +:100200008091160190911701E5CF8091180190918E +:100210001901E0CF80910C018093BB0085EC03C0F5 +:100220001092BB0085E88093BC00809121018F5F14 +:100230008093210105C085EC01C085ED8093BC0051 +:10024000FF91EF91BF91AF919F918F910F900FBE52 +:100250000F901F90189593E890937A0080937C00FC +:1002600080917C00806480937C0080917A0080641F +:1002700080937A0080917A0086FDFCCF809178008F +:100280009091790025E080E090E030917A00306430 +:1002900030937A0030917A0036FDFCCF409178009F +:1002A00050917900840F951F215079F720917A00A1 +:1002B0002F7720937A0065E070E00E946105CB0102 +:1002C00008951F920F920FB60F9211242F933F9310 +:1002D0004F935F936F937F938F939F93AF93BF934E +:1002E000EF93FF9360918400709185004A9B05C055 +:1002F00070930B0160930A011DC080910A019091D7 +:100300000B01681B790B80E090E00E94010727EE4B +:100310003CE840E350E40E948F0720E030E040E0FA +:100320005FE30E94F4050E94D20670931B01609364 +:100330001A01E898FF91EF91BF91AF919F918F9132 +:100340007F916F915F914F913F912F910F900FBED1 +:100350000F901F9018951F920F920FB60F921124B5 +:100360002F933F934F935F936F937F938F939F93BD +:10037000AF93BF93EF93FF936091840070918500DA +:100380004B9B05C070930901609308011DC08091CB +:10039000080190910901681B790B80E090E00E94B0 +:1003A000010727EE3CE840E350E40E948F0720E07D +:1003B00030E040E05FE30E94F4050E94D2067093B3 +:1003C000170160931601E998FF91EF91BF91AF91EA +:1003D0009F918F917F916F915F914F913F912F915D +:1003E0000F900FBE0F901F9018951F920F920FB68F +:1003F0000F9211242F933F934F935F936F937F93AB +:100400008F939F93AF93BF93EF93FF93CF93DF931C +:100410001F92CDB7DEB789B1898390910E018927EC +:1004200084FF2DC06091840070918500898184FFD4 +:1004300005C0709307016093060121C080910601F9 +:1004400090910701681B790B80E090E00E94010702 +:1004500027EE3CE840E350E40E948F0720E030E0C4 +:1004600040E05FE30E94F4050E94D20670931901F8 +:100470006093180180916D008F7E80936D0089815B +:1004800080930E010F90DF91CF91FF91EF91BF917B +:10049000AF919F918F917F916F915F914F913F911C +:1004A0002F910F900FBE0F901F9018951F920F92D3 +:1004B0000FB60F9211248F939F93EF93FF93809128 +:1004C000C00087FF17C0E0912401F09125018091C1 +:1004D000C600808381E0E938F80730F43196F09364 +:1004E0002501E093240106C086E291E09093250166 +:1004F00080932401FF91EF919F918F910F900FBEF8 +:100500000F901F9018959C01E1ECF0E088E180834A +:1005100080818068808386E08093C200C901A0E06A +:10052000B0E09C01AD0184E0220F331F441F551F32 +:100530008A95D1F760E074E284EF90E00E9475053F +:10054000DA01C9010197A109B109892F9A2FAB2FAF +:10055000BB27A7FDBA958093C50021502093C40006 +:1005600086E291E0909323018093220190932501EC +:100570008093240108952091C00025FFFCCFFC0149 +:1005800080818093C6000895CF93DF931F92CDB7EB +:10059000DEB78983CE0101960E94BB0280E090E025 +:1005A0000F90DF91CF910895CF93DF93EC01CE01AF +:1005B0002196FC012081222319F00E94BB02F7CF73 +:1005C000DF91CF9108958091C00087FFFCCF80918B +:1005D000C60090E008950C94E3026BEE72E084ECA8 +:1005E00092E00C940708CF93DF93FC01E253FF4F96 +:1005F000A081B181EC01C453DF4F28813981A2175A +:10060000B307B9F02091C00025FF13C02C912093AF +:10061000C60020813181AC0145535F4F2417350757 +:1006200018F42F5F3F4F03C09C0128593F4F31837F +:100630002083E0912201F091230120912401309147 +:1006400025012E173F07B1F1EC01CC59DF4FA881EE +:10065000B98120812C93688179819C012B523F4F75 +:10066000D9013C91DB012C91321307C0AC014C52F3 +:100670005F4FDA012C912F5F2C939C012D593F4F36 +:100680006217730728F4DB011196B983A88302C0AF +:1006900099838883B1E0E938FB0730F43196F09311 +:1006A0002301E093220106C086E291E090932301AA +:1006B00080932201DF91CF9108951092200180E86C +:1006C00095E20E9483020E94ED0282E58093BA00C7 +:1006D00085EC8093BC001092800084E080938100C0 +:1006E00095E090936900809368008CE990E09F9377 +:1006F0008F930E948A0883B7817F83BF78940F907D +:100700000F90C8E1D8E0809121018930E1F068F4D0 +:10071000813089F0833009F060C081E00E942B01B4 +:1007200090931D0180931C0158C08D3009F18F3FBB +:1007300009F43FC052C080E00E942B0190931F013A +:1007400080931E014AC082E00E942B01BC0180E020 +:1007500090E00E94010728E431EE4AEB5FE30E943B +:100760008F070E94D206709312016093110135C069 +:1007700083E00E942B01BC0180E090E00E94010711 +:1007800025E13CE840EA50E40E948F072CEE31E777 +:1007900041E054E40E94F30522EF38E941E05EE3D2 +:1007A0000E9460060E94D2067093100160930F01B0 +:1007B00014C080912001853A81F4F8946BE780E0C1 +:1007C00090E00E945E0AF999FECF0FB6F894A895C2 +:1007D000C09360000FBED093600080911501882304 +:1007E00091F01092150110921B0110921A01529A69 +:1007F0005A9A85E38A95F1F700005A9852988CB37B +:1008000081708CBBE89A80911301882391F010923B +:1008100013011092170110921601539A5B9A85E307 +:100820008A95F1F700005B9853988CB382708CBB6B +:10083000E99A809114018823B1F01092140110926A +:10084000190110921801549A5C9A85E38A95F1F780 +:1008500000005C98549889B180930E0180916D00DE +:10086000806180936D0083B7816083BF889583B773 +:100870008E7F83BF48CFACE0B0E0E1E4F4E00C94BD +:100880009E056C015B017A01FC011782168283814F +:1008900081FF0EC1CE0101964C01F6010381F501E5 +:1008A00003FD159103FF11915F01112309F4FCC0B1 +:1008B000153249F403FD159103FF11915F011532C3 +:1008C00011F020E01BC0B601812F90E00E94520879 +:1008D00037017301E2CF112309F4E6C0612F70E004 +:1008E0008DEA90E02C870E94FC072C85892B49F02B +:1008F000F50103FD159103FF11915F0127FFEBCF78 +:1009000009C0133229F01C3609F0D5C02068F0CF99 +:1009100020E1EECF022F112309F4C6C0612F70E051 +:1009200086EA90E02C870E94FC072C85892B41F0F9 +:100930003701F4E06F0E711CB6018FE390E011C037 +:10094000133639F0133781F0133519F5022F016092 +:100950000BC0370182E0680E711CB601F70180817F +:1009600091810E945208B5CF3701F2E06F0E711CE1 +:10097000F701E080F180F70100FD859100FF819192 +:100980007F01882309F4A5CFB60190E00E945208A8 +:10099000F2CF143611F0193629F5370127FF09C0B7 +:1009A000F4E06F0E711CF701608171818281938187 +:1009B0000AC0F2E06F0E711CF70160817181072E91 +:1009C000000C880B990B022F0F7E97FF08C09095A3 +:1009D0008095709561957F4F8F4F9F4F00642AE0FF +:1009E00030E033C0103799F040F41835B1F01F36BD +:1009F00009F05AC028E030E014C0153719F0183754 +:100A000041F052C0022F0F7E2AE030E00AC0022FD0 +:100A10000061046220E130E004C0022F046020E1A4 +:100A200032E0370107FF09C0F4E06F0E711CF701D7 +:100A3000608171818281938108C0F2E06F0E711C28 +:100A4000F7016081718180E090E0A4010E94B0080C +:100A5000182F181906FF05C0B6018DE290E00E941C +:100A6000520804FF15C0FE01E10FF11D80818033A3 +:100A700079F0B60180E390E00E94520802FF08C0BE +:100A80000072802F90E0B601885A9F4F0E94520852 +:100A90001150F401E10FF11D8081B60190E00E9438 +:100AA00052081111F5CF15CFF6018681978105C047 +:100AB0008FEF9FEF02C0022F31CF2C96EEE00C9407 +:100AC000BA05AA1BBB1B51E107C0AA1FBB1FA61773 +:100AD000B70710F0A61BB70B881F991F5A95A9F7E7 +:100AE00080959095BC01CD010895052E97FB1EF4CD +:100AF00000940E948C0557FD07D00E94D10507FC89 +:100B000003D04EF40C948C0550954095309521956A +:100B10003F4F4F4F5F4F0895909580957095619529 +:100B20007F4F8F4F9F4F0895EE0FFF1F0590F49159 +:100B3000E02D09942F923F924F925F926F927F9295 +:100B40008F929F92AF92BF92CF92DF92EF92FF92DD +:100B50000F931F93CF93DF93CDB7DEB7CA1BDB0B89 +:100B60000FB6F894DEBF0FBECDBF09942A8839882E +:100B700048885F846E847D848C849B84AA84B98435 +:100B8000C884DF80EE80FD800C811B81AA81B98141 +:100B9000CE0FD11D0FB6F894DEBF0FBECDBFED0155 +:100BA0000895A1E21A2EAA1BBB1BFD010DC0AA1FAE +:100BB000BB1FEE1FFF1FA217B307E407F50720F0C6 +:100BC000A21BB30BE40BF50B661F771F881F991F41 +:100BD0001A9469F760957095809590959B01AC018A +:100BE000BD01CF0108955058BB27AA270E940B06CC +:100BF0000C9455070E94470738F00E944E0720F0DA +:100C000039F49F3F19F426F40C9444070EF4E09550 +:100C1000E7FB0C943E07E92F0E94660758F3BA17CA +:100C2000620773078407950720F079F4A6F50C9402 +:100C300088070EF4E0950B2EBA2FA02D0B01B901F9 +:100C400090010C01CA01A0011124FF27591B99F042 +:100C5000593F50F4503E68F11A16F040A22F232F4E +:100C6000342F4427585FF3CF469537952795A7959E +:100C7000F0405395C9F77EF41F16BA0B620B730B45 +:100C8000840BBAF09150A1F0FF0FBB1F661F771FB6 +:100C9000881FC2F70EC0BA0F621F731F841F48F46B +:100CA000879577956795B795F7959E3F08F0B0CFF4 +:100CB0009395880F08F09927EE0F979587950895DB +:100CC0000E9474060C9455070E944E0758F00E942B +:100CD000470740F029F45F3F29F00C943E0751117B +:100CE0000C9489070C9444070E94660768F39923C3 +:100CF000B1F3552391F3951B550BBB27AA27621718 +:100D00007307840738F09F5F5F4F220F331F441F24 +:100D1000AA1FA9F335D00E2E3AF0E0E832D0915058 +:100D20005040E695001CCAF72BD0FE2F29D0660F45 +:100D3000771F881FBB1F261737074807AB07B0E888 +:100D400009F0BB0B802DBF01FF2793585F4F3AF08E +:100D50009E3F510578F00C943E070C9489075F3F45 +:100D6000E4F3983ED4F3869577956795B795F79514 +:100D70009F5FC9F7880F911D9695879597F90895FC +:100D8000E1E0660F771F881FBB1F62177307840798 +:100D9000BA0720F0621B730B840BBA0BEE1F88F7A7 +:100DA000E09508950E946E0788F09F5798F0B92F3C +:100DB0009927B751B0F0E1F0660F771F881F991F90 +:100DC0001AF0BA95C9F714C0B13091F00E948807A3 +:100DD000B1E008950C948807672F782F8827B85FB3 +:100DE00039F0B93FCCF3869577956795B395D9F7E8 +:100DF0003EF490958095709561957F4F8F4F9F4FF2 +:100E00000895E89409C097FB3EF4909580957095FD +:100E100061957F4F8F4F9F4F9923A9F0F92F96E946 +:100E2000BB279395F695879577956795B795F111BB +:100E3000F8CFFAF4BB0F11F460FF1BC06F5F7F4F58 +:100E40008F4F9F4F16C0882311F096E911C077236A +:100E500021F09EE8872F762F05C0662371F096E873 +:100E6000862F70E060E02AF09A95660F771F881F42 +:100E7000DAF7880F9695879597F9089597F99F6700 +:100E800080E870E060E008959FEF80EC0895002412 +:100E90000A941616170618060906089500240A94DF +:100EA00012161306140605060895092E0394000C65 +:100EB00011F4882352F0BB0F40F4BF2B11F460FFF4 +:100EC00004C06F5F7F4F8F4F9F4F089557FD90581D +:100ED000440F551F59F05F3F71F04795880F97FBFE +:100EE000991F61F09F3F79F08795089512161306B8 +:100EF0001406551FF2CF4695F1DF08C016161706E7 +:100F00001806991FF1CF869571056105089408951B +:100F1000E894BB2766277727CB0197F908950E94AD +:100F2000A2070C9455070E94470738F00E944E070D +:100F300020F0952311F00C943E070C9444071124E3 +:100F40000C9489070E94660770F3959FC1F3950F73 +:100F500050E0551F629FF001729FBB27F00DB11D3D +:100F6000639FAA27F00DB11DAA1F649F6627B00DCD +:100F7000A11D661F829F2227B00DA11D621F739FB6 +:100F8000B00DA11D621F839FA00D611D221F749FC4 +:100F90003327A00D611D231F849F600D211D822F0B +:100FA000762F6A2F11249F5750409AF0F1F0882332 +:100FB0004AF0EE0FFF1FBB1F661F771F881F91505F +:100FC0005040A9F79E3F510580F00C943E070C94C9 +:100FD00089075F3FE4F3983ED4F38695779567954C +:100FE000B795F795E7959F5FC1F7FE2B880F911D89 +:100FF0009695879597F90895FC010590061621F0BE +:101000000020D9F7C00108953197CF0108950F93BB +:101010001F93CF93DF93009731F46115710519F495 +:1010200080E090E03AC08B01EC016EE070E081E07E +:1010300090E00E940E09FC01892B91F380E88383E4 +:101040000115110571F01387028781E88383809170 +:101050008D0190918E01892B21F4F0938E01E09304 +:101060008D012097C9F0D187C087838182608383F7 +:1010700080918F0190919001892B71F4F0939001F0 +:10108000E0938F018091910190919201892B21F43D +:10109000F0939201E0939101CF01DF91CF911F91E5 +:1010A0000F9108950F931F93CF93DF93FB0123813B +:1010B00021FD03C08FEF9FEF28C022FF16C046819D +:1010C0005781248135814217530744F4A081B181AF +:1010D0009D012F5F3F4F318320838C932681378181 +:1010E0002F5F3F4F3783268310C0EB01092F182F46 +:1010F0000084F185E02D0995892BE1F68E819F8191 +:1011000001969F838E83812F902FDF91CF911F9126 +:101110000F910895A0E0B0E0E0E9F8E00C94A80594 +:10112000AE01495F5F4FDA016D917D91AD010DE830 +:1011300011E0F80182819381DC0113962C911397C1 +:10114000286013962C930E943B04D8011296ED91CF +:10115000FC9113972381277F2383E4E00C94C4053B +:10116000FA01AA27283051F1203181F1E8946F93D8 +:101170006E7F6E5F7F4F8F4F9F4FAF4FB1E03ED07E +:10118000B4E03CD0670F781F891F9A1FA11D680F1C +:10119000791F8A1F911DA11D6A0F711D811D911D4F +:1011A000A11D20D009F468943F912AE0269F1124C4 +:1011B0003019305D3193DEF6CF010895462F477028 +:1011C000405D4193B3E00FD0C9F7F6CF462F4F7083 +:1011D000405D4A3318F0495D31FD4052419302D0E1 +:1011E000A9F7EACFB4E0A695979587957795679587 +:1011F000BA95C9F700976105710508959B01AC0187 +:101200000A2E06945795479537952795BA95C9F7AD +:10121000620F731F841F951FA01D08950F931F93C6 +:10122000CF93DF93869F8001879F100D969F100DAF +:101230001124C8010E942A09EC01009729F0A80195 +:1012400060E070E00E94570ACE01DF91CF911F91BC +:101250000F910895CF93DF938230910510F482E0CF +:1012600090E0E0919501F091960120E030E0C0E03F +:10127000D0E0309711F14081518148175907C0F0F3 +:101280004817590761F482819381209719F09B8355 +:101290008A832BC0909396018093950126C02115D7 +:1012A000310519F04217530718F49A01BE01DF0106 +:1012B000EF010280F381E02DDCCF2115310509F12A +:1012C000281B390B2430310590F412968D919C9196 +:1012D00013976115710521F0FB019383828304C08C +:1012E0009093960180939501FD01329644C0FD01D3 +:1012F000E20FF31F81939193225031092D933C9378 +:101300003AC02091930130919401232B41F4209114 +:1013100002013091030130939401209393012091B5 +:101320000001309101012115310541F42DB73EB77F +:101330004091040150910501241B350BE09193016C +:10134000F0919401E217F307A0F42E1B3F0B28172E +:10135000390778F0AC014E5F5F4F2417350748F02E +:101360004E0F5F1F5093940140939301819391938B +:1013700002C0E0E0F0E0CF01DF91CF9108950F933C +:101380001F93CF93DF93009709F48CC0FC01329731 +:101390001382128200919501109196010115110599 +:1013A00081F420813181820F931F2091930130912C +:1013B00094012817390779F5F0939401E09393018C +:1013C00071C0D80140E050E0AE17BF0750F412964C +:1013D0002D913C911397AD012115310509F1D901EA +:1013E000F3CF9D01DA013383228360817181860FFF +:1013F000971F8217930769F4EC0128813981260F22 +:10140000371F2E5F3F4F318320838A819B819383D7 +:101410008283452B29F4F0939601E093950142C015 +:101420001396FC93EE931297ED01499159919E0109 +:10143000240F351FE217F30771F480819181840F27 +:10144000951F029611969C938E9382819381139699 +:101450009C938E931297E0E0F0E0D80112968D9164 +:101460009C911397009719F0F8018C01F6CF8D919C +:101470009C9198012E5F3F4F820F931F2091930103 +:10148000309194012817390769F4309729F41092A4 +:1014900096011092950102C013821282109394015A +:1014A00000939301DF91CF911F910F910895DC017B +:1014B00001C06D9341505040E0F70895262FF999EF +:1014C000FECF1FBA92BD81BD20BD0FB6F894FA9A27 +:0C14D000F99A0FBE01960895F894FFCF22 +:0614DC0000009701200052 :00000001FF diff --git a/scripts/pyshared b/scripts/pyshared index 5333631..355fa0b 160000 --- a/scripts/pyshared +++ b/scripts/pyshared @@ -1 +1 @@ -Subproject commit 533363119122d0b1c93abea79e96d27298489b8d +Subproject commit 355fa0b4fe7e4aacea13edf177d20a83e9c347b1 diff --git a/scripts/wt_node.py b/scripts/wt_node.py index 8589156..4a6af7b 100755 --- a/scripts/wt_node.py +++ b/scripts/wt_node.py @@ -219,11 +219,13 @@ class WTBase: msg.status.append(stat) self.pub_diag.publish(msg) + current = struct.unpack(">h", i2c_read_reg(0x52, 0x0D, 2))[0]/1000.0 + if self.pub_battery.get_num_connections() > 0: batmsg = BatteryState() batmsg.header.stamp = rospy.Time.now() batmsg.voltage = volt - batmsg.current = float('nan') + batmsg.current = current batmsg.charge = float('nan') batmsg.capacity = float('nan') batmsg.design_capacity = 5.0 -- 2.39.5