Skip to content

Commit d95f4e6

Browse files
committed
Revert "Fixed github commitment issues"
This reverts commit ec6bfed.
1 parent ec6bfed commit d95f4e6

File tree

11 files changed

+159
-87
lines changed

11 files changed

+159
-87
lines changed

code/sensor/sensor/Makefile.old

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ error:
2323
$(error Invalid configuration, please check your inputs)
2424
endif
2525

26-
SOURCEFILES := $(BSP_ROOT)/STM32F30xxx/CMSIS/Device/ST/STM32F30x/Source/Templates/system_stm32f30x.c $(BSP_ROOT)/STM32F30xxx/startup_stm32f30x.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_adc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_can.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_comp.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_crc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dac.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dbgmcu.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dma.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_exti.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_flash.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_gpio.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_i2c.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_iwdg.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_misc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_opamp.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_pwr.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_rcc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_rtc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_spi.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_syscfg.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_tim.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_usart.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_wwdg.c source/dac.c source/delay.c source/edge-detection.c source/led-bar.c source/main.c source/opamp.c source/tsl1401cl.c source/usart.c
26+
SOURCEFILES := $(BSP_ROOT)/STM32F30xxx/CMSIS/Device/ST/STM32F30x/Source/Templates/system_stm32f30x.c $(BSP_ROOT)/STM32F30xxx/startup_stm32f30x.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_adc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_can.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_comp.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_crc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dac.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dbgmcu.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_dma.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_exti.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_flash.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_gpio.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_i2c.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_iwdg.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_misc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_opamp.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_pwr.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_rcc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_rtc.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_spi.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_syscfg.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_tim.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_usart.c $(BSP_ROOT)/STM32F30xxx/STM32F30x_StdPeriph_Driver/src/stm32f30x_wwdg.c source/dac.c source/delay.c source/edge-detection.c source/geometry.c source/led-bar.c source/main.c source/opamp.c source/tsl1401cl.c source/usart.c
2727
EXTERNAL_LIBS :=
2828
EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib)))
2929

