added rounding, added alphabet test, adapted offset to SplitFlap 37

main
Jonas Arnold 4 years ago
parent b1720426e4
commit 929240dd9f
  1. 2
      ADIS_tinyK22_SplitFlap/.cproject
  2. 6
      ADIS_tinyK22_SplitFlap/source/application.c
  3. 2
      ADIS_tinyK22_SplitFlap/source/splitflap.c

@ -343,7 +343,7 @@
</folderInfo> </folderInfo>
<sourceEntries> <sourceEntries>
<entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="CMSIS"/> <entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="CMSIS"/>
<entry excluding="TraceRecorder|minIni|HD44780|FreeRTOS/Source/portable/GCC/RISC-V|FreeRTOS/Source/portable/GCC/ARM_CM33|FatFS" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="McuLib"/> <entry excluding="littleFS|LittlevGL|fonts|TraceRecorder|minIni|HD44780|FreeRTOS/Source/portable/GCC/RISC-V|FreeRTOS/Source/portable/GCC/ARM_CM33|FatFS" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="McuLib"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="board"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="board"/>
<entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="component"/> <entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="component"/>
<entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="device"/> <entry flags="LOCAL|VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="device"/>

@ -73,7 +73,7 @@ void App_Init(void){
void App_Run(void){ void App_Run(void){
PRINTF("Initializing split flap motors.\n"); PRINTF("Initializing split flap motors.\n");
bool successfulInit = SF_MoveMotorToZeroPosition(splitflap0, 20); bool successfulInit = SF_MoveMotorToZeroPosition(splitflap0, 12);
PRINTF("Init of motors done. Success = %s\n\n", successfulInit ? "true" : "false"); PRINTF("Init of motors done. Success = %s\n\n", successfulInit ? "true" : "false");
// if init failed => stop // if init failed => stop
@ -83,6 +83,10 @@ void App_Run(void){
// go through the following letters // go through the following letters
char* letters[] = {"J", "O", "N", "A", "S", "!"}; char* letters[] = {"J", "O", "N", "A", "S", "!"};
//char* letters[] = { " ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
// "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
// "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
// "!", "?", ":"};
PRINTF("Amount of letters %i\n", sizeof(letters)/sizeof(letters[0])); PRINTF("Amount of letters %i\n", sizeof(letters)/sizeof(letters[0]));
while(1){ while(1){

@ -33,7 +33,7 @@ void SF_InitConfig(void){
PRINTF("Splitflap positioning data is automatically calculated:\n"); PRINTF("Splitflap positioning data is automatically calculated:\n");
for(int i = 0; i < SPLITFLAP_AMOUNT_OF_SEGMENTS; i ++){ for(int i = 0; i < SPLITFLAP_AMOUNT_OF_SEGMENTS; i ++){
// + 0.5 so the rounding is done correctly // + 0.5 so the rounding is done correctly
int32_t position = (stepsPerSegment * (float)i); int32_t position = (stepsPerSegment * (float)i + 0.5);
addItem(splitFlapDict, SF_Letters[i], (int32_t*)position); addItem(splitFlapDict, SF_Letters[i], (int32_t*)position);
PRINTF("Letter '%s': Position %i\n", SF_Letters[i], (int)position); PRINTF("Letter '%s': Position %i\n", SF_Letters[i], (int)position);
} }

Loading…
Cancel
Save