Hallo zusammen,
hab hier ein kleines Problem auf ATMega32 mit WinAVR:
Ich berechne 2 Werte und der Compiler sagt:
../RemoteRC_TX.c:46: warning: value computed is not used
../RemoteRC_TX.c:51: warning: value computed is not used
ich habe den Code bereits auf das wesentliche heruntergebrochen:
(die variable um die es geht ist "*offset_channel1")
1 | #ifndef F_CPU
|
2 | #define F_CPU 16000000UL // Systemtakt in Hz - Definition als unsigned long beachten >> Ohne ergeben Fehler in der Berechnung
|
3 | #endif
|
4 | #include <avr/io.h>
|
5 | #include <util/delay.h>
|
6 |
|
7 | static void get_settings(uint8_t *inv_channel1, int8_t *offset_channel1)
|
8 | {
|
9 | static uint8_t mode=1;
|
10 | static uint8_t modechange = 0;
|
11 |
|
12 | // Auswahl Button abfragen
|
13 | if(PIND & (1<<PIND7)) {
|
14 | _delay_ms(150);
|
15 | mode++;
|
16 | modechange = 1;
|
17 | if(mode == 3)
|
18 | mode=1;
|
19 | }
|
20 |
|
21 | // Entsprechenden Menuepunkt anzeigen
|
22 | switch(mode) {
|
23 | case 1:// invert Channel 1
|
24 | if(modechange == 1) {
|
25 | modechange = 0;
|
26 | }
|
27 | // invertieren des ersten Kanals aktivieren / deaktivieren
|
28 | if((PIND & (1<<PIND2)) || (PIND & (1<<PIND3))) {
|
29 | _delay_ms(150);
|
30 | if(*inv_channel1 == 0) {
|
31 | *inv_channel1 = 1;
|
32 | }
|
33 | else if(*inv_channel1 == 1) {
|
34 | *inv_channel1 = 0;
|
35 | }
|
36 | }
|
37 | break;
|
38 |
|
39 | case 2:// offset Channel 1
|
40 | if(modechange == 1) {
|
41 | modechange = 0;
|
42 | }
|
43 | if(PIND & (1<<PIND2)) {
|
44 | _delay_ms(150);
|
45 | if(*offset_channel1 > -20)
|
46 | *offset_channel1--;
|
47 | }
|
48 | if(PIND & (1<<PIND3)) {
|
49 | _delay_ms(150);
|
50 | if(*offset_channel1 < 20)
|
51 | *offset_channel1++;
|
52 | }
|
53 | break;
|
54 | }
|
55 | return;
|
56 | }
|
57 |
|
58 | int main(void)
|
59 | {
|
60 | uint32_t tmp = 10;
|
61 | uint16_t position_channel1; // aktuelle Position Poti 1
|
62 |
|
63 | int8_t offset_channel1 = 0; // Offset für Kanal 1
|
64 | uint8_t inv_channel1 = 0; // Invertierungsflag für Kanal 1
|
65 |
|
66 | while(1)
|
67 | {
|
68 | /* Channel 1 Updatem*/
|
69 | position_channel1 = (uint16_t)((tmp*250)/10240) + 250 + offset_channel1; // 250 ... 500 mitte 375
|
70 | // Channel 1 invertieren, falls eingestellt
|
71 | if(inv_channel1)
|
72 | position_channel1 = 750 - position_channel1;
|
73 |
|
74 | /* Einstellungen checken */
|
75 | get_settings(&inv_channel1, &offset_channel1);
|
76 | }
|
77 | return 0;
|
78 | }
|
Weiß jemand was da los ist? Ich habe so langsam keine Idee mehr..