MultiWii

uwrtey

В смысле “только ручками” ?
Я че-то недопонял…
В смысле мультивий не подойдет? И придется прошивку самому переписывать?

romeo84

Всех приветствую!

Если кто разбирался, подскажите плз., каким где в коде в прошивке берутся данные с приёмника и где просчитанные данные выходят непосредственно к регулятором двигателей? Основная идея, считать AUX3 со свободной ножки.

Пробовал искать сам, но упираюсь в непонятки:

по идее, массив со считанными значениями формируется вот так вот

      rcData[ROLL] = Servo_Buffer[0];
      rcData[PITCH] = Servo_Buffer[1];
      rcData[THROTTLE] = Servo_Buffer[2];
      rcData[YAW] = Servo_Buffer[3];
      rcData[AUX1] = Servo_Buffer[4];
      rcData[AUX2] = Servo_Buffer[5];
      rcData[AUX3] = Servo_Buffer[6];
      rcData[AUX4] = Servo_Buffer[7]; 

Массив Servo_Buffer хитроумным способом считается так

temp_int = (256*RF_Rx_Buffer[1+(2*i)]) + RF_Rx_Buffer[2+(2*i)];
        if ((temp_int>1500) && (temp_int<4500)) Servo_Buffer[i] = temp_int/2;

Копаем глубже, temp_int идёт отсюда

temp_int = (256*RF_Rx_Buffer[1+(2*i)]) + RF_Rx_Buffer[2+(2*i)];

А RF_Rx_Buffer берём так

send_read_address(0x7f); // Что за адрес это такой?
    for(i = 0; i<17; i++) {//read all buffer
      RF_Rx_Buffer[i] = read_8bit_data();
    }   

Теперь тупик… Вот процедура чтения 8 бит данных с моими комментами

uint8_t read_8bit_data(void) {
  uint8_t Result, i;

  SCK_off; // PORTC &= 0xFB зачем-ть в порт С пихаем 1111 1011
  Result=0;
  for(i=0;i<8;i++) {                    //read fifo data byte
    Result=Result<<1;
    SCK_on;
    NOP();
    if(SDO_1) { // (PINC & 0x01) == 0x01 проверяем на первой ножке порта С логическую единичку...?? Как этим мы читаем PWM сигнал определённого канала, загадка!
      Result|=1;
    }
    SCK_off;
    NOP();
  }
  return(Result);
}  

Так где ж тут мы задаём с какой ножки микросхемы читать данные?? Можете “разжевать” эту функцию?

Если кто раскапывал это, поделитесь плиз, буду очень благодарен!

romeo84

Это код прошивки MultiWii_2_2, код функции из файла RX.INO

mataor

вы вообще полезли в абсолютно левые дебри…
вот чтение собственно сигналов:

#if defined(STANDARD_RX)

#if defined(FAILSAFE) && !defined(PROMICRO)
   // predefined PC pin block (thanks to lianj)  - Version with failsafe
  #define RX_PIN_CHECK(pin_pos, rc_value_pos)                        \
    if (mask & PCInt_RX_Pins[pin_pos]) {                             \
      if (!(pin & PCInt_RX_Pins[pin_pos])) {                         \
        dTime = cTime-edgeTime[pin_pos];                             \
        if (900<dTime && dTime<2200) {                               \
          rcValue[rc_value_pos] = dTime;                             \
          if((rc_value_pos==THROTTLEPIN || rc_value_pos==YAWPIN ||   \
              rc_value_pos==PITCHPIN || rc_value_pos==ROLLPIN)       \
              && dTime>FAILSAFE_DETECT_TRESHOLD)                     \
                GoodPulses |= (1<<rc_value_pos);                     \
        }                                                            \
      } else edgeTime[pin_pos] = cTime;                              \
    }
#else
   // predefined PC pin block (thanks to lianj)  - Version without failsafe
  #define RX_PIN_CHECK(pin_pos, rc_value_pos)                        \
    if (mask & PCInt_RX_Pins[pin_pos]) {                             \
      if (!(pin & PCInt_RX_Pins[pin_pos])) {                         \
        dTime = cTime-edgeTime[pin_pos];                             \
        if (900<dTime && dTime<2200) {                               \
          rcValue[rc_value_pos] = dTime;                             \
        }                                                            \
      } else edgeTime[pin_pos] = cTime;                              \
    }
