<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=21655&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2018-12-14T17:27:44+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=21655&amp;mode</id>
<entry>
<author><name><![CDATA[Daro69]]></name></author>
<updated>2018-12-14T17:27:44+01:00</updated>
<published>2018-12-14T17:27:44+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214665#p214665</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214665#p214665"/>
<title type="html"><![CDATA[Re: Potrzebna pomoc przy tworzeniu menu dla matrixa z YB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214665#p214665"><![CDATA[
witam,<br />zauważyłem w linijkach od 154 do 164...<br />Jaki jest zamysł stosowania operatorów bitowych &quot;&amp;&quot; pomiędzy logicznymi &quot;&amp;&amp;&quot;.  (a &amp;&amp; b) <span style="color: #0080FF">&amp;</span> (c == d). ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11549">Daro69</a> — 14 gru 2018, o 17:27</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[miki53]]></name></author>
<updated>2018-12-04T18:39:29+01:00</updated>
<published>2018-12-04T18:39:29+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214344#p214344</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214344#p214344"/>
<title type="html"><![CDATA[Potrzebna pomoc przy tworzeniu menu dla matrixa z YB]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=21655&amp;p=214344#p214344"><![CDATA[
Witam wszystkich<br /><br />Potrzebuje waszej pomocy <br />Próbuję zrobić menu sterowane pilotem RC5 ale mam problem<br />z uruchomieniem funkcji w pętli  for(;;) ma ona się pokazywać<br />po warunku  if  <br />tylko że po wejściu w warunek nic nie działa ani ify ani funkcja ir<br />i nie wiem dlaczego  może tłumaczę troszkę mętnie więc poniższy kod <br />wyjaśni bardziej o co chodzi.<br /><br />kod działa do podmenu  <br /><br /><br />TEN FRAGMENT KODU W PLIKU msgeq7.h <br /><br />[syntax=c]enum { _us_czas, _alarm, _wifi, _test_pi };[/syntax]<br /><br />TEN KOD W PLIKU msgeq7.c<br /><br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;stdlib.h&gt;<br />#include &lt;string.h&gt;<br /><br /><br />#include &quot;msgeq7.h&quot;<br /><br />#include &quot;MATRIX_DISP/mk_matrix_disp.h&quot;<br />#include &quot;MATRIX_DISP/GRAPH/mk_matrix_graph.h&quot;<br />#include &quot;MATRIX_DISP/FONTS/mk_fonts.h&quot;<br />#include &quot;MATRIX_DISP/TEXT/mk_matrix_text.h&quot;<br /><br /><br />#include &quot;common.h&quot;<br />#include &quot;adc.h&quot;<br />#include &quot;soft_timers.h&quot;<br />#include &quot;MK_USART/mkuart.h&quot;<br />#include &quot;IR_UNI/ir_config.h&quot;<br />#include &quot;efektyFX.h&quot;<br /><br />int8_t eq_styl = _us_czas;<br />int8_t eq_width;// =_us_godz;<br /><br />uint16_t equalizer&#91;7&#93;;// pomiary equalizera<br /><br /><br />uint8_t stop_equ;<br /><br />// -- nagłówki pod menu ---<br />uint8_t zegar;<br />uint8_t budzik;<br />uint8_t synchro;<br />uint8_t test;<br />uint8_t hh;<br /><br />void MSGEQ7_init( void ) {<br /><br />DIDR0 |= (1&lt;&lt;EQADC);// odłączamy port cyfrowy od pinu PC0 (MSGEQ7)<br /><br />STROBE_DDR |= STROBE;<br />RST_DDR |= RST;<br /><br />}<br /><br />void MSGEQ_read(void) {// funkcja odczytujaca dane z equalizera<br />uint8_t i;<br />RST_1;<br />STROBE_1;<br />RST_0;<br /><br />for(i=0;i&lt;7;i++) {<br />STROBE_0;<br />_delay_us(25);<br />equalizer&#91;i&#93; = pomiar( EQADC );//wykonanie pomiaru i zapis wartosci<br />STROBE_1;<br />}<br /><br />}<br /><br /><br />static void equ_parse_ir( uint8_t addr, uint8_t cmd, uint8_t key_time ) {<br /><br />if( addr ) return;<br />if( 0xff == cmd ) return;<br /><br />//if( !key_time ) {<br />//beep( 10 );<br />//}<br />// ===========================================================<br />// ============ Regulacja jasności ===========================<br />if( ((19 == cmd) || (18 == cmd)) &amp;&amp; 10==key_time ) { // klawisz pilota --&gt;&gt; 19 - JASNOŚĆ + 18<br />manual_pwm ^= 1;<br />beep(10);<br />}<br />if( manual_pwm ) {<br />if( 19 == cmd &amp;&amp; key_time ) {      // klawisz pilota JASNOŚĆ -<br />if( jasnosc&gt;35 ) jasnosc -= 10;<br />matrix_pwm( jasnosc );<br />}<br />else if( 18 == cmd &amp;&amp; key_time ) { // klawisz pilota JASNOŚĆ +<br />if( jasnosc&lt;90 ) jasnosc += 10;<br />matrix_pwm( jasnosc );<br />}<br />}<br /><br />// ================= Regulacja jasności ========================<br />// =============================================================<br />// ============ WŁĄCZANIE MENU =================================<br /><br />if( 59 == cmd &amp;&amp;  key_time ) {          // klawisz pilota OK -&gt; środkowy niebieski<br />clear_screen( 0 );<br />setCurrentFont( &amp;font5x8FontInfo );<br />mLocate( 3,0, 1 );<br />mputs1_P( PSTR(&quot;MENU&quot;) );<br />update_screen();<br /><br />beep(10);<br />_delay_ms(2000);<br />//stop_equ = 1;<br />//beep(10);<br />}<br /><br />// ================================================================================================<br />// ================== WYŁĄCZANIE MENU =============================================================<br />if( 59 == cmd &amp;&amp; !key_time ) {         // klawisz pilota OK -&gt; środkowy niebieski<br />clear_screen( 0 );<br />setCurrentFont( &amp;font5x8FontInfo );<br />mLocate( 3,0, 1 );<br />mputs1_P( PSTR(&quot;-END-&quot;) );<br />update_screen();<br />_delay_ms( 2000 );<br />clear_screen( 0 );<br />update_screen();<br />stop_equ = 1;     // wyłącza MENU<br />beep(10);<br />}<br />//==================================================================================================<br />//================ NAGŁÓWKI MENU ===================================================================<br />    if( 32 == cmd &amp;&amp; key_time ) { // klawisz pilota strzałka do GÓRY ^<br />    eq_styl--;<br />    beep(10);<br />if( eq_styl &lt; 0 )eq_styl = _us_czas;{<br />         beep(10);<br />}<br />}<br />else if( 33 == cmd &amp;&amp; key_time ) { // klawisz pilota strzałka w DÓŁ V<br />eq_styl++;<br />if( eq_styl == _alarm )<br />beep(10);<br /> }<br />else if( 33 == cmd &amp;&amp; key_time ) { // klawisz pilota strzałka w DÓŁ V<br />eq_styl++;<br />if( eq_styl == _wifi )<br />beep(10);<br /> }<br />else if( 33 == cmd &amp;&amp; key_time ) { // klawisz pilota strzałka w DÓŁ V<br />eq_styl++;<br />if( eq_styl == _test_pi )<br />beep(10);<br />      }<br />// ===========================================================================================<br />// ********************************* POD MENU ************************************************<br /><br />//--------------------------- POD MENU USTAWIANIE ZEGARA CZAS DATA ----------------------------<br />     if (( 16 == cmd &amp;&amp;  key_time  )&amp;&amp;(eq_styl==_us_czas )){  // klawisz pilota w PRAWO &gt;&gt;&gt;<br />          zegar = 1;<br />        }<br />//---------------------------------------------------------------------------------------------<br />//-------------------------- POD MENU USTAWIANIE BUDZIKA --------------------------------------<br />else if (( 16 == cmd &amp;&amp;  key_time  )&amp;(eq_styl==_alarm )){  // klawisz pilota w PRAWO &gt;&gt;&gt;<br />           budzik = 1;<br />    }<br />//----------------------------------------------------------------------------------------------<br />//-------- POD MENU WŁĄCZANIA I WYŁĄCZANIA SYNCHRONIZACJI CZASU PRZEZ WIFI ---------------------<br />else if (( 16 == cmd &amp;&amp;  key_time  )&amp;(eq_styl==_wifi )){  // klawisz pilota w PRAWO &gt;&gt;&gt;<br />        synchro = 1;<br />    }<br />//----------------------------------------------------------------------------------------------<br />//------------------------ POD MENU TESTER PILOTÓW PODCZERWIENI --------------------------------<br />else if (( 16 == cmd &amp;&amp;  key_time  )&amp;(eq_styl==_test_pi )){  // klawisz pilota w PRAWO &gt;&gt;&gt;<br />        test = 1;<br />    }<br />//----------------------------------------------------------------------------------------------<br /><br />          if(eq_styl &gt; 3 )eq_styl = _test_pi; {<br />                    beep(10);<br />            }<br />            }<br />// ========================  OBSŁUGA KLAWISZA PILOTA W - &lt;&lt; LEWO - =============================<br />/*<br />      if ( 17 == cmd &amp;&amp;  key_time  ){  // klawisz pilota w LEWO &lt;&lt;&lt;<br /><br />         }<br /> */<br /> // =============================================================================================<br /><br />static void equ_timer0_tick( TSTIMER * tmr ) {<br /><br />pomiar_foto();<br /><br />static uint16_t lcz=0;<br /><br /><br />clear_screen(0);<br /><br />MSGEQ_read();<br /><br />// === Nagłówki Menu =================<br />// --- Nagłówek ust. zegara ----------<br /><br />if( eq_styl == _us_czas ) {<br /><br />clear_screen( 0 );<br />setCurrentFont( &amp;font5x8FontInfo );<br />mLocate( 0,0, 1 );<br />mputs1_P( PSTR(&quot;us czas&quot;)) ;<br />update_screen();<br /><br />    }<br /><br />// -----Nagłówek ust. budzika --------------------<br />if(  eq_styl ==  _alarm) {<br /><br />clear_screen( 0 );<br />setCurrentFont( &amp;font5x8FontInfo );<br />mLocate( 0,0, 1 );<br />mputs1_P( PSTR(&quot;alarm&quot;)) ;<br />update_screen();<br /><br />}<br /> // ----Nagłówek ust. zegara przez wifi -------------<br />if(  eq_styl ==  _wifi ) {<br /><br />clear_screen( 0 );<br />setCurrentFont( &amp;font5x8FontInfo );<br />mLocate( 0,0, 1 );<br />mputs1_P( PSTR(&quot;-wifi-&quot;)) ;<br />update_screen();<br /><br />}<br />// -----Nagłówek ust. testera pilotów  -----------------<br /> if (  eq_styl ==  _test_pi) {<br /><br /> clear_screen( 0 );<br /> setCurrentFont( &amp;font5x8FontInfo );<br /> mLocate( 0,0, 1 );<br /> mputs1_P( PSTR(&quot;test pi&quot;)) ;<br /> update_screen();<br /><br />}<br /><br />// === Koniec Nagłówków Menu ===========<br />// === POD MENU ========================<br /><br />// ------ ustaw zegar -----------<br /><br />    if ( zegar == 1){<br /><br />//////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />// ====================== OD TĄD MIESZAM W MENU PĘTLA (FOR(;;)) ========================================================<br />for(;;){<br />    //uint8_t stop_equ;<br />    uint8_t tik;<br />        uint8_t krok;<br /><br />    // inicjalizacja odb. podczerwieni<br />    ir_init();<br /><br />    // rejestracja procedury odbioru ir<br />    register_ir_event_callback( equ_parse_ir );<br /><br />    IR_EVENT();<br /><br />    clear_screen( 0 );<br />        setCurrentFont( &amp;font5x8FontInfo );<br />        mLocate( 3,0, 1 );<br />        mputs1_P( PSTR(&quot;POD-M&quot;) );<br />        update_screen();<br />        _delay_ms(2000);<br />    //    break;<br /><br /><br />  void equ_parse_ir( uint8_t addr, uint8_t cmd, uint8_t key_time ) {<br /><br />    if( addr ) return;<br />    if( 0xff == cmd ) return;<br /><br /><br />    //if( !key_time ) {<br />    //beep( 10 );<br />    //}<br /><br />    if( 17 == cmd &amp;&amp; key_time ) {<br />    krok = 1;<br />    }<br />    //stop_equ = 1;<br />    if(( 33 == cmd &amp;&amp; key_time )&amp;&amp;(krok = 1)) {<br /><br />    clear_screen( 0 );<br />    setCurrentFont( &amp;font5x8FontInfo );<br />    mLocate( 3,0, 1 );<br />    mputs1_P( PSTR(&quot;test&quot;) );<br />    update_screen();<br /><br />    beep(10);<br />    _delay_ms(2000);<br /><br />    }<br /><br />    if( 32 == cmd &amp;&amp; key_time ) {<br />    tik--;<br />    if( tik &lt; 0 ) tik = 3;<br />    beep(10);<br />    }<br />/*<br />    if( 33 == cmd &amp;&amp; key_time ) {<br />    tik++;<br />    if( tik &gt; 3 ) tik = 0;<br />    beep(10);<br />    }<br />*/<br />/*<br />    if( 17 == cmd &amp;&amp; key_time ) {<br />    eq_width--;<br />    if( eq_width &lt; 1 ) eq_width = 1;<br />    beep(10);<br />    }<br />*/<br />    if( 16 == cmd &amp;&amp; key_time ) {<br />    eq_width++;<br />    if( eq_width &gt; MATRIX_WIDTH/2 ) eq_width = (MATRIX_WIDTH/2)-1;<br />    beep(10);<br /><br /><br />    }<br /><br /><br />    }<br /><br /><br /><br /><br />  break;<br /><br />}<br />}<br />//=============== MIESZAM DO TEGO MIEJSCA =========================================================================<br />///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />/*<br />    clear_screen( 0 );<br />    setCurrentFont( &amp;font5x8FontInfo );<br />    mLocate( 0,0, 1 );<br />    //mputs( 0,0,&quot;hh&quot; , 1 );<br />    mputint1( hh );<br />    mLocate( 0,5, 1 );<br />    mputint1( mm );<br />    mLocate( 0,10, 1 );<br />    mputint1( ss );<br />    update_screen();<br />    _delay_ms(200);<br />  */<br />   // }<br />/*<br />    if ( godziny == 1){<br /><br />            eq_styl = 0;<br />       clear_screen( 0 );<br />       setCurrentFont( &amp;font5x8FontInfo );<br />       //mLocate( 0,0, 1 );<br />       mputs( 0,0, &quot;hh-&quot;, 1 );<br />       mputint1( hh );<br />       update_screen();<br />       //_delay_ms(200);<br /><br />    }<br />    if ( minuty == 1){<br /><br /><br />       clear_screen( 0 );<br />       setCurrentFont( &amp;font5x8FontInfo );<br />       //mLocate( 0,0, 1 );<br />       mputs( 0,0, &quot;mm-&quot;, 1 );<br />       mputint1( mm );<br />       update_screen();<br />       _delay_ms(200);<br />       }<br /><br />    if ( sekundy == 1){<br /><br /><br />       clear_screen( 0 );<br />       setCurrentFont( &amp;font5x8FontInfo );<br />       //mLocate( 0,0, 1 );<br />       mputs( 0,0, &quot;ss-&quot;, 1 );<br />       mputint1( ss );<br />       update_screen();<br />       _delay_ms(200);<br />       }<br /><br />*/<br />// ------ ustaw budzik ------------<br />  if( budzik == 1 ) {<br /><br />  clear_screen( 0 );<br />  setCurrentFont( &amp;font5x8FontInfo );<br />  mLocate( 0,0, 1 );<br />  mputs1_P( PSTR(&quot;wstaje&quot;)) ;<br />  update_screen();<br />        budzik = 0;<br />      _delay_ms(2000);<br />  }<br /><br />// ------ wł/wy - wifi ------------<br />  if( synchro == 1) {<br /><br />   clear_screen( 0 );<br />   setCurrentFont( &amp;font5x8FontInfo );<br />   mLocate( 0,0, 1 );<br />   mputs1_P( PSTR(&quot;zal-wy&quot;)) ;<br />   update_screen();<br />        synchro = 0;<br />       _delay_ms(2000);<br />   }<br />// -------- test pilota -------------<br />  if( test == 1 ) {<br /><br />   clear_screen( 0 );<br />   setCurrentFont( &amp;font5x8FontInfo );<br />   mLocate( 0,0, 1 );<br />   mputs1_P( PSTR(&quot;test-p&quot;)) ;<br />   update_screen();<br />        test = 0;<br />       _delay_ms(2000);<br />   }<br />// -------------------------------------<br /><br />update_screen();<br /><br />lcz++;<br /><br />}<br /><br /><br />void analizator_widma( void ) {<br /><br />set_active_layer( 0 );<br />show_only_layer( 0 );<br />clear_screen(0);<br />update_screen();<br /><br />timer_init( 0, 18, 1, equ_timer0_tick );<br /><br />register_ir_event_callback( equ_parse_ir );<br />//register_uart_str_rx_event_callback( equ_parse_rs232 );<br /><br />while(1) {<br /><br />TIMERS_EVENT();<br />UART_RX_STR_EVENT( uart_buf );<br />IR_EVENT();<br /><br />if( stop_equ ) break;<br /><br />}<br /><br />stop_equ = 0;<br /><br /><br />}<br /><br /><br />uint8_t hbar( int val, uint8_t width, uint8_t zero_cutoff ) {<br />uint16_t a, res;<br />// zero_cutoff - odcięcie od zera ADC (szumy)<br />val=val-zero_cutoff;<br />if( val&gt;0 ) {<br />a = (val*100ul)/(1023ul-zero_cutoff);<br />res = (a*width)/100;<br />} else res=0;<br /><br />return res;<br />}<br /><br />uint8_t vbar( int val, uint8_t zero_cutoff ) {<br />uint16_t a, res;<br />// zero_cutoff - odcięcie od zera ADC (szumy)<br />val=val-zero_cutoff;<br />if( val&gt;0 ) {<br />a = (val*100ul)/(1023ul-zero_cutoff);<br />res = (a*(MATRIX_HEIGHT-1))/100;<br />} else res=0;<br /><br />return res;<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=18503">miki53</a> — 4 gru 2018, o 18:39</p><hr />
]]></content>
</entry>
</feed>