<div dir="ltr">Hi Dirk,<div><br></div><div>one comment below but I have another problem ...</div><div><br></div><div>I went through another round of test and wanted to print out the dive list, when trying to do that</div><div>I need to select a template but the drop down shows me the entire subsurface directory with</div><div>all kinds of files. Is there a template that only prints my list and if so what is it's name ?</div><div><br></div><div>A weird behaviour I found and I think this is just recently ... is that once I finished all the loading of</div><div>my 230+ dives the divespots are there, once I click save, some disappear and the location is named</div><div>from Uemis, if I close the app and reopen all divespots are back<br><div class="gmail_extra"><br><div class="gmail_quote">2015-09-17 5:51 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">Hi Guido<br>
<span class=""><br>
On Thu, Sep 17, 2015 at 05:38:24AM +0200, Guido Lerch wrote:<br>
> ><br>
> > 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<br>
> > *last_found_log_file_nr, int *deleted_files, char *newmax,<br>
> >                               int *uemis_mem_status, struct device_data_t<br>
> > *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<br>
> > 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>
> Basically none now but I haven't cleaned it up since. If have to make a<br>
> few changes to the whole function<br>
> as some things became obsolete when I moved the code out of the<br>
> do_uemis_import to the helper.<br>
<br>
</span>Hmm - since you said you were going on vacation I have since cleaned up<br>
this code myself and have it working nicely with my Uemis.<br>
<br>
But if you have patches ready I can toss what I did and wait for yours.<br>
<span class=""><br>
> > 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 -<br>
> > 2 : 0);<br>
> ><br>
><br>
> the object_id of the divelogs and the dive details don't match, this means<br>
> that when you want the dive<br>
> detail of divelog object_id 2, you have to look for the dive detail that<br>
> has logfilenr 2. In my Uemis the<br>
> first object_id is 2 which matches with dive details object_id 3 that has a<br>
> divelognr 2.<br>
<br>
</span>And in mine the offset is 2 - which could never happen with your code.<br>
Fundamentally the if condition above is bogus. You need to parse the<br>
logfilenr that was in the response from the Uemis and compare THAT to the<br>
dc.diveid<br></blockquote><div><br></div><div>Thats exactly what I am doing, I am just starting off the wrong index. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
That's what I did in my code (and some other cleanups) and then things<br>
work as expected.<br>
<span class=""><br>
> Never the less the code you complain about above is crap and I have stated<br>
> this in my comments, it<br>
> need a re-write that I am working on as we speak.<br>
<br>
</span>OK, I'll wait for your patches and not push mine<br>
<br>
I have more than a dozen patches pending in master as I was still testing<br>
things before real life intervened...<br>
<span class="HOEnZb"><font color="#888888"><br>
/D<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></div>