#endif

  // port change Interrupt
  ISR(RX_PC_INTERRUPT) { //this ISR is common to every receiver channel, it is call everytime a change state occurs on a RX input pin
    uint8_t mask;
    uint8_t pin;
    uint16_t cTime,dTime;
    static uint16_t edgeTime[8];
    static uint8_t PCintLast;
  #if defined(FAILSAFE) && !defined(PROMICRO)
    static uint8_t GoodPulses;
  #endif

    pin = RX_PCINT_PIN_PORT; // RX_PCINT_PIN_PORT indicates the state of each PIN for the arduino port dealing with Ports digital pins

    mask = pin ^ PCintLast;   // doing a ^ between the current interruption and the last one indicates wich pin changed
    cTime = micros();         // micros() return a uint32_t, but it is not usefull to keep the whole bits => we keep only 16 bits
    sei();                    // re enable other interrupts at this point, the rest of this interrupt is not so time critical and can be interrupted safely
    PCintLast = pin;          // we memorize the current state of all PINs [D0-D7]

    #if (PCINT_PIN_COUNT > 0)
      RX_PIN_CHECK(0,2);
    #endif
    #if (PCINT_PIN_COUNT > 1)
      RX_PIN_CHECK(1,4);
    #endif
    #if (PCINT_PIN_COUNT > 2)
      RX_PIN_CHECK(2,5);
    #endif
    #if (PCINT_PIN_COUNT > 3)
      RX_PIN_CHECK(3,6);
    #endif
    #if (PCINT_PIN_COUNT > 4)
      RX_PIN_CHECK(4,7);
    #endif
    #if (PCINT_PIN_COUNT > 5)
      RX_PIN_CHECK(5,0);
    #endif
    #if (PCINT_PIN_COUNT > 6)
      RX_PIN_CHECK(6,1);
    #endif
    #if (PCINT_PIN_COUNT > 7)
      RX_PIN_CHECK(7,3);
    #endif

    #if defined(FAILSAFE) && !defined(PROMICRO)
      if (GoodPulses==(1<<THROTTLEPIN)+(1<<YAWPIN)+(1<<ROLLPIN)+(1<<PITCHPIN)) {  // If all main four chanells have good pulses, clear FailSafe counter
        GoodPulses = 0;
        if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;
      }
    #endif
  }
  /*********************      atmega328P's Aux2 Pins      *************************/
  #if defined(PROMINI)
    #if defined(RCAUXPIN)
    /* this ISR is a simplification of the previous one for PROMINI on port D
       it's simplier because we know the interruption deals only with one PIN:
       bit 0 of PORT B, ie Arduino PIN 8
       or bit 4 of PORTB, ie Arduino PIN 12
     => no need to check which PIN has changed */
    ISR(PCINT0_vect) {
      uint8_t pin;
      uint16_t cTime,dTime;
      static uint16_t edgeTime;

      pin = PINB;
      cTime = micros();
      sei();
      #if defined(RCAUXPIN8)
       if (!(pin & 1<<0)) {     //indicates if the bit 0 of the arduino port [B0-B7] is not at a high state (so that we match here only descending PPM pulse)
      #endif
      #if defined(RCAUXPIN12)
       if (!(pin & 1<<4)) {     //indicates if the bit 4 of the arduino port [B0-B7] is not at a high state (so that we match here only descending PPM pulse)
      #endif
        dTime = cTime-edgeTime; if (900<dTime && dTime<2200) rcValue[0] = dTime; // just a verification: the value must be in the range [1000;2000] + some margin
      } else edgeTime = cTime;    // if the bit 2 is at a high state (ascending PPM pulse), we memorize the time
    }
    #endif
  #endif

а в функции void computeRC() получаем готовые значения в массив rcData[chan]

или же у вас OpenLRS плата?

и вообще подробней объясните задачу (какой контроллер?, зачем и что нужно? и т.д. )

uwrtey

mataor, в смысле “ручками” ?
в смысле код целиком переписать ?

varvar

Господа, а что сказать мультивию, чтобы замедлить скролинг по меню OLED дисплея или вообще заставить переключать пункты по шагам? Что-то он у меня так быстро с пункта на пункт перескакивает, попасть в нужное место меню практически нереально.

В настройках стоит

      #define OLED_I2C_128x64
      #define SUPPRESS_OLED_I2C_128x64LOGO
      #define DISPLAY_FONT_DSIZE
      #define LCD_CONF

Телеметрия не включена за ненадобностью.

AlexeyStn
varvar:

Господа, а что сказать мультивию, чтобы замедлить скролинг по меню OLED дисплея или вообще заставить переключать пункты по шагам?

Я делал следующим образом:
В файле “LCD.ino” есть функция “configurationLoop()”
Там есть такое место:


if (refreshLCD) {
      ConfigRefresh(p);
      refreshLCD = 0;
    }

Туда я добавил обычную задержку в 200 миллисекунд и скроллинг стал медленнее. Но и настройка параметров тоже стала медленнее.


if (refreshLCD) {
      ConfigRefresh(p);
      refreshLCD = 0;
      delay(200);
    }
flygreen

Народ, а кто какие ПИДы ставит на удержание высоты ? У меня коптер колбасит примерно два-два с половиной метра по высоте. Тудым-сюдым. Датчик паралонкой закрыт. Вчера на поле с собой нотер брал, тыркал,тыркал так и не держит высоту. Болтается…

Пиды выставил так P 2.0 I 0 D 0 Плата криус СЕ.

witalik17

Подскажите пожалуйста.Купил платку летавшую,нужно залить немного другую прошивку.Проблема в том что пробовали на 5 разных компах,3 разных шнурка,ни один с компов не видит плату,драйвера не помогают.Платка светит 2 красных светодиода.

natol

Скрин старый но конфиг для квадро не плохой.

mataor
flygreen:

У меня коптер колбасит примерно два-два с половиной метра по высоте.

flygreen:

Плата криус СЕ.

а чего более лучшего вы хотите? если нужно лучше - АИО и маховий

П.С. также в обоих случаях важна балансировка пропеллеров и моторов

flygreen

Висит то хорошо, почти никуда не уползает. А, вот высоту не держит. Балансировку делал и винтов и моторов. Плата конечно какашная, думал может кто боролся с ней. Чего толкового подскажет . )