@@ -273,6 +273,10 @@ $(BINARYDIR)/edge-detection.o : source/edge-detection.c $(all_make_files) |$(BIN
273273
$(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)
274274

275275

276+
$(BINARYDIR)/geometry.o : source/geometry.c $(all_make_files) |$(BINARYDIR)
277+
$(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)
278+
279+
276280
$(BINARYDIR)/led-bar.o : source/led-bar.c $(all_make_files) |$(BINARYDIR)
277281
$(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)
278282

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
22
<MemoryUtilizationReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
33
<FLASH>
4-
<Used>33484</Used>
4+
<Used>31108</Used>
55
<Total>262144</Total>
66
</FLASH>
77
<RAM>
8-
<Used>3136</Used>
8+
<Used>2564</Used>
99
<Total>49152</Total>
1010
</RAM>
1111
</MemoryUtilizationReport>

code/sensor/sensor/debug.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ADDITIONAL_LINKER_INPUTS :=
1313
MACOS_FRAMEWORKS :=
1414
LINUX_PACKAGES :=
1515

16-
CFLAGS := -ggdb -ffunction-sections -O0
17-
CXXFLAGS := -ggdb -ffunction-sections -fno-exceptions -fno-rtti -O0
16+
CFLAGS := -ggdb -ffunction-sections -O99
17+
CXXFLAGS := -ggdb -ffunction-sections -fno-exceptions -fno-rtti -O99
1818
ASFLAGS :=
1919
LDFLAGS := -Wl,-gc-sections
2020
COMMONFLAGS :=

code/sensor/sensor/debug.mak.old

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ADDITIONAL_LINKER_INPUTS :=
1313
MACOS_FRAMEWORKS :=
1414
LINUX_PACKAGES :=
1515

16-
CFLAGS := -ggdb -ffunction-sections -O99
17-
CXXFLAGS := -ggdb -ffunction-sections -fno-exceptions -fno-rtti -O99
16+
CFLAGS := -ggdb -ffunction-sections -O0
17+
CXXFLAGS := -ggdb -ffunction-sections -fno-exceptions -fno-rtti -O0
1818
ASFLAGS :=
1919
LDFLAGS := -Wl,-gc-sections
2020
COMMONFLAGS :=

code/sensor/sensor/gcc_Debug.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#define __UINTMAX_TYPE__ long long unsigned int
6868
#define __LLFRACT_EPSILON__ 0x1P-63LLR
6969
#define __DEC32_EPSILON__ 1E-6DF
70+
#define __OPTIMIZE__ 1
7071
#define __CHAR_UNSIGNED__ 1
7172
#define __UINT32_MAX__ 4294967295UL
7273
#define __ULFRACT_MAX__ 0XFFFFFFFFP-32ULR
@@ -177,7 +178,6 @@
177178
#define __SQ_IBIT__ 0
178179
#define __UINT8_TYPE__ unsigned char
179180
#define __UHA_FBIT__ 8
180-
#define __NO_INLINE__ 1
181181
#define __SFRACT_MIN__ (-0.5HR-0.5HR)
182182
#define __UTQ_FBIT__ 128
183183
#define __FLT_MANT_DIG__ 24
@@ -204,7 +204,6 @@
204204
#define __SIZE_TYPE__ unsigned int
205205
#define __UINT64_MAX__ 18446744073709551615ULL
206206
#define __UDQ_FBIT__ 64
207-
#define DEBUG 1
208207
#define __INT8_TYPE__ signed char
209208
#define __thumb__ 1
210209
#define __ELF__ 1
@@ -324,6 +323,7 @@
324323
#define __USACCUM_FBIT__ 8
325324
#define __INT32_TYPE__ long int
326325
#define __SIZEOF_DOUBLE__ 8
326+
#define Debug 1
327327
#define __UFRACT_EPSILON__ 0x1P-16UR
328328
#define __INTMAX_TYPE__ long long int
329329
#define __DEC128_MAX_EXP__ 6145

code/sensor/sensor/sensor.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<ClCompile Include="source\delay.c" />
9090
<ClCompile Include="source\edge-detection.c" />
9191
<ClCompile Include="source\geometry.c" />
92+
<ClCompile Include="source\i2c.c" />
9293
<ClCompile Include="source\led-bar.c" />
9394
<ClCompile Include="source\main.c" />
9495
<ClCompile Include="source\opamp.c" />
@@ -141,6 +142,7 @@
141142
<ClInclude Include="source\delay.h" />
142143
<ClInclude Include="source\edge-detection.h" />
143144
<ClInclude Include="source\geometry.h" />
145+
<ClInclude Include="source\i2c.h" />
144146
<ClInclude Include="source\led-bar.h" />
145147
<ClInclude Include="source\opamp.h" />
146148
<ClInclude Include="source\tsl1401cl.h" />

code/sensor/sensor/sensor.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
<ClCompile Include="source\geometry.c">
125125
<Filter>Source files</Filter>
126126
</ClCompile>
127+
<ClCompile Include="source\i2c.c">
128+
<Filter>Source files</Filter>
129+
</ClCompile>
127130
</ItemGroup>
128131
<ItemGroup>
129132
<None Include="Makefile" />
@@ -267,5 +270,8 @@
267270
<ClInclude Include="source\geometry.h">
268271
<Filter>Header files</Filter>
269272
</ClInclude>
273+
<ClInclude Include="source\i2c.h">
274+
<Filter>Header files</Filter>
275+
</ClInclude>
270276
</ItemGroup>
271277
</Project>

code/sensor/sensor/source/dac.c

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#include "tsl1401cl.h"
21
#include "dac.h"
2+
#include "tsl1401cl.h"
3+
#include "stm32f30x_rcc.h"
4+
#include "stm32f30x_tim.h"
35
#include "stm32f30x_dac.h"
46
#include "stm32f30x_dma.h"
57
#include "stm32f30x_gpio.h"
6-
#include "stm32f30x_rcc.h"
7-
#include "stm32f30x_tim.h"
88
#include "stm32f30x_dma.h"
99

1010
uint32_t DAC_DataBuffer[TSL_PIXEL_COUNT];
@@ -51,35 +51,50 @@ static void DAC_TimerConfig()
5151
TIM_Cmd(TIM2, ENABLE);
5252
}
5353

54-
static void DAC_DMAConfig()
54+
/* Configures the DAC to output a single value without using the DMA controller */
55+
static void DAC_SingleValueConfig()
5556
{
56-
DMA_InitTypeDef DMA_InitStructure;
57+
DAC_InitTypeDef DAC_InitStructure;
58+
GPIO_InitTypeDef GPIO_InitStructure;
5759

58-
/* Enable DMA2 clock -------------------------------------------------------*/
59-
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE);
60+
/* Enable GPIOA Periph clock --------------------------------------*/
61+
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
6062

