<div dir="ltr">Hi Dirk<br><div class="gmail_extra"><br><div class="gmail_quote">2015-09-16 21:03 GMT+02:00 Dirk Hohndel <span dir="ltr"><<a href="mailto:dirk@hohndel.org" target="_blank">dirk@hohndel.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Sep 16, 2015 at 07:34:06AM -0700, Dirk Hohndel wrote:<br>
> Good morning Guido...<br>
><br>
> On Wed, Sep 16, 2015 at 09:02:11AM +0200, Guido Lerch wrote:<br>
> > > My results were not as good as Linus'<br>
> > > After 8h connected to a charger it finally came back to life.<br>
> > ><br>
> > > When trying to download (empty dive file, so start from the oldest dive)<br>
> > > it loads the first set of dives and then ping-pongs between details for #2<br>
> > > and details for #3 back and forth and back and forth until the memory is<br>
> > > full.<br>
> ><br>
> > This is exactly what happened to me with the old code where the offset was<br>
> > calculated,<br>
> > I completely re-did that part and tested it on 2 different Uemis computed<br>
> > which worked like a charm.<br>
><br>
> That's the problem with trial and error bug fixing / coding. We don't<br>
> understand exactly how the two different ids are related. I think they<br>
> possibly aren't at all. So you need to figure out the offset by trial and<br>
> error. With the three Uemis SDA that I had access to the offset was always<br>
> fixed, but I don't even know if that is true.<br>
><br>
> Here is the relevant excerpt from the debug log (I can send you the whole<br>
> log if you think there's anything else in there that's interesting, but I<br>
> don't think there is<br>
><br>
> d_u_i after download and parse start 3 end 12 newmax 12 progress 0.19<br>
> ::w req.txt "n076800000054getDive{90d179077baa3186643ea3d84ac93499{notempty{3{{{"<br>
> :tr n0769 (after seeks)<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS768.TXT "1mn{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{"<br>
> :tr n0770 (after seeks)<br>
> added "{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{3{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-13T07:24:32{dive_no{int{3{logfilenr{int{5{date{ts{2014-05-13T16:22:53{duration{float{58.000000{depth{int{1466{altitude{int{1005{decoindex{int{-99{consumption{int{12{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8" to buffer - new length 510<br>
> buf |object_id{int{3{remote_object_id{int{0{sync_id{in|<br>
> reading details for #<br>
>  3<br>
>  {dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{3{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-13T07:24:32{dive_no{int{3{logfilenr{int{5{date{ts{2014-05-13T16:22:53{duration{float{58.000000{depth{int{1466{altitude{int{1005{decoindex{int{-99{consumption{int{12{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS769.TXT "1meVisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float"<br>
> added "Visibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float{0.000000{u8BCD{int{0{u8Light{int{0{u8Camera{int{0{u8BottomTankType{int{0{u8TravelTankType{int{0{u8DecoTankType{int{0{u8ScubaSet{int{0{u8Other{string{ {divespot_id{int{-1{buddies{notes{string{ {{{{00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" to buffer - new length 1019<br>
> :r: (null)<br>
> ::w req.txt "n077000000054getDive{90d179077baa3186643ea3d84ac93499{notempty{2{{{"<br>
> :tr n0771 (after seeks)<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS770.TXT "1mn{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{"<br>
> :tr n0772 (after seeks)<br>
> added "{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{2{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-12T03:39:37{dive_no{int{2{logfilenr{int{4{date{ts{2014-05-12T12:32:36{duration{float{64.000000{depth{int{1718{altitude{int{996{decoindex{int{-52{consumption{int{11{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8V" to buffer - new length 510<br>
> buf |object_id{int{2{remote_object_id{int{0{sync_id{in|<br>
> reading details for #<br>
>  2<br>
>  {dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{2{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-12T03:39:37{dive_no{int{2{logfilenr{int{4{date{ts{2014-05-12T12:32:36{duration{float{64.000000{depth{int{1718{altitude{int{996{decoindex{int{-52{consumption{int{11{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8V<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS771.TXT "1meisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float{"<br>
> added "isibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float{0.000000{u8BCD{int{0{u8Light{int{0{u8Camera{int{0{u8BottomTankType{int{0{u8TravelTankType{int{0{u8DecoTankType{int{0{u8ScubaSet{int{0{u8Other{string{ {divespot_id{int{-1{buddies{notes{string{ {{{{000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" to buffer - new length 1019<br>
> :r: (null)<br>
> ::w req.txt "n077200000054getDive{90d179077baa3186643ea3d84ac93499{notempty{3{{{"<br>
> :tr n0773 (after seeks)<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS772.TXT "1mn{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{"<br>
> :tr n0774 (after seeks)<br>
> added "{dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{3{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-13T07:24:32{dive_no{int{3{logfilenr{int{5{date{ts{2014-05-13T16:22:53{duration{float{58.000000{depth{int{1466{altitude{int{1005{decoindex{int{-99{consumption{int{12{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8" to buffer - new length 510<br>
> buf |object_id{int{3{remote_object_id{int{0{sync_id{in|<br>
> reading details for #<br>
>  3<br>
>  {dive{1.0{dive-conditions{1.0{dive-gear{1.0{dive-buddies{1.0{computer_id{int{20719{user_id{int{2{object_id{int{3{remote_object_id{int{0{sync_id{int{ {deleted{bool{false{ctime{ts{2014-05-13T07:24:32{dive_no{int{3{logfilenr{int{5{date{ts{2014-05-13T16:22:53{duration{float{58.000000{depth{int{1466{altitude{int{1005{decoindex{int{-99{consumption{int{12{gas{int{1{water{int{1{divetype{int{0{diveactivity{int{0{training{int{0{conditions{u8Clouds{int{1{u8Deposit{int{1{u8Wind{int{1{u8Waves{int{1{u8Current{int{1{u8<br>
> ::t /run/media/hohndel/UEMISSDA/ANS/ANS773.TXT "1meVisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float"<br>
> added "Visibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float{0.000000{u8BCD{int{0{u8Light{int{0{u8Camera{int{0{u8BottomTankType{int{0{u8TravelTankType{int{0{u8DecoTankType{int{0{u8ScubaSet{int{0{u8Other{string{ {divespot_id{int{-1{buddies{notes{string{ {{{{00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" to buffer - new length 1019<br>
> :r: (null)<br>
> ::w req.txt "n077400000054getDive{90d179077baa3186643ea3d84ac93499{notempty{2{{{"<br>
><br>
> And repeat at nausea.<br>
<br>
</div></div>So I've been reading your code again and I struggle to understand the<br>
logic here...<br>
<br>
static bool get_matching_dive(int idx, int *dive_to_read, int *last_found_log_file_nr, int *deleted_files, char *newmax,<br>
                              int *uemis_mem_status, struct device_data_t *data, const char* mountpath, const char deviceidnr)<br>
<br>
What's the purpose of dive_to_read vs. last_found_log_file_nr ?<br>
You start out (when you first call the function) with dive_to_read being<br>
one bigger than last_found_log_file_nr (if we have a loast_found_log_file_nr)<br>
and otherwise dive_to_read = start and last_found_log_file_nr = 0.<br>
start is the first dive nr we are trying to match here.<br>
<br></blockquote><div>Basically none now but I haven't cleaned it up since. If have to make a few changes to the whole function</div><div>as some things became obsolete when I moved the code out of the do_uemis_import to the helper.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Then, when the log_file_no_to_find isn't found in the mbuf, we do this:<br>
<br>
        if (*dive_to_read >= dive->dc.diveid)<br>
                *dive_to_read = (*dive_to_read - 2 >= 0 ?  *dive_to_read - 2 : 0);<br></blockquote><div><br></div><div>the object_id of the divelogs and the dive details don't match, this means that when you want the dive</div><div>detail of divelog object_id 2, you have to look for the dive detail that has logfilenr 2. In my Uemis the</div><div>first object_id is 2 which matches with dive details object_id 3 that has a divelognr 2.</div><div>Never the less the code you complain about above is crap and I have stated this in my comments, it</div><div>need a re-write that I am working on as we speak.</div><div>And yes, we never hit id 0 which is the reason you and Linus have issues, weird, that I did not come</div><div>across this with 2 different Uemis ...</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So now we compare what we were told to read with the id in the dive.<br>
We should instead compare what we found in the mbuf with what we were told<br>
to read and if what we found is too big then do the -2 dance (which is<br>
also wrong, I think, because it prevents us from ever trying id 0)<br>
<span class="HOEnZb"><font color="#888888"><br>
/D<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Best regards,<div>Guido</div></div></div>
</div></div>