/*
 * Switch extruders, with the following special cases:
 * - No retraction distance.
 */
TEST_F(GCodeExportTest, SwitchExtruderSimple)
{
    Scene& scene = Application::getInstance().current_slice->scene;

    scene.extruders.emplace_back(0, nullptr);
    ExtruderTrain& train1 = scene.extruders.back();
    train1.settings.add("machine_extruder_start_code", ";FIRST EXTRUDER START G-CODE!");
    train1.settings.add("machine_extruder_end_code", ";FIRST EXTRUDER END G-CODE!");
    train1.settings.add("machine_firmware_retract", "True");
    train1.settings.add("retraction_enable", "True");
    scene.extruders.emplace_back(1, nullptr);
    ExtruderTrain& train2 = scene.extruders.back();
    train2.settings.add("machine_extruder_start_code", ";SECOND EXTRUDER START G-CODE!");
    train2.settings.add("machine_extruder_end_code", ";SECOND EXTRUDER END G-CODE!");
    train2.settings.add("machine_firmware_retract", "True");
    train2.settings.add("retraction_enable", "True");

    RetractionConfig no_retraction;
    no_retraction.distance = 0;

    EXPECT_CALL(*mock_communication, setExtruderForSend(testing::_));
    EXPECT_CALL(*mock_communication, sendCurrentPosition(testing::_));
    gcode.switchExtruder(1, no_retraction);

    EXPECT_EQ(std::string("G92 E0\n;FIRST EXTRUDER END G-CODE!\nT1\nG92 E0\n;SECOND EXTRUDER START G-CODE!\n"), output.str());
}
Esempio n. 2
0
void Test::test()
{
//    sendHearbeat(false, MAV_STATE_STANDBY);

    // battery
    updateUI();

    sendSystemStatus(100, 12.4);

    updateUI();

    sendHomePosition(
        getRadians(59, 57, 11.44), // 59�'11.44"N
        getRadians(30, 18, 51.69), // 30�'51.69"E
        0);

    updateUI();

    sendCurrentPosition(
        getRadians(59, 57, 11.44), // 59�'11.44"N
        getRadians(30, 18, 51.69), // 30�'51.69"E
        200);

    updateUI();

    sendVfrHud(
        10,  // ground speed 10 m/s
        180,   // heading south (180 deg)
        70,  // 70% throttle
        2);  // climb rate 2 m/s down

    updateUI();

    sendEkfStatusReport(0.9);

    updateUI();

    // Base parameters
    sendParameter("WPNAV_SPEED", 500);
    sendParameter("WPNAV_SPEED_UP", 250);
    sendParameter("WPNAV_SPEED_DN", 150);
    sendParameter("RTL_ALT", 1500);
    sendParameter("RTL_ALT_FINAL", 0);
    sendParameter("LAND_SPEED", 50);
    sendParameter("BATT_CAPACITY", 5000);
    sendParameter("FS_BATT_MAH", 1000);
    sendParameter("FS_BATT_VOLTAGE", 13);

    updateUI();

    //sendHearbeat(true);

/*    sendCurrentPosition(
        getRadians(59, 57, 37.56), // 59�'37.56"N
        getRadians(30, 18, 47.24), // 30�'47.24"E
        10); */

//    sendHearbeat(true, MAV_STATE_CRITICAL);
    sendStatusText(MAV_SEVERITY_CRITICAL, "Some very very very long status text.");

    updateUI();

    sendStatusText(MAV_SEVERITY_CRITICAL, "TEST");

    updateUI();

    sendChannels(1100, 1500);

    updateUI();

    sendHearbeat(true, MAV_STATE_ACTIVE);
}