testing the Uemis code [was Re: UEMIS-bug fix: fixing the dialog message when the memory us full]

Guido Lerch guido.lerch at gmail.com
Wed Sep 16 20:38:24 PDT 2015


Hi Dirk

2015-09-16 21:03 GMT+02:00 Dirk Hohndel <dirk at hohndel.org>:

> On Wed, Sep 16, 2015 at 07:34:06AM -0700, Dirk Hohndel wrote:
> > Good morning Guido...
> >
> > On Wed, Sep 16, 2015 at 09:02:11AM +0200, Guido Lerch wrote:
> > > > My results were not as good as Linus'
> > > > After 8h connected to a charger it finally came back to life.
> > > >
> > > > When trying to download (empty dive file, so start from the oldest
> dive)
> > > > it loads the first set of dives and then ping-pongs between details
> for #2
> > > > and details for #3 back and forth and back and forth until the
> memory is
> > > > full.
> > >
> > > This is exactly what happened to me with the old code where the offset
> was
> > > calculated,
> > > I completely re-did that part and tested it on 2 different Uemis
> computed
> > > which worked like a charm.
> >
> > That's the problem with trial and error bug fixing / coding. We don't
> > understand exactly how the two different ids are related. I think they
> > possibly aren't at all. So you need to figure out the offset by trial and
> > error. With the three Uemis SDA that I had access to the offset was
> always
> > fixed, but I don't even know if that is true.
> >
> > Here is the relevant excerpt from the debug log (I can send you the whole
> > log if you think there's anything else in there that's interesting, but I
> > don't think there is
> >
> > d_u_i after download and parse start 3 end 12 newmax 12 progress 0.19
> > ::w req.txt
> "n076800000054getDive{90d179077baa3186643ea3d84ac93499{notempty{3{{{"
> > :tr n0769 (after seeks)
> > ::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{"
> > :tr n0770 (after seeks)
> > 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
> > buf |object_id{int{3{remote_object_id{int{0{sync_id{in|
> > reading details for #
> >  3
> >
> {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
> > ::t /run/media/hohndel/UEMISSDA/ANS/ANS769.TXT
> "1meVisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float"
> > 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
> > :r: (null)
> > ::w req.txt
> "n077000000054getDive{90d179077baa3186643ea3d84ac93499{notempty{2{{{"
> > :tr n0771 (after seeks)
> > ::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{"
> > :tr n0772 (after seeks)
> > 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
> > buf |object_id{int{2{remote_object_id{int{0{sync_id{in|
> > reading details for #
> >  2
> >
> {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
> > ::t /run/media/hohndel/UEMISSDA/ANS/ANS771.TXT
> "1meisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float{"
> > 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
> > :r: (null)
> > ::w req.txt
> "n077200000054getDive{90d179077baa3186643ea3d84ac93499{notempty{3{{{"
> > :tr n0773 (after seeks)
> > ::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{"
> > :tr n0774 (after seeks)
> > 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
> > buf |object_id{int{3{remote_object_id{int{0{sync_id{in|
> > reading details for #
> >  3
> >
> {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
> > ::t /run/media/hohndel/UEMISSDA/ANS/ANS773.TXT
> "1meVisibility{int{1{gear{u8DiveSuit{int{0{u8DiveSuitType{int{0{u8SuitThickness{int{0{f32Weight{float"
> > 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
> > :r: (null)
> > ::w req.txt
> "n077400000054getDive{90d179077baa3186643ea3d84ac93499{notempty{2{{{"
> >
> > And repeat at nausea.
>
> So I've been reading your code again and I struggle to understand the
> logic here...
>
> static bool get_matching_dive(int idx, int *dive_to_read, int
> *last_found_log_file_nr, int *deleted_files, char *newmax,
>                               int *uemis_mem_status, struct device_data_t
> *data, const char* mountpath, const char deviceidnr)
>
> What's the purpose of dive_to_read vs. last_found_log_file_nr ?
> You start out (when you first call the function) with dive_to_read being
> one bigger than last_found_log_file_nr (if we have a
> loast_found_log_file_nr)
> and otherwise dive_to_read = start and last_found_log_file_nr = 0.
> start is the first dive nr we are trying to match here.
>
> Basically none now but I haven't cleaned it up since. If have to make a
few changes to the whole function
as some things became obsolete when I moved the code out of the
do_uemis_import to the helper.


> Then, when the log_file_no_to_find isn't found in the mbuf, we do this:
>
>         if (*dive_to_read >= dive->dc.diveid)
>                 *dive_to_read = (*dive_to_read - 2 >= 0 ?  *dive_to_read -
> 2 : 0);
>

the object_id of the divelogs and the dive details don't match, this means
that when you want the dive
detail of divelog object_id 2, you have to look for the dive detail that
has logfilenr 2. In my Uemis the
first object_id is 2 which matches with dive details object_id 3 that has a
divelognr 2.
Never the less the code you complain about above is crap and I have stated
this in my comments, it
need a re-write that I am working on as we speak.
And yes, we never hit id 0 which is the reason you and Linus have issues,
weird, that I did not come
across this with 2 different Uemis ...


>
> So now we compare what we were told to read with the id in the dive.
> We should instead compare what we found in the mbuf with what we were told
> to read and if what we found is too big then do the -2 dance (which is
> also wrong, I think, because it prevents us from ever trying id 0)
>
> /D
>
>


-- 
Best regards,
Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150917/64e45b79/attachment-0001.html>


More information about the subsurface mailing list