Кстати где можно “маховий” взять ? Я так понимаю надо аффтору писать непосредственно ?

omegapraim

да над писать автору в личку или на почту.

vatanuki

ктонибуть уже успел облетать 2.3?
интересно будет ли маховий на базе 2.3 ?

witalik17

Неужели ни кто не сталкивался с такой проблемой?

omegapraim
witalik17:

Неужели ни кто не сталкивался с такой проблемой?

Вы удосужтесь сначала написать что за плата. В большенстве случаев дохнет микруха FTDI у меня например плата контроллера подвеса пришла симптомы были такие же устанавливается но при подключении данные не идут, светят оба диода, лечится сменой микрухи. А что бы узнать какая микруха надо знать тип платы.

vatanuki:

ктонибуть уже успел облетать 2.3?
интересно будет ли маховий на базе 2.3 ?

А смысл делать маховий 2.3, в этой прошивке нет почти ничего нового, я думал хотя бы алгоритм гпс допилят, а вот хрен написано было в следующей версии прошивки…

vatanuki

как это ничего? 😃 а это?

***Control mode***

- main PITCH/ROLL/YAW PID modification (r1474)
  - the sticks scaling is no more affected by PID coefficients
  - yaw rate (to the right of the PIDs in GUI) now works as stick scaling
  - default yaw rate is increased (with yaw rate at 0)
  - yaw PID principle is now different from PITCH&ROLL PID:
    - yaw ITerm windup is very high, allowing an 'elastic' direction return after a manual perturbation
    - yaw ITerm is also constrained with a windup independent limit
    - yaw PTerm is constrained in order to counter the yaw jump effect.
      use yaw DTerm to increase this constrain (r1573)
    - yaw ITerm is canceled if the yaw stick is not centered

- Throttle angle correction (r1374)

- Advanced Headfree mode added (see config.h for instructions) (r1374)

- DYNBALANCE option, individual motor can be controled via GUI, to test individual vibration
  

- better gyro & acc calibration accuracy (r1546)
  

- cannot arm is baro mode is on (r1550)
  
  ! baro mode should be activated only when the multi is nearly Z stable !
- only one baro mode : vario around a throttle deadband (r1554)

- magHold is reset when arm is switched on (r1553)
  

- ONLYARMWHENFLAT option (r1587)
  



***receiver & UART***

- RCSERIAL is now deeply integrated. If a MSP_SET_RAW_RC comes, it will just override legacy RX data. (r1420)
  as a consequence, RCSERIAL is no more an option

- no RC averaging for Spektrum & SBUS (r1545)

- SBUS center define (r1568)
  

- FAILSAFE_DETECT_TRESHOLD configurable



***GPS***

- Enables sonar altitude from i2c-gps-nav board (1424)

- navigation code will follow after 2.3



***GUI***

- Gui with Servosettings. (r1441 & r1450)
  All models with servo included.

- GUI globalsettings (for some settings previously only in config.h)

- do not display /dev/cu.* devices but only corresponding /dev/tty.* (r1442)

- GUI baudrate as configurable setting



***LCD***

- lcd.telemtry: show max ground speed from gps data (r1398)

- lcd.telemetry: allow separate suppression of aux2 configuration (r1456)

- new display support 1.3" i2c OLED from  (r1413)

- config.menu: when abort, revert all values back to last saved state

- visual feedback from servos during midpoint trim via LCD



***IMU and baro***

- correct GYRO_SCALE for all gyro (r1428)

- no more small angles while shaking the board (r1579)
  

- baro Alt based on ground temp compensation (r1570)
  

- not I reset for FIWEDWING (r1590)
  

- add 6DOF LSM330 sensor (r1571)

- add ACC BMA280 sensor (r1600)



*** SERVO management ***

warning:
The pins for coptertypes with servos have been changed.
Attaching a servo to a motor pin can quickly destroy your servo.
All connection diagrams out there from v2.2 or older are no longer valid for v2.3 with servos using hardware PWM.



- add 8 hardware PWM's for servos on MEGA boards. Servo outputs are 44,45,46,11,12,6,7,8 (r1384)

- Allow any servo refresh rate from 20 to 400Hz on Mega hardware PWM servos. (r1386)

- Tri servo moved to SERVO4 (pin11) on mega boards with HW PWM's. (r1392)

- a32u4 (nanoWii, MicroWii etc) HW PWM for 4 servos; warning different pins!!
  (with lots of info and help from ronco)
  (r1464 & r1470)

- add a generic way to configure servo settings : conf struct + MSP read/set messages (r1383)

- Added general servo handler (r1421 & r1429)
  

- allow preset of some servo stuff from config.h (r1432)

- Gui with Servosettings. (r1441)

- add gimbal servo stretcher usable with HW PWM's. (r1384)
  We can get 180 degrees servo move without servo modification.
- note about gimbal: settings for neutral&endpoints are no more in config.h, but only in GUI

- do not update servos during unarmed calibration of sensors which are sensitive to vibration (r1408)



***internal improvements***

- migration to a cpp/h code structure (r1515 & r1516)
  
  

- huge flash size optimization (around 1k)
  thanks to fine struct definitions + serialization over MSP (r1369)

- make powermeter computation time based (again) to reduce config hassle and increase accuracy (r1375)

- read at most one analog channel per MWii main loop cycle (r1375)

- smoothing of RX_RSSI (r1379)

- make faster analog reads an option with default off to increase accuracy (r1375)

- detangle vbat & buzzer dependancy (r1375)

- optimization : small approximation bit shift used instead of * or / number
  for TPA, rates, dynP, dynD and expo curb (r1376)

- Added checking for flash content change, and reload config parameters in this case. (r1389)

- split Serial into Serial(core UART management) & Protocol (r1548)

- loop is globally faster



***add-ons***

- option to suppress defaults in mwc sketch and load via gui from file instead (r1365)

- add OVERRIDE_PSENSORPIN option (r1375)

- manual for using Multiwii in Eclipse environment
  

- add amperage to MSP_ANALOG (r1542)

- MY_PRIVATE_DEFAULTS (r1559)
  

- no more than one MSP per port and per cycle
  should smooth the delay while requesting MSP, especially for USB port on micro

или только одним гпс пользоваться? 😃
если думать как Вы то сидеть нам на 98 виндовсе:)

omegapraim

А чего из нужных функций нет сейчас в маховии? Честно вот мне сейчас прошивки достаточно а ненужный хлам типа включать по 1му двигателю из гуи для проверки вибрации мне нафиг не нужно)))) Но я выражаю чисто свое мнение.

Кстати подумываю вообще перейти на RC2 чет она мне больше нравится, мягче и приятнее летала чем RC3

mahowik
omegapraim:

да над писать автору в личку или на почту.

никуда писать не надо… все подробно расписано в дневнике rcopen.com/blogs/83206/17033

vatanuki:

интересно будет ли маховий на базе 2.3 ?

как уже писал в дневнике, пока не вижу в 2.3 чего то принципиально нового и интересного… даж полет по точкам не доделан…

omegapraim

Саш а нафиг он нужен то этот полет по точкам? для этого ведь мегапират есть. Лучше бы совершенствовали и доводили то что есть, а не делали мегапирата 2.8))))