Commit 2a534a48 authored by Werner Sembach's avatar Werner Sembach
Browse files

Fix first Ainigma

parent b43d78cf
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="32.64mm" height="36.64mm" viewBox="0 0 32.64 36.64" xmlns="http://www.w3.org/2000/svg" version="1.1">
<g id="Sketch" transform="translate(16.320000,17.320000) scale(1,-1)">
<path id="Sketch_w0000" d="M -16.0 1.0 L -16.0 -19.0 L 16.0 -19.0 L 16.0 1.0 A 16.0 16.0 0 0 1 8.68695136855e-16 17.0 L 8.68695136855e-16 17.0 A 16.0 16.0 0 0 1 -16.0 1.0 " stroke="#000000" stroke-width="0.35 px" style="stroke-width:0.35;stroke-miterlimit:4;stroke-dasharray:none;fill:none;fill-rule: evenodd "/>
<path id="Sketch_w0001" d="M -7.5 -2.41218397451e-15 L -7.5 -17.5 L 7.5 -17.5 L 7.5 0.0 A 7.5 7.5 0 1 1 -7.5 -2.41218397451e-15 " stroke="#000000" stroke-width="0.35 px" style="stroke-width:0.35;stroke-miterlimit:4;stroke-dasharray:none;fill:none;fill-rule: evenodd "/>
<title>Sketch</title>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="160.35001mm"
height="36.350002mm"
viewBox="0 0 160.35001 36.350002"
version="1.1"
id="svg13"
sodipodi:docname="test.svg"
inkscape:version="0.92.1 r">
<metadata
id="metadata19">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs17" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1006"
id="namedview15"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.728736"
inkscape:cx="303.02362"
inkscape:cy="1.6629004"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg13" />
<g
id="Sketch"
transform="matrix(1,0,0,-1,39.675,16.175)"
style="fill:none;fill-opacity:1;stroke:#ff0000;stroke-opacity:1">
<path
id="Sketch_w0000"
d="M -23.500031,16 A 16,16 0 0 1 -39.5,0 V -19 H 0 v -1 H 120.5 V 0 a 16,16 0 0 1 -16,16 H -23.500031"
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.34999999;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1"
inkscape:connector-curvature="0" />
<circle
cx="-36"
cy="-9.078281e-16"
r="1.5"
style="fill:none;stroke:#ff0000;stroke-width:0.34999999;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1"
id="circle3" />
<circle
cx="-23.5"
cy="-3.5271662e-16"
r="6.5"
style="fill:none;stroke:#ff0000;stroke-width:0.34999999;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1"
id="circle5" />
<circle
cx="-11"
cy="-1.96497e-17"
r="1.5"
style="fill:none;stroke:#ff0000;stroke-width:0.34999999;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1"
id="circle7" />
<path
id="Sketch_w0004"
d="m 97,0 v -17.5 h 15 V 0 A 7.5,7.5 0 0 1 97,0"
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.34999999;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1;stroke-opacity:1"
inkscape:connector-curvature="0" />
<title
id="title10">Sketch</title>
</g>
</svg>
......@@ -174,13 +174,13 @@ bool motor_on (uint16_t input_adc){
}
else if(input_adc > 3900) {
ezs_printf("Speed: %3d\n", 0);
dc_set(DC_LEFT, 250);
dc_set(DC_RIGHT, 250);
return true;
}
else {
uint8_t speed = input_adc / 4096.0 * 125;
ezs_printf("Speed: %3d\n", speed);
dc_set(DC_LEFT, speed);
dc_set(DC_RIGHT, speed);
}
return false;
}
......@@ -188,12 +188,14 @@ bool motor_on (uint16_t input_adc){
void test_thread(cyg_addrword_t arg) {
test_init();
bool button_state = false;
bool ueberdreht = false;
bool upside_down = false;
uint16_t input_adc;
servo_set(SERVO_0, 100);
servo_set(SERVO_0, 0);
while (1) {
input_adc = read_adc_naiive(11);
......@@ -213,7 +215,7 @@ void test_thread(cyg_addrword_t arg) {
if(input_adc > 2500) {
uint8_t speed = 250; //input_adc / 4096.0 * 125; //max: 106
ezs_printf("Speed: %3d\n", speed);
dc_set(DC_LEFT, speed);
dc_set(DC_RIGHT, speed);
}
else {
dc_set(0, 0);
......@@ -228,7 +230,6 @@ void test_thread(cyg_addrword_t arg) {
cyg_thread_delay(250);
}
}
}
void cyg_user_start(void) {
......
......@@ -118,16 +118,16 @@ extern "C" void servo_init() {
extern "C" void servo_set(uint8_t servo, uint8_t position) {
switch (servo) {
case SERVO_0:
timer_set_oc_value(TIM4, TIM_OC1, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 350 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
timer_set_oc_value(TIM4, TIM_OC1, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 325 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
break;
case SERVO_1:
timer_set_oc_value(TIM4, TIM_OC2, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 350 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
timer_set_oc_value(TIM4, TIM_OC2, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 325 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
break;
case SERVO_2:
timer_set_oc_value(TIM4, TIM_OC3, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 350 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
timer_set_oc_value(TIM4, TIM_OC3, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 325 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
break;
case SERVO_3:
timer_set_oc_value(TIM4, TIM_OC4, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 350 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
timer_set_oc_value(TIM4, TIM_OC4, 150 * PWM_TIMER_TICKS_PER_MICROSECOND + (position * 325 * PWM_TIMER_TICKS_PER_MICROSECOND / 255));
break;
default:
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment