! 7 janv 2015 ! compilation Appbuilder OK .. apres correctif noms de fichiers ! il manquait encore tria.jpg ! nota: ! print "Version basic : "; Version$() donne la version du basic si on est sous basic ! mais donne la version apk , donnée dans appbuilder ,si on a compilé le programme ! 5 janv 2015 ! rajout DAC test zone t5 (envoi Z) ! nota : ! SC1 editeur version 0.7 coté PC ! Basic-launcher version 0.7 APK sur Archos 43it ! transfert via F5 .. du PC -> Archos qui lance l'appli RFO basic + source ! voir Notes_DDS_AD9835_AD9850_2015_historique.txt ! Prog$="PIC_DDS_BT_Archos_150105" rev$=" d" ! line > 1000 ! modif pour dessin de la forme rectangle F(Taux) ! zone rectangle x=620...780 ! 03-01-2015 modif touches Freq et inversion touches vide Reglages Taux ! Prog$="PIC_DDS_BT_Archos_141223" ! rev$="a" ! 23-12-2014 rajout print intermediare ^pour debug compilation apk avec RFO-Appbuilder ! trouvé un bug: nom de fichier CRect.jpg au lieu de Crect et CSin.jpg au lieu de Csin.jpg et sin.jpg manquant ! Print "45 .. au lieu de print "45 .. ! very sensitiv with the case ! ! ! 17-12-2014 ! modif touches +Freq -Freq et +Taux -Taux ! 16-12-2014 ! RFO basic BT envie un LF au lieu de CR en fin de Msg ! modif cote C18, Test sur LF au lieu de CR 13. ! pour valider Dataready1==1 ! modif select Direct et Reverse dent de scie ! le choix dent de dent de scie etait ok ! mais pas l'envoi de D ou R. ! mistake entre R reverse dent et R rectangle ! => remplace R par V ! modif aussi cote C18 Pic ! tests avec HC06-2187-J pastille Jaune 6 pins ! 07/11/2014 !A SUIVRE coté C18 !pour reception valeur de frequence en flotant !nb de car buffer utiliser Cptcar au lieu de Nbrefcar ! =================================== ! debug.on ! ne pas armer si test avec AVD sinon RAME TROP !debug.echo.on print "start" test=0 ! 1=simulation reception Bluetooth !if (test=1) then debug.on ! attention PLANTAGE avec Bluettoth N1=0 ! print Prog$," rev ";Rev$ print "Version basic : "; Version$() Device DV$ print "Device Info : "; DV$ pause 3000 ! ! to PIC18F46K22 MsgR$="00000001" MsgS$="20000 " MsgE$="F20000# " ! dim Bm[30] % Bitmaps dim ArrPlan[2] dim rec_Array$[14] ! dim ObjFixe[2] dim Obj[40] dim ObjStatus[40] dim ChoixForm[8] dim FSignal$[7] % nom de la forme du signal dim BmFS[6] % image forme signal ! NbMax=1000000 Nb1=1 ! for i=1 to 39 ObjStatus[i]=0 % par defaut next i !Libelles cases de CHOIX FSignal$[1]="Sinus " FSignal$[2]="Dent Scie" FSignal$[3]="Triangle " FSignal$[4]="Carre " FSignal$[5]="Rectangle" FSignal$[6]="X Rev.Saw" FSignal$[7]="DAC tst" if test=1 then Popup "Simulation" ,0,0,1 % centered during 2 second else Print "Reelle connection" end if print "Usage de BlueTooth RFO Basic" if test=0 then print "Platine_18F46K22 et Module BT HC05 Jaune" Print" Appli:18F46K22_DDS_Q10Mhz_C18_150105.c" else print "Liaison simulee" end if pause 2000 if Test=0 then print "Open the B.T. link" Bt.open pause 1500 Bt.connect print "Check Status connection" j1=0 s=0 do Bt.status s print "."; pause 1000 j1=j1+1 if j1 > 50 then popup "Problem with this device",0,0,3 tone 440,500 tone 880,500 tone 1200,500 pause 3000 % delai non pris en compte goto Arreter end if until (s=3) print " " print "Status =";s Bt.device.name device$ print "Connected to ";device$ !bt.write device$ !pause 200 print "Fin init BT" end if SansBT: gr.open 255,0,0,0,0 % si 1 => status barre haut gr.orientation 0 ! Recupere les parametres de l'ecran w=largeur et h=hauteur gr.screen w,h !print "30 chargement des images" gr.bitmap.load ArrPlan[1],"FenConsFreq.jpg" ! zone affichage valeur raccourcie car maxi 20000Hz !gr.bitmap.load ArrPlan[2],"keybnum3_noir.jpg" % calculette plein ecran gr.bitmap.load ArrPlan[2],"keybnum3a.jpg" %zonecalculette gr.bitmap.load bm[1],"F1H_off.jpg" %Touche freq + gr.bitmap.load bm[2],"F1B_off.jpg" %Touche freq - gr.bitmap.load bm[3],"F2H_off.jpg" %Touche taux + gr.bitmap.load bm[4],"F2B_off.jpg" %Touche taux - gr.bitmap.load bm[5],"LedR_off.jpg" !print "35" gr.bitmap.load bm[8],"F1H_on.jpg" %Touche freq + vide gr.bitmap.load bm[9],"F1B_on.jpg" %Touche freq - vide gr.bitmap.load bm[10],"F2H_on.jpg" % touche taux + vide gr.bitmap.load bm[11],"F2B_on.jpg" % touche taux - vide gr.bitmap.load bm[12],"LedR_on.jpg" Nombre$="" print "40 Dessin des images" gr.bitmap.draw ObjFixe[1],Arrplan[1],10,32 ! clavier numerique ! gr.bitmap.draw ObjFixe[2],Arrplan[2],1,1 gr.bitmap.draw ObjFixe[2],Arrplan[2],380,130 ! zone value Frequence gr.text.draw p3,400,180,Nombre$ gr.hide p3 gr.hide ObjFixe[2] gr.render !Reglage Frequence etat ON gr.bitmap.draw Obj[8],Bm[8],73,228 % was 75 230 gr.bitmap.draw Obj[9],Bm[9],77,300 % was 75 300 ! Reglage Frequence affiche etat OFF gr.bitmap.draw Obj[1],Bm[1],75,226 gr.bitmap.draw Obj[2],Bm[2],79,298 ! Reglage TAUX etat Off gr.bitmap.draw Obj[3],Bm[3],520,360 gr.bitmap.draw Obj[4],Bm[4],520,420 ! Reglage TAUX etat On gr.bitmap.draw Obj[10],Bm[10],520,360 gr.bitmap.draw Obj[11],Bm[11],520,420 ! led rouge Off gr.bitmap.draw Obj[5],Bm[5],770,2 gr.bitmap.draw Obj[12],Bm[12],770,2 print "45 image des formes de signaux" ! images de 150x105 pixels gr.bitmap.load BmFS[1],"sin.jpg" print "46" gr.bitmap.load BmFS[2],"ddsn.jpg" print "47" % bug ici gr.bitmap.load BmFS[3],"tria.jpg" print "48" gr.bitmap.load BmFS[4],"carr.jpg" print "49" gr.bitmap.load BmFS[5],"rect.jpg" print "50" gr.bitmap.load BmFS[6],"ddsr.jpg" print "51 icone activation des cases CHOIX FORM Signal" gr.bitmap.load ChoixForm[1],"Csin.jpg" gr.bitmap.load ChoixForm[2],"Cddsn.jpg" gr.bitmap.load ChoixForm[3],"Ctria.jpg" gr.bitmap.load ChoixForm[4],"Ccarr.jpg" gr.bitmap.load ChoixForm[5],"Crect.jpg" print "52" gr.bitmap.load ChoixForm[6],"Cddsr.jpg" gr.bitmap.load ChoixForm[7],"Cddsr_off.jpg" gr.bitmap.load ChoixForm[8],"Cddsr_on.jpg" gr.set.stroke 2 gr.color 255,100,100,100,0 % gris gr.rect Rect0,35,180,75,220 gr.set.stroke 0 gr.color 255,255,255,255,0 %blanc gr.text.draw p0,90,200,"Dac test" print "55 Zone Cases (vides) pour CHOIX de forme de signal" gr.set.stroke 2 !gr.color alpha, red, green, blue, fill gr.color 255,0,250,0,0 % vert gr.rect Rect1,210,180, 250,220 gr.color 255,250,0,0,0 % rouge gr.rect Rect2,210,240, 250,280 gr.color 255,200,0,200,0 %violet gr.rect Rect3,210,300, 250,340 gr.color 255,230,230,68,0 % jaune gr.rect Rect4,210,360, 250,400 gr.color 255,0,0,255,0 % bleu gr.rect Rect5,210,420, 250,460 gr.set.stroke 2 gr.color 255,0,10,235,1 % bleu gr.rect Rect6,620,70,760,140 gr.color 255,255,255,255,0 %blanc print "dessin Taux" ! pour MAJ dessin Taux dans Rectangle gr.color 255,255,255,255,0 %blanc gr.line Line1,622,76,622,138 % debut gr.line Line2,622,76,624,76 % etat niveau haut gr.line Line3,624,76,624,138 % front niveau bas gr.line Line4,624,138,760,138 % etat niveau bas gr.show Line1 gr.show Line2 gr.show Line3 gr.show Line4 gr.render gr.Hide Line1 gr.Hide Line2 gr.Hide Line3 gr.Hide Line4 gr.Hide Rect6 gr.set.stroke 0 ! Zone de saisie valeur de Taux gr.set.stroke 0 gr.color 255,0,0,255,0 gr.rect Rect7_TAUX,600,400, 745,445 Gr.hide Rect7_TAUX !debug.print "60 zone selection Dent de scie Inverse" gr.bitmap.draw Obj[37],ChoixForm[7],550,250 ! icone dent de scie normale par defaut gr.bitmap.draw Obj[38],ChoixForm[8],550,250 ! icone dent de scie reverse gr.hide Obj[38] Dentreverse=1 ! dent de scie Reverse par defaut ObjStatus[37]=1 ObjStatus[38]=0 gr.set.stroke 1 gr.text.size 24 gr.text.bold 0 gr.color 255,250,0,0,0 ! rouge gr.text.draw Obj[26],610,275,FSignal$[6] gr.hide Obj[26] ObjStatus[26]=0 ! Zone CHOIX DE FORME print "61 prechargement des icones Choix,Formes,Status" ! label des cases de CHOIX de FORME de signal gr.set.stroke 0 gr.text.size 24 gr.text.bold 0 gr.color 255,250,250,250,0 for i=1 to 5 dy=(i-1)*60 gr.text.draw Obj[20+i-1],285,210+dy,FSignal$[i] gr.bitmap.draw Obj[30+i-1],ChoixForm[i],215,185+dy ! zone de selection gr.hide Obj[30+i-1] ObjStatus[20+i-1]=0 ObjStatus[30+i-1]=0 next i ! print "65 FORMES de signal oscillo" ! image de la forme generee (from oscilloscope) for i=1 to 6 ObjStatus[15+i-1]=0 gr.bitmap.draw Obj[15+i-1],BmFS[i],620,50 ! forme d'onde gr.hide Obj[15+i-1] next i gr.hide Obj[3] gr.hide Obj[4] print "66 initialisation sur SINUS par defaut" SelForm=1 gr.show Obj[15] ObjStatus[15]=1 gr.show Obj[30] ObjStatus[30]=1 ObjStatus[20]=1 ObjStatus[1]=0 ObjStatus[2]=0 ObjStatus[3]=0 ObjStatus[4]=0 ObjStatus[5]=0 ObjStatus[8]=1 ObjStatus[9]=1 ObjStatus[10]=0 ObjStatus[11]=0 ObjStatus[12]=0 ! print "70 Titre" ! titre TTitre$="Gener BF DDS 18F46K22 Q=10MHz rev "+ Rev$ gr.text.size 32 gr.text.bold 1 gr.color 255,230,230,68,0 % jaune gr.text.draw pTitre,100,26,TTitre$ Freq=1000.0 % Hz TFr$=format$("## ### ###.##",Freq) ! Zone de saisie valeur de Taux !gr.set.stroke 0 !gr.color 255,0,0,255,0 !gr.rect Rect7_TAUX,600,400, 745,445 gr.show Rect7_TAUX Taux=125.0 Tx=Taux*100.0/255.0 TTaux$=format$("###.#",Tx) gr.text.bold 0 gr.color 255,255,255,255,0 gr.text.size 24 gr.text.draw p0,625,375,"Taux %" gr.hide p0 gr.text.size 28 gr.text.bold 1 gr.text.draw p2, 615,430,TTaux$ gr.hide p2 ObjStatus[3]=0 ObjStatus[4]=0 !gr.hide Obj[3] % + taux !gr.hide Obj[4] % - Taux print "71" ! zone a cliquer pour appeler le pave de saisie numerique gr.set.stroke 0 gr.color 255,255,0,255,0 % violet gr.rect Rect8,30,400,170,435 % Zone entree directe Frequence gr.color 255,0,255,255,0 % bleuvert gr.text.size 28 gr.text.draw p5,50,425,"Saisie F" gr.render pause 500 print "72" Gosub Refresch_Freq_Value print "73" NbEssais=0 j1=0 Nb1=0 SelForm=1 if Test=0 then MsgE$="S"+chr$(13) bt.write MsgE$ pause 50 end if !======= Boucle Principale ================== DO print "75" Test_Connection: DT0=clock() if Test=1 then goto NoBT print "77" do bt.status s ! verifie le link BT et tente une reconnection si en defaut if s=3 then gosub Alive_Led NbEssais=0 else NbEssais=NbEssais+1 if NbEssais>6 then gosub Perte_BT end if until s=3 ! print "77" ! Read messages until the message queue is empty ! boucle pour ne pas fractionner le message A1$="" MsgR$="" dr=0 rr=0 do bt.read.ready rr if rr pause 50 dr=1 bt.read.bytes A1$ MsgR$=MsgR$+A1$ end if until rr=0 ! NoBT: print "110" ! if dr=1 then TTitre$=MsgR$ gr.hide pTitre gr.text.draw pTitre,15,26,TTitre$ gr.show pTitre pause 10 end if ! !==== GESTION FORME DE SIGNAUX ===== !debug.print "130 zone choix forme" print "130" k=1 !zones choix forme signal i=1 !Selform=1 % Selform=1 par defaut ToucheChoix=0 t2=0 while (i<7) if test=1 then print "130 i="; i end if dy=(i-1)*60 if i=6 then gr.bounded.touch t2, 550,250,700,290 else gr.bounded.touch t2, 211,182+dy,249,219+dy end if if t2 >0 then SelForm=i Tone 800,500 W_r.break % break boucle while end if % t2=1 i=i+1 repeat ! wout: ! maj formes d'onde if t2 >0 then !print "151 touched !" if selform<6 then for i=1 to 5 gr.hide Obj[30+i-1] gr.hide Obj[15+i-1] ObjStatus[30+i-1]=0 ObjStatus[15+i-1]=0 next i gr.show Obj[30+SelForm-1] ! case a cocher ObjStatus[30+SelForm-1]=1 ! status coche en cours d'usage if(SelForm<>5) then gr.show Obj[15+SelForm-1] if (SelForm=5) then gr.show Rect6 ! forme d'onde oscilloscope if(SelForm<>5) then ObjStatus[15+SelForm-1]=1 gr.render !print "155" end if if selform=6 then !si on a clicke dans la zone choix reverse dent de scie if DentReverse=1 then DentReverse=0 bt.write "V"+chr$(13) else DentReverse=1 bt.write "D"+chr$(13) end if % DentReverse pause 50 Selform=2 % select dent de scie end if % Selform gosub Traite_Dent_de_scie if test=0 then MsgE$=left$(FSignal$[SelForm],1)+chr$(13) !1ere lettre du signal bt.status s if s=3 then bt.write MsgE$ pause 50 end if end if % T2 touch detectee print "157" ! montre environnement de reglage taux si mode= Rectangle if ObjStatus[34]=1 then gr.Show p0 gr.Show p2 ObjStatus[10]=1 ObjStatus[11]=1 gr.show Obj[10] gr.show Obj[11] gr.render !print "158" gosub Reglage_Taux % tests reglage TAUX else gr.hide p0 gr.hide p2 ObjStatus[3]=0 ObjStatus[4]=0 gr.hide Obj[3] gr.hide Obj[4] ObjStatus[10]=0 ObjStatus[11]=0 gr.hide Obj[10] gr.hide Obj[11] gr.hide line1 gr.hide line2 gr.hide line3 gr.hide line4 gr.hide Rect6 end if gr.render !print "160 Zone increm FREQ" !===== Test zone incr/Decr Frequence ========== t3=0 TPF=0 gr.bounded.touch t3, 80,250,130,300 while (t3>0) TPF=1 gr.show obj[1] gr.render if (Freq<40000) then Freq=Freq+0.1 gosub Refresch_Freq_Value Pause 10 gr.bounded.touch t3, 80,250,130,300 repeat !----------- !print "165 Zone Decr FREQ" t4=0 TMF=0 gr.bounded.touch t4, 80,320,130,360 while (t4>0) TMF=1 gr.show obj[2] gr.render if (Freq > 0.1) then Freq=Freq-0.1 gosub Refresch_Freq_Value Pause 10 gr.bounded.touch t4, 80,320,130,360 repeat gr.hide obj[1] gr.hide obj[2] ObjStatus[1]=0 ObjStatus[2]=0 gr.show obj[8] gr.show obj[9] ObjStatus[8]=1 ObjStatus[9]=1 gr.render ! !------ if (TMF=1 | TPF=1) & Test=0 then MsgS$=Format$("%%%%%%.###",Freq) % zeros devant le nombre MsgE$="F"+right$(MsgS$,10) % +chr$(13) % suppresion des 2 blancs devant le nombre if s=3 then bt.write MsgE$ pause 50 MsgE$="" end if ! DAC Test zone 35,180,75,220 t5=0 gr.bounded.touch t5,36,181,74,219 IF (t5>0) then gr.hide Rect0 gr.render print "Dac Test" MsgE$="Z" if s=3 then bt.write MsgE$ Tone 440,1000 MsgE$="" t5=0 gr.show Rect0 gr.render end if ! !==================================== ! saisie valeur !Capture pour saisie directe frequence t6=0 validation=0 gr.bounded.touch t6,35,402,165,432 IF (t6>0) then !print "200 Zone saisie directe Freq" gr.hide ObjFixe[1] gr.hide p0 % taux texte gr.hide p1 % valeur frequence gr.hide p2 % Taux value gr.hide Rect7_TAUX !print "201 ..Hidding" for i=1 to 5 gr.hide Obj[i] % touches +- Freq et +- taux gr.hide Obj[7+i] % texte touche + - Taux gr.hide obj[15+i-1] % forme d'onde oscillo gr.hide obj[30+i-1] next i gr.hide obj[20] gr.hide obj[26] gr.hide Obj[10] gr.hide Obj[11] !print "202 ..Hidding" gr.hide Obj[37] gr.hide Obj[38] gr.render ! gr.show ObjFixe[2] % affiche clavier num gr.render x=0 y=0 Nombre$="" str1$="1234567890" validation=0 !print "205 entree boucle while" WHILE (validation =0) % touche validation x=0 y=0 GR.touch touched, x, y IF touched then !print "205 x y ";x,y FOR j=1 to 3 %--------------- print j IF ( x>(380+(j-1)*76) & x<(455+(j-1)*80) & y>220 & y<260 ) then % 1 2 3 Nombre$=Nombre$+MID$(str1$,j,1) !print "1er ";j,Nombre$ end if IF (x>(380+(j-1)*76) &x<(455+(j-1)*80) & y>290 & y<325) then % 4 5 6 Nombre$=Nombre$+MID$(str1$,j+3,1) !print "2em ";j,Nombre$ end if IF (x>(380+(j-1)*76) & x<(455+(j-1)*80) & y>360 & y<395) then % 7 8 9 Nombre$=Nombre$+MID$(str1$,j+6,1) !print "3em "; j,Nombre$ end if NEXT i %----------------- IF (x>405 & x<450 & y>425 & y<460) then % . Nombre$=Nombre$+"." !print " . " end if IF (x>480 & x<530 & y>425 & y<460) then % 0 Nombre$=Nombre$+"0" !print "zero " end if IF (x>565 & x<610 & y>425 & y<460) then % 000 Nombre$=Nombre$+"000" !print "000 " end if IF (x>660 & x<770 & y>290 & y<320) then % correction k=len(Nombre$) if k>0 then if k=1 then Nombre$="" else Nombre$=left$(Nombre$,k-1) end if end if !print "correction " end if IF (x>660 & x<770 & y>220 & y<260) then % Annulation Nombre$="" !print "annul " end if IF (x>660 & x<770 & y>425 & y<460) then validation=1 !debug.print "220 validation " end if gr.hide p3 gr.text.bold 1 gr.color 255,0,255,0,0 % vert gr.text.size 32 gr.text.draw p3,400,180,Nombre$ gr.show p3 gr.render Tone 440,600 END IF % touched REPEAT % ---- jusqu a la validation =1 ! !debug.print "230" t6=0 ! remet le context grafique precedent gr.hide ObjFixe[2] % clavier num gr.hide p3 % valeur intermediare saisie par Keyb numerique gr.show ObjFixe[1] % fenetre valeur Frequ !print "232" for i=1 to 5 if ObjStatus[i]=1 then gr.show Obj[i] if ObjStatus[7+i]=1 then gr.show Obj[7+i] % touche + - Taux if ObjStatus[30+i-1]=1 then gr.show Obj[30+i-1] if ObjStatus[15+i-1]=1 then gr.show Obj[15+i-1] gr.render next i !if ObjStatus[7]=1 then gr.show Obj[7] !if ObjStatus[8]=1 then gr.show Obj[8] !if ObjStatus[9]=1 then gr.show Obj[9] if ObjStatus[20]=1 then gr.show Obj[20] if ObjStatus[26]=1 then gr.show Obj[26] !debug.print "233" gr.show p1 % val freq if ObjStatus[34]=1 then gr.show p0 % taux texte gr.show p2 % Taux value end if !debug.print "234" gr.show Rect7_TAUX ! lien avec dent de scie Norm ou Rev if ObjStatus[31]=1 then gr.show Obj[37] gr.show Obj[26] if DentReverse=0 then gr.hide Obj[38] ObjStatus[38]=0 else gr.show Obj[38] ObjStatus[38]=1 end if end if debug.print "235" freq=val(Nombre$) gosub Refresch_Freq_Value if Test=0 then MsgS$=Format$("%%%%%%.###",Freq) ! nota: bt.write rajoute deja LF en fin de string MsgE$="F"+right$(MsgS$,10) % +chr$(13) % zeros devant le nombre if s=3 then BT.Write MsgE$ pause 50 MsgE$="" end if END IF %--- si T6=1 demande activation clavier gr.render ! === EFFET /fenetre de mesure si limites atteintes ==== if ((Freq>=40000.0) | (Freq<=0.1)) then For i = 1 to 255 step 32 gr.modify ObjFixe[1],"alpha",i gr.render pause 10 next i end if if ((Taux>=254) | (Taux<=2)) then For i = 1 to 255 step 32 gr.modify Rect7_TAUX,"alpha",i gr.render pause 10 next i end if !debug.print "280" ! a traiter dans PIC ! === Envoi Raz Timeout ====== !EE$="@" + chr$(13) !if test=0 then ! bt.write EE$ ! pause 10 !end if !if test=1 then debug.print "290 Nb1= ";Nb1 Nb1=Nb1+1 if Nb1=100 then gr.save Prog$+".jpg" j1=j1+1 !until (Nb1=0) until (Nb1>NbMax) ! --------- fin de boucle principale -------- DT=clock()- DT0 Assez: popup "Assez, fin normale..",250,250,2000 pause 2000 Tone 440,1000 Tone 800,1000 Tone 600,1000 if test=0 then bt.close gr.close pause 2500 Ici: print " Fin normale " print Prog$+".bas" !Attention ne pas utiliser PRINT tout seul print "version basic : ";VERSION$() print "Resolution Ecran " print "Larg = ";w print "Haut = ";h print "Temps ecoule pour ";format$("#########",NbMax);" boucles: ";format$("# ### ###.###",DT) print "j1=";j1-1 print "Dt 1 boucle =";DT/NbMax;" mS" !browse "http://paulfjujo.free.fr" goto arreter Octet2Binaire_: E1$="" k1=j1 & 255 for kk=0 to 7 if (k1 && 2^(7-kk)) >0 then E1$=E1$+"1" else E1$=E1$+"0" end if next kk if test=1 then debug.print "E1$=";E1$ return My_Split: J3=1 L3=1 longueur=0 do M3= Is_In(";",recept$,L3) K3=len(recept$) if M3>0 then rec_Array$[J3]=mid$(recept$,L3,M3) longueur=longueur + 1 recept$=right$(recept$,K3-M3) J3=J3+1 end if until M3=0 return Refresch_Freq_Value: ! rafraichi frequence value gr.hide p1 gr.text.align 1 % left gr.text.size 80 gr.text.bold 1 gr.color 255,255,255,255,0 % blanc TFr$=format$(" ### ###.##",Freq) gr.text.draw p1, 60,125,TFr$ gr.show p1 gr.text.bold 0 gr.text.size 24 gr.render return Reglage_Taux: !=========== test Zone Incr/Decr Taux========= drmt=0 % drapeau signalant une modif du Taux t7=0 !increment Taux !debug.print "180 Increment Taux" gr.bounded.touch t7, 540,390,590,430 while (t7>0) gr.show Obj[3] gr.Hide Obj[10] gr.render if Taux <254 then Taux=Taux+1.0 end if gosub Refresch_Taux_Value Pause 50 gr.Hide Obj[3] gr.show Obj[10] gr.render drmt=1 gr.bounded.touch t7, 540,390,590,430 repeat !Decrement Taux t8=0 !debug.print "185 Decrement Taux" gr.bounded.touch t8, 540,440,590,480 while (t8>0) gr.Hide Obj[11] gr.show Obj[4] gr.render if Taux >2.0 then Taux=Taux-1.0 end if gosub Refresch_Taux_Value Pause 50 gr.show Obj[11] gr.Hide Obj[4] gr.render drmt=1 gr.bounded.touch t8, 540,440,590,480 repeat ! ! modif 6/11/2014 gosub Refresch_Taux_Value if ((drmt=1) & (test=0)) then ! nota , BT.Write ajoute deja un LF en fin de string MsgS$=Format$("%%%%.#",Taux) MsgE$="N"+right$(MsgS$,6) bt.write MsgE$ t7=0 t8=0 end if return Refresch_Taux_Value: gr.hide p2 gr.text.align 1 % left gr.text.size 28 gr.text.bold 1 tx=Taux*100.0/255.0 TTaux$=format$("###.#",tx) gr.text.draw p2, 615,430,TTaux$ gr.show p2 gr.text.bold 0 gr.text.size 12 gr.render ttx=Tx*1.35+620 ! rectangle represente le taux !print "dessine Taux" gr.modify Line2, "x2",ttx gr.modify Line3, "x1",622 gr.modify Line3, "x1",ttx gr.modify Line3, "x2",ttx gr.modify Line4, "x1",ttx gr.show Line1 gr.show Line2 gr.show Line3 gr.show Line4 gr.render return Traite_Dent_de_scie: !Traitement special Dent de scie if ObjStatus[31]=1 then ! choix dent de scie VRAI gr.show Obj[37] ObjStatus[37]=1 % rond vide gr.show Obj[26] % texte revers Saw ObjStatus[26]=1 if Dentreverse=1 then ObjStatus[38]=0 gr.hide Obj[38] ! cache rond plein gr.show Obj[16] ! forme d'onde oscilloscope DdS Normale ObjStatus[16]=1 gr.hide Obj[20] ! forme d'onde oscilloscope DdS Reverse ObjStatus[20]=0 else ObjStatus[38]=1 gr.show Obj[38] ! cache rond plein gr.hide Obj[16] ! forme d'onde oscilloscope DdS Normale ObjStatus[16]=0 gr.show Obj[20] ! forme d'onde oscilloscope DdS Reverse ObjStatus[20]=1 end if else gr.hide Obj[37] % rond vide gr.hide Obj[38] % rond plein gr.hide Obj[26] % texte revers Saw gr.hide Obj[16] ! forme d'onde oscilloscope DdS Normale gr.hide Obj[20] ! forme d'onde oscilloscope DdS Normale ObjStatus[16]=0 ObjStatus[38]=0 ObjStatus[37]=0 ObjStatus[16]=0 ObjStatus[20]=0 !Dentreverse=1 end if % objStatus return Alive_Led: !clignote led rouge if ObjStatus[5]=0 then gr.show Obj[12] % Led On ObjStatus[5]=1 gr.hide Obj[5] else gr.show Obj[5] %Led Off ObjStatus[5]=0 gr.hide Obj[12] %Led On end if return Perte_BT: popup "Perte connection BT !! ",250,250,2000 pause 500 print "Connection perdue",Nb1 Bt.reconnect return arreter: Console.save Prog$+".txt" pause 1000 OnError: Console.save "Err_"+Prog$+".txt" pause 1000 end !! 16:54:18.015> HC05-0539-RS 16:54:26.765> D 16:54:29.265> T 16:54:31.765> C 16:54:34.078> R 16:54:34.203> 50 16:54:34.703> 50 16:54:35.015> 50 16:54:35.390> 50 16:54:35.828> 50 16:54:36.203> 50 16:54:36.578> 50 16:54:37.015> 50 16:54:37.328> 50 16:54:38.640> S 16:54:43.765> R 16:54:43.890> 50 16:54:44.328> 50 16:54:44.703> 50 16:54:45.203> 51 16:54:45.765> 52 16:54:46.328> 53 16:54:46.828> 54 16:54:47.515> 56 !!