61-
DMA_DeInit(DMA2_Channel3);
62-
DMA_InitStructure.DMA_PeripheralBaseAddr = DAC_DHR12RD_Address;
63-
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)&DAC_DataBuffer;
64-
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
65-
DMA_InitStructure.DMA_BufferSize = TSL_PIXEL_COUNT;
66-
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
67-
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
68-
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
69-
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
70-
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
71-
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
72-
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
73-
DMA_Init(DMA2_Channel3, &DMA_InitStructure);
63+
/* Configure PA.04 (DAC1_OUT1), PA.05 (DAC1_OUT2) as analog */
64+
GPIO_InitStructure.GPIO_Pin = DAC_OUTPUT_PIN_0 | DAC_OUTPUT_PIN_1;
65+
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
66+
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
67+
GPIO_Init(GPIOA, &GPIO_InitStructure);
7468

75-
/* Enable DMA2 Channel3 */
76-
DMA_Cmd(DMA2_Channel3, ENABLE);
69+
/* DAC Periph clock enable */
70+
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
71+
72+
/* Fill DAC InitStructure */
73+
DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
74+
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
75+
DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits2_0;
76+
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;
77+
78+
/* DAC channel1 Configuration */
79+
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
80+
81+
/* DAC channel2 Configuration */
82+
DAC_Init(DAC_Channel_2, &DAC_InitStructure);
83+
84+
/* Enable DAC Channel1: Once the DAC channel1 is enabled, PA.04 is
85+
automatically connected to the DAC converter. */
86+
DAC_Cmd(DAC_Channel_1, ENABLE);
87+
88+
/* Enable DAC Channel2: Once the DAC channel2 is enabled, PA.05 is
89+
automatically connected to the DAC converter. */
90+
DAC_Cmd(DAC_Channel_2, ENABLE);
7791
}
7892

79-
static void DAC_DACConfig()
93+
static void DAC_DMA_Config()
8094
{
8195
DAC_InitTypeDef DAC_InitStructure;
8296
GPIO_InitTypeDef GPIO_InitStructure;
97+
DMA_InitTypeDef DMA_InitStructure;
8398

8499
/* Enable GPIOA Periph clock --------------------------------------*/
85100
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
@@ -115,11 +130,35 @@ static void DAC_DACConfig()
115130

116131
/* Enable DMA for DAC Channel1 */
117132
DAC_DMACmd(DAC_Channel_1, ENABLE);
133+
134+
/* Enable DMA2 clock -------------------------------------------------------*/
135+
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE);
136+
137+
DMA_DeInit(DMA2_Channel3);
138+
DMA_InitStructure.DMA_PeripheralBaseAddr = DAC_DHR12RD_Address;
139+
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)&DAC_DataBuffer;
140+
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
141+
DMA_InitStructure.DMA_BufferSize = TSL_PIXEL_COUNT;
142+
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
143+
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
144+
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
145+
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
146+
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
147+
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
148+
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
149+
DMA_Init(DMA2_Channel3, &DMA_InitStructure);
150+
151+
/* Enable DMA2 Channel3 */
152+
DMA_Cmd(DMA2_Channel3, ENABLE);
118153
}
119154

120-
void DAC_Setup()
155+
void DAC_DMA_Setup()
121156
{
122-
DAC_DMAConfig();
123-
DAC_DACConfig();
157+
DAC_DMA_Config();
124158
DAC_TimerConfig();
159+
}
160+
161+
void DAC_SingleValue_Setup()
162+
{
163+
DAC_SingleValueConfig();
125164
}

code/sensor/sensor/source/dac.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
extern void DAC_SetCH1(uint32_t x[]);
1818
extern void DAC_SetCH2(uint32_t x[]);
19-
extern void DAC_Setup();
19+
extern void DAC_DMA_Setup();
20+
extern void DAC_SingleValue_Setup();
2021

2122
#endif

code/sensor/sensor/source/main.c

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "led-bar.h"
1212
#include "opamp.h"
1313
#include "geometry.h"
14+
#include "i2c.h"
1415

