{"id":154,"date":"2016-04-19T22:49:04","date_gmt":"2016-04-20T04:49:04","guid":{"rendered":"http:\/\/www.blog.jay-greco.com\/wp\/?p=154"},"modified":"2016-04-19T22:49:04","modified_gmt":"2016-04-20T04:49:04","slug":"eachine-h8-quadcopter-custom-firmware-ratessettings","status":"publish","type":"post","link":"http:\/\/www.blog.jay-greco.com\/wp\/?p=154","title":{"rendered":"Eachine H8 Quadcopter Custom Firmware Rates\/Settings"},"content":{"rendered":"<p>I recently flashed my new Eachine H8 with some custom firmware (<a href=\"https:\/\/github.com\/silver13\/h8mini-testing\">Silver13&#8217;s CFW, to be particular<\/a>) and I spent some time tuning it to be flyable in acro mode with the stock remote. Overall, I think this firmware is super cool and really strokes my roots as a <a href=\"http:\/\/www.blog.jay-greco.com\/wp\/?p=116\">hardware engineer and reverse engineer<\/a>. Not to mention, it flies as good or better than the stock firmware and is tons of fun to tinker with! Here&#8217;s my config.h file, for those who might be interested in a good place to start:<\/p>\n<pre>\/\/config.h, edited by jaygreco\r\n\r\n#include \"defines.h\"\r\n\r\n\/\/ rate pids in pid.c\r\n\/\/ angle pids in apid.h ( they control the rate pids)\r\n\/\/ yaw is the same for both modes\r\n\r\n\/\/ not including the \"f\" after float numbers will give a warning\r\n\/\/ it will still work\r\n\r\n\/\/ rate in deg\/sec\r\n\/\/ for low rates ( acro mode)\r\n#define MAX_RATE 180.0f\r\n#define MAX_RATEYAW 200.0f\r\n\r\n\/\/ multiplier for high rates\r\n\/\/ devo\/module uses high rates only\r\n#define HIRATEMULTI 3.0f\r\n#define HIRATEMULTIYAW 4.0f\r\n\r\n\/\/ max angle for level mode (in degrees)\r\n\/\/ low and high rates(angle?)\r\n#define MAX_ANGLE_LO 35.0f\r\n#define MAX_ANGLE_HI 55.0f\r\n\r\n\/\/ max rate for rate pid in level mode\r\n\/\/ this should usually not change unless faster \/ slower response is desired.\r\n#define LEVEL_MAX_RATE_LO 360.0f\r\n#define LEVEL_MAX_RATE_HI 360.0f\r\n\r\n\/\/ disable inbuilt expo functions\r\n\/\/#define DISABLE_EXPO\r\n\r\n\/\/ use if your tx has no expo function\r\n\/\/ also comment out DISABLE_EXPO to use\r\n\/\/ -1 to 1 , 0 = no exp\r\n\/\/ positive = less sensitive near center \r\n#define EXPO_XY 0.6f\r\n#define EXPO_YAW 0.25f\r\n\r\n\r\n\/\/ Hardware gyro LPF filter frequency\r\n\/\/ gyro filter 0 = 260hz\r\n\/\/ gyro filter 1 = 184hz\r\n\/\/ gyro filter 2 = 94hz\r\n\/\/ gyro filter 3 = 42hz\r\n\/\/ 4 , 5, 6\r\n#define GYRO_LOW_PASS_FILTER 3\r\n\r\n\/\/ software gyro lpf ( iir )\r\n\/\/ set only one below\r\n\/\/#define SOFT_LPF_1ST_023HZ\r\n\/\/#define SOFT_LPF_1ST_043HZ\r\n\/\/#define SOFT_LPF_1ST_100HZ\r\n\/\/#define SOFT_LPF_2ND_043HZ\r\n\/\/#define SOFT_LPF_2ND_088HZ\r\n\/\/#define SOFT_LPF_4TH_088HZ\r\n\/\/#define SOFT_LPF_4TH_160HZ\r\n\/\/#define SOFT_LPF_4TH_250HZ\r\n#define SOFT_LPF_NONE\r\n\r\n\/\/ this works only on newer boards (non mpu-6050)\r\n\/\/ on older boards the hw gyro setting controls the acc as well\r\n#define ACC_LOW_PASS_FILTER 5\r\n\r\n\r\n\/\/ Headless mode\r\n\/\/ Only in acro mode\r\n\/\/ 0 - flip \r\n\/\/ 1 - expert\r\n\/\/ 2 - headfree\r\n\/\/ 3 - headingreturn\r\n\/\/ 4 - AUX1 ( gestures &lt;&lt;v and &gt;&gt;v)\r\n\/\/ 5 - AUX2+ ( none )\r\n\/\/ 6 - Pitch trims\r\n\/\/ 7 - Roll trims\r\n\/\/ 8 - Throttle trims\r\n\/\/ 9 - Yaw trims\r\n\/\/ 10 - on always\r\n\/\/ 11 - off always\r\n\/\/ CH_ON , CH_OFF , CH_FLIP , CH_EXPERT\r\n\/\/ CH_HEADFREE , CH_RTH , CH_AUX1 , CH_AUX2 , CH_AUX3 , CH_AUX4\r\n\/\/ CH_PIT_TRIM, CH_RLL_TRIM, CH_THR_TRIM, CH_YAW_TRIM\r\n#define HEADLESSMODE CH_OFF\r\n\r\n\r\n\/\/ rates \/ expert mode\r\n\/\/ 0 - flip \r\n\/\/ 1 - expert\r\n\/\/ 2 - headfree\r\n\/\/ 3 - headingreturn\r\n\/\/ 4 - AUX1 ( gestures &lt;&lt;v and &gt;&gt;v)\r\n\/\/ 5 - AUX2+ ( none )\r\n\/\/ 6 - Pitch trims\r\n\/\/ 7 - Roll trims\r\n\/\/ 8 - Throttle trims\r\n\/\/ 9 - Yaw trims\r\n\/\/ 10 - on always\r\n\/\/ 11 - off always\r\n\/\/ CH_ON , CH_OFF , CH_FLIP , CH_EXPERT\r\n\/\/ CH_HEADFREE , CH_RTH , CH_AUX1 , CH_AUX2 , CH_AUX3 , CH_AUX4\r\n\/\/ CH_PIT_TRIM, CH_RLL_TRIM\r\n#define RATES 1\r\n\r\n\r\n\/\/ level \/ acro mode switch\r\n\/\/ CH_AUX1 = gestures\r\n\/\/ 0 - flip \r\n\/\/ 1 - expert\r\n\/\/ 2 - headfree\r\n\/\/ 3 - headingreturn\r\n\/\/ 4 - AUX1 ( gestures &lt;&lt;v and &gt;&gt;v)\r\n\/\/ 5 - AUX2+ ( none )\r\n\/\/ 6 - Pitch trims\r\n\/\/ 7 - Roll trims\r\n\/\/ 8 - Throttle trims\r\n\/\/ 9 - Yaw trims\r\n\/\/ 10 - on always\r\n\/\/ 11 - off always\r\n\/\/ CH_ON , CH_OFF , CH_FLIP , CH_EXPERT\r\n\/\/ CH_HEADFREE , CH_RTH , CH_AUX1 , CH_AUX2 , CH_AUX3 , CH_AUX4\r\n\/\/ CH_PIT_TRIM, CH_RLL_TRIM\r\n#define LEVELMODE CH_AUX1\r\n\r\n\/\/ channel to initiate automatic flip\r\n#define STARTFLIP CH_FLIP\r\n\r\n\/\/ aux1 channel starts on if this is defined, otherwise off.\r\n#define AUX1_START_ON\r\n\r\n\/\/ use yaw\/pitch instead of roll\/pitch for gestures\r\n\/\/#define GESTURES_USE_YAW\r\n\r\n\/\/ comment out if not using ( disables trim as channels, will still work with stock tx except that feature )\r\n#define USE_STOCK_TX\r\n\r\n\/\/ automatically remove center bias ( needs throttle off for 1 second )\r\n#define STOCK_TX_AUTOCENTER\r\n\r\n\/\/ throttle angle compensation in level mode\r\n\/\/ comment out to disable\r\n#define AUTO_THROTTLE\r\n\r\n\/\/ enable auto throttle in acro mode if enabled above\r\n\/\/ should be used if no flipping is performed\r\n\/\/ 0 \/ 1 ( off \/ on )\r\n#define AUTO_THROTTLE_ACRO_MODE 0\r\n\r\n\r\n\/\/ enable auto lower throttle near max throttle to keep control\r\n\/\/ comment out to disable\r\n\/\/#define MIX_LOWER_THROTTLE\r\n\r\n\/\/ options for mix throttle lowering if enabled\r\n\/\/ 0 - 100 range ( 100 = full reduction \/ 0 = no reduction )\r\n#define MIX_THROTTLE_REDUCTION_PERCENT 100\r\n\/\/ lpf (exponential) shape if on, othewise linear\r\n\/\/#define MIX_THROTTLE_FILTER_LPF\r\n\r\n\/\/ battery saver ( only at powerup )\r\n\/\/ does not start software if battery is too low\r\n\/\/ flashes 2 times repeatedly at startup\r\n#define STOP_LOWBATTERY\r\n\r\n\/\/ under this voltage the software will not start \r\n\/\/ if STOP_LOWBATTERY is defined above\r\n#define STOP_LOWBATTERY_TRESH 3.3f\r\n\r\n\/\/ voltage too start warning\r\n\/\/ volts\r\n#define VBATTLOW 3.5f\r\n\r\n\/\/ compensation for battery voltage vs throttle drop\r\n\/\/ increase if battery low comes on at max throttle\r\n\/\/ decrease if battery low warning goes away at high throttle\r\n\/\/ in volts\r\n#define VDROP_FACTOR 0.60f\r\n\r\n\/\/ voltage hysteresys\r\n\/\/ in volts\r\n#define HYST 0.10f\r\n\r\n\r\n\/\/ enable motor filter\r\n\/\/ hanning 3 sample fir filter\r\n#define MOTOR_FILTER\r\n\r\n\r\n\/\/ clip feedforward attempts to resolve issues that occur near full throttle\r\n\/\/#define CLIP_FF\r\n\r\n\/\/ motor transient correction applied to throttle stick\r\n\/\/#define THROTTLE_TRANSIENT_COMPENSATION\r\n\r\n\/\/ motor curve to use\r\n\/\/ the pwm frequency has to be set independently\r\n#define MOTOR_CURVE_NONE\r\n\/\/#define MOTOR_CURVE_6MM_490HZ\r\n\/\/#define MOTOR_CURVE_85MM_8KHZ\r\n\/\/#define MOTOR_CURVE_85MM_32KHZ\r\n\r\n\/\/ pwm frequency for motor control\r\n\/\/ a higher frequency makes the motors more linear\r\n\/\/#define PWM_490HZ\r\n\/\/#define PWM_8KHZ\r\n#define PWM_16KHZ\r\n\/\/#define PWM_24KHZ\r\n\/\/#define PWM_32KHZ\r\n\r\n\/\/ failsafe time in uS\r\n#define FAILSAFETIME 1000000 \/\/ one second\r\n\r\n\r\n\/\/ level mode \"manual\" trims ( in degrees)\r\n\/\/ pitch positive forward\r\n\/\/ roll positive right\r\n#define TRIM_PITCH 0.0f\r\n#define TRIM_ROLL 1.0f\r\n\r\n\r\n\/\/ ########################################\r\n\/\/ things that are experimental \/ old \/ etc\r\n\/\/ do not change things below\r\n\r\n\/\/ invert yaw pid for hubsan motors\r\n\/\/#define INVERT_YAW_PID\r\n\r\n\/\/some debug stuff\r\n\/\/#define DEBUG\r\n\r\n\/\/ disable motors for testing\r\n\/\/#define NOMOTORS\r\n\r\n\/\/ enable serial out on back-left LED\r\n\/\/#define SERIAL\r\n\r\n\r\n\/\/ enable motors if pitch \/ roll controls off center (at zero throttle)\r\n\/\/ possible values: 0 \/ 1\r\n#define ENABLESTIX 0\r\n\r\n\/\/ only for compilers other than gcc\r\n#ifndef __GNUC__\r\n\r\n#pragma diag_warning 1035 , 177 , 4017\r\n\r\n#pragma diag_error 260\r\n\r\n#endif\r\n\/\/ --fpmode=fast ON<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently flashed my new Eachine H8 with some custom firmware (Silver13&#8217;s CFW, to be particular) and I spent some time tuning it to be flyable in acro mode with the stock remote. Overall, I think this firmware is super cool and really strokes my roots as a hardware engineer and reverse engineer. Not to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.blog.jay-greco.com\/wp\/?p=154\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Eachine H8 Quadcopter Custom Firmware Rates\/Settings&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":155,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[20,9],"tags":[48,42,46,43,45,47,44],"class_list":["post-154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electrical-engineering","category-projects","tag-custom-firmware","tag-eachine-h8","tag-pids","tag-quadcopter","tag-rates","tag-settings","tag-toy"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.blog.jay-greco.com\/wp\/wp-content\/uploads\/2016\/04\/Screen-Shot-2016-04-19-at-10.47.57-PM.png?fit=779%2C173","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p755Zm-2u","jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/154"}],"collection":[{"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=154"}],"version-history":[{"count":1,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":156,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions\/156"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=\/wp\/v2\/media\/155"}],"wp:attachment":[{"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.blog.jay-greco.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}