cleaned up code, removed unused parts from uart
This commit is contained in:
parent
abe946e01f
commit
1262b14481
|
@ -2,12 +2,7 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9fad4545-a424-4a82-86dc-76602cf3eef3" name="Default" comment="">
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/atlassian-ide-plugin.xml" afterPath="" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/displayboard_servo/displayboard.iml" afterPath="" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/displayboard_servo/src/.main.c.swp" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/displayboard_servo/src/main.c" afterPath="$PROJECT_DIR$/displayboard_servo/src/main.c" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/displayboard_servo/src/main.h" afterPath="$PROJECT_DIR$/displayboard_servo/src/main.h" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
</list>
|
||||
<ignored path="bikegenerator.iws" />
|
||||
|
@ -82,7 +77,7 @@
|
|||
<file leaf-file-name="main.c" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/displayboard_servo/src/main.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="34" column="0" selection-start="726" selection-end="726" vertical-scroll-proportion="0.31337327">
|
||||
<state line="65" column="50" selection-start="1578" selection-end="1578" vertical-scroll-proportion="0.71748877">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -215,20 +210,6 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="powerboard_v2" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
|
@ -239,20 +220,6 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="powerboard" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
|
@ -263,20 +230,6 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="displayboard_servo" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="bikegenerator" />
|
||||
|
@ -506,23 +459,23 @@
|
|||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1596" y="0" width="1928" height="1176" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<editor active="false" />
|
||||
<layout>
|
||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3243626" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32361516" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32893288" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32944608" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="CDI" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2497332" sideWeight="0.67563736" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2497332" sideWeight="0.67638487" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Atlassian " active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
|
||||
|
@ -684,14 +637,14 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/powerboard_v2/src/main.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-0.5838323">
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-1.5269461">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/displayboard_servo/src/main.c">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="34" column="0" selection-start="726" selection-end="726" vertical-scroll-proportion="0.31337327">
|
||||
<state line="65" column="50" selection-start="1578" selection-end="1578" vertical-scroll-proportion="0.71748877">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
|
@ -9,26 +9,11 @@
|
|||
#include "uart.h"
|
||||
|
||||
#define BUFSIZE 40
|
||||
#define CURRENT_MAX 30000 // 30 Ampere is max
|
||||
#define POWER_MAX 300
|
||||
#define SERVO_NEUTRAL 2312
|
||||
#define SERVO_MIN 2312
|
||||
#define SERVO_MAX 2312
|
||||
|
||||
|
||||
volatile uint16_t syscounter = 0;
|
||||
|
||||
// values send over uart from powerboard
|
||||
uint16_t voltage = 0;
|
||||
int16_t current_in = 0;
|
||||
int16_t current_out = 0;
|
||||
uint8_t dumpsw = 0;
|
||||
uint8_t loadsw = 0;
|
||||
uint8_t gensw = 0;
|
||||
uint16_t display = 0;
|
||||
|
||||
uint16_t power_gen = 0;
|
||||
uint16_t power_load = 0;
|
||||
|
||||
unsigned char data_count = 0;
|
||||
unsigned char data_in[BUFSIZE];
|
||||
|
@ -68,34 +53,8 @@ static void process_command() {
|
|||
token = strtok(start, ",");
|
||||
|
||||
while( token ) {
|
||||
switch(tokencounter) {
|
||||
case 0:
|
||||
voltage = atoi(token);
|
||||
break;
|
||||
case 1:
|
||||
current_in = atoi(token);
|
||||
break;
|
||||
case 2:
|
||||
current_out = atoi(token);
|
||||
break;
|
||||
case 3:
|
||||
power_gen = atoi(token);
|
||||
break;
|
||||
case 4:
|
||||
power_load = atoi(token);
|
||||
break;
|
||||
case 5:
|
||||
if(atoi(token) == 1) loadsw = 1;
|
||||
else loadsw = 0;
|
||||
break;
|
||||
case 6:
|
||||
if(atoi(token) == 1) dumpsw = 1;
|
||||
else dumpsw = 0;
|
||||
break;
|
||||
case 7:
|
||||
if(atoi(token) == 1) gensw = 1;
|
||||
else gensw = 0;
|
||||
break;
|
||||
if (tokencounter == 3) {
|
||||
power_gen = atoi(token);
|
||||
}
|
||||
|
||||
tokencounter++;
|
||||
|
|
Loading…
Reference in New Issue