1516
#define USART1_BAUDRATE (115200U)
1617
char buffer[60];
@@ -23,54 +24,71 @@ int main()
2324
Delay_Init();
2425
TSL_Init();
2526
LED_Init();
26-
27-
// Turn on the sensor LEDs
28-
LED_Write(0, Bit_SET);
29-
LED_Write(1, Bit_SET);
30-
31-
const int iterations = 300;
27+
I2C_Config();
28+
DelayMs(10);
29+
uprintf("Reset\r\n");
3230
while(1)
3331
{
34-
int i;
35-
EdgeData x_edge_sum = {0,0,0,1};
36-
EdgeData y_edge_sum = {0,0,0,1};
37-
for (i = 1; i < iterations+1; i++)
32+
int x;
33+
for (x=0x7F; x; x--)
3834
{
39-
TSL_MeasurePixels(xPixels, yPixels);
40-
EdgeData edge_x = DET_MicronsBetweenEdges(xPixels);
41-
EdgeData edge_y = DET_MicronsBetweenEdges(yPixels);
35+
I2C_Write(x,x, x);
36+
DelayMs(1);
4237

43-
if (edge_x.IsValid && edge_y.IsValid)
44-
{
45-
/* Add the x-result to the sum */
46-
x_edge_sum.E0 += edge_x.E0;
47-
x_edge_sum.E1 += edge_x.E1;
48-
x_edge_sum.Width += edge_x.Width;
49-
50-
/* Add the y-result to the sum */
51-
y_edge_sum.E0 += edge_y.E0;
52-
y_edge_sum.E1 += edge_y.E1;
53-
y_edge_sum.Width += edge_y.Width;
54-
}
55-
else
56-
{
57-
i -= 1; /* Reject the measurement */
58-
}
59-
LED_Write(2, (BitAction)(edge_x.IsValid));
60-
LED_Write(3, (BitAction)(edge_y.IsValid));
6138
}
62-
63-
x_edge_sum.E0 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
64-
x_edge_sum.E1 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
65-
x_edge_sum.Width /= (float)iterations;
66-
y_edge_sum.E0 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
67-
y_edge_sum.E1 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
68-
y_edge_sum.Width /= (float)iterations;
69-
70-
float diameter = GEO_Filament_Diameter_MM(x_edge_sum, y_edge_sum);
7139
}
40+
//uprintf("Last byte: %i\r\n", data);
41+
//DelayMs(250);
7242
}
7343

44+
45+
//// Turn on the sensor LEDs
46+
//LED_Write(0, Bit_SET);
47+
//LED_Write(1, Bit_SET);
48+
49+
//const int iterations = 300;
50+
//while(1)
51+
//{
52+
// int i;
53+
// EdgeData x_edge_sum = {0,0,0,1};
54+
// EdgeData y_edge_sum = {0,0,0,1};
55+
// for (i = 1; i < iterations+1; i++)
56+
// {
57+
// TSL_MeasurePixels(xPixels, yPixels);
58+
// EdgeData edge_x = DET_MicronsBetweenEdges(xPixels);
59+
// EdgeData edge_y = DET_MicronsBetweenEdges(yPixels);
60+
61+
// if (edge_x.IsValid && edge_y.IsValid)
62+
// {
63+
// /* Add the x-result to the sum */
64+
// x_edge_sum.E0 += edge_x.E0;
65+
// x_edge_sum.E1 += edge_x.E1;
66+
// x_edge_sum.Width += edge_x.Width;
67+
68+
// /* Add the y-result to the sum */
69+
// y_edge_sum.E0 += edge_y.E0;
70+
// y_edge_sum.E1 += edge_y.E1;
71+
// y_edge_sum.Width += edge_y.Width;
72+
// }
73+
// else
74+
// {
75+
// i -= 1; /* Reject the measurement */
76+
// }
77+
// LED_Write(2, (BitAction)(edge_x.IsValid));
78+
// LED_Write(3, (BitAction)(edge_y.IsValid));
79+
// }
80+
81+
// x_edge_sum.E0 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
82+
// x_edge_sum.E1 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
83+
// x_edge_sum.Width /= (float)iterations;
84+
// y_edge_sum.E0 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
85+
// y_edge_sum.E1 *= (TSL_PIXEL_SPACING_NM / 1000.0f / 1000.0f) / (float)iterations;
86+
// y_edge_sum.Width /= (float)iterations;
87+
88+
// float diameter = GEO_Filament_Diameter_MM(x_edge_sum, y_edge_sum);
89+
90+
91+
7492
//****************************************************************************
7593

7694
#ifdef USE_FULL_ASSERT

0 commit comments

Comments
